0% found this document useful (0 votes)
6 views9 pages

Image Enhancement Histogram Processing

The document discusses histogram processing for image enhancement, explaining concepts such as histogram normalization, linear stretching, and the effects of different gray level distributions on image contrast. It provides examples of dark, bright, low contrast, and high contrast images, along with a code snippet for implementing linear stretching in image processing. The goal is to enhance visual interpretation by adjusting the dynamic range of gray levels in images.

Uploaded by

Abhishek Andhere
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views9 pages

Image Enhancement Histogram Processing

The document discusses histogram processing for image enhancement, explaining concepts such as histogram normalization, linear stretching, and the effects of different gray level distributions on image contrast. It provides examples of dark, bright, low contrast, and high contrast images, along with a code snippet for implementing linear stretching in image processing. The goal is to enhance visual interpretation by adjusting the dynamic range of gray levels in images.

Uploaded by

Abhishek Andhere
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

L6

Image enhancement
Histogram Processing
Introduction
• Histogram
– Discrete Function
– number
of pixels of gray level
– Normalization of histogram: where n :
total number of pixels
– : probability of grey level , k=0,1…..L-1
– Histogram plots : : vs or vs
Histogram
Gr No.of
ey pixels
Le
vel
0 30 0.3
1 20 0.2
2 10 0.1
)
3 15 0.15
4 10 0.1
5 3 0.03
6 2 0.02
7 10 0.1
Images with Histograms
• Dark Image
– Concentration of gray
levels at Low side of gray
scale
• Bright Image
– Concentration of gray
levels at high side of
histogram
• Low contrast
– Concentration of gray
levels at center of gray
scale
• High contrast
– Occupy Broad range of
gray scale
– Pixels distribution is
uniform
Linear Stretching
• Dynamic range of gray levels is
obtain by linear stretching of
histogram
• Shape of histogram is not altered

• As shape remains the same, flat


histogram cannot achieve by this
method
• This enhances the contrast in the
image with light toned areas
appearing lighter and dark areas
appearing darker, making visual
interpretation much easier.
19x10=190

Example
• Do Histogram stretching
to have grey level range[0,7]
0 1 2 3 4 5 6 7
0 0 40 50 70 20 10 0
19x10=190

Example
• Do Histogram stretching
to have grey level range[0,7]
0 1 2 3 4 5 6 7
0 0 40 50 70 20 10 0

• Solution:
r=2: s=0, r=3: s=1.75=2, r=4: s=3.5=4,
r=5: s=5.2=5, r=6: s=7
Modified Histogram
0 1 2 3 4 5 6 7
40 0 50 0 70 20 0 10 Note X-axis 0…….7
Example
0 1 2 3 4 5 6 7
100 90 80 60 0 0 0 0

r=0: s=0, r=1: s=2.3=2,


r=2: s=4.67=5 , r=3: s=7
Modified Histogram

0 1 2 3 4 5 6 7
100 0 90 0 0 80 0 60

Note X-axis 0…….7


Code : Linear Stretching
Rmin=43
• %linear stretching
• clear all; Rmax=244
• clc;
• b=imread('C:\Users\AnupaSabnis\Desktop\Anupa\
Anupa_Courses\2020-2021\Course
Even\IP\lenalow.png');
• rmax=max(b(:))
• rmin=min(b(:))
• a=double(b);

• [row col]=size(a);

• for x=1:1:row Smin=0
• for y=1:1:col
• c=b(x,y); Smax=255
• a(x,y)=(255/(rmax-rmin))*(c-rmin)+0;
• end
• end

• figure(1)
• imshow(b)
• figure(2)
• imshow(uint8(a))

You might also like