image processing image histogram lecture 8 14-2-2012 1
TRANSCRIPT
1
Image Processing
Image HistogramLecture 8
14-2-2012
2
Image enhancement
The main objective of enhancement techniques is to process an image so the result is more suitable than original image for a specific application
(improve the appearance of an image)
14-2-2012
3Poor image enhance image14-2-2012
4Poor image enhance image14-2-2012
5
•Spatial domain :- Direct manipulation of image pixels•Frequency domain :- Manipulation of Fourier ,wavelet, DCT , haar transforms of an image
Enhancement techniques
Spatial domain
Frequency domain
applications
Block diagram of image enhancement
Poor image I(r , c)
Enhance image E(r , c)
14-2-2012
6
As a block diagram of image enhancement we use it in :-
•Preprocessing :- to ease the next processing steps ( computer vision)
•Post processing :- to improve the visual perception of processed image( image compression)
•Image enhancement may be an end in itself
14-2-2012
7
image enhancement techniques
1. image histogram (in spatial domain)
2. image Sharpening 3. image smoothing (in
spatial & frequency domain )
14-2-2012
8
Image histogram The histogram of an image is a plot of the gray-level values versus the number of pixels at
that value(shows us the distribution of grey levels in the image).
A histogram appear as a graph with ‘brightness‘ on the horizontal axis from 0 to 255 (for an 8-bit
intensity scale) and ‘number of pixels’ on the vertical axis. To find the number of pixels having a
particular brightness within an image, we simply look up the brightness on the horizontal axis .s
14-2-2012
9
14-2-2012
For each colored image three histogram are computed, one for
each component (RGB, HSL).The histogram gives us a convenient -
easy -to -read representation of the concentration of pixels versus
brightness of an image,
using this graph we able to see immediately:
1 Whether an image is basically dark or light and high or low
contrast.
2 Give us our first clues about what contrast enhancement would
be appropriately applied to make the image more subjectively
pleasing to an observer, or easier to interpret by succeeding image
analysis operations.
10
14-2-2012
So the shape of histogram provide us with information about nature of
the image or sub image if we considering an object within the image. For
example:
1 Very narrow histogram implies a low-contrast image.
2 Histogram skewed to word the high end implies a bright image.
3 Histogram with two major peaks , called bimodal, implies an object
that is in contrast with the background.
11
Example:- find & draw the histogram for the sub image2
0 10
10
10
10
22
12
12
12
12
23
13
14
14
13
23
13
14
14
13
20
12
15
14
13
No pixels
Gray level value
4 1o 5 12 5 13 5 14 1 15 2 20 1 22
2 23
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
Gray levels
Nu
mb
er
of
pix
els
14-2-2012
12
14-2-2012
13
14-2-2012
14
The histogram can be modified or scaled by three methods
1.histogram stretching 2. histogram shrinking 3. histogram sliding
Image histogram modification -:
14-2-2012
15
14-2-2012
The gray level histogram of an
image is the distribution of the
gray level in an image. The
histogram can be modified by
mapping functions, which will
stretch, shrink (compress), or
slide the histogram. Figure below
illustrates a graphical
representation of histogram
stretch, shrink and slide.s
14-2-201216
I(r , c)max is the largest gray-level value in the image I(r , c)
I(r , c)min is the smallest gray level value in the image I(r , c)
Max and min correspond to the maximum and minimum gray-level values
possible(for 8-bit image these are 255 and 0)
Histogram Stretching :
take an image and stretch the histogram across the entire gray-level
range, which has the effect of increasing the contrast of a low
contrast image . the histogram of an image can be stretched by the
following equation
17
14-2-2012
18Example:- apply histogram stretching for the following sub image values
7 12
8
20
9 6
10
15
1
80.52
147.63
93.94
255 107.36
67.10
120.78
187.89
0I(r, c)max =20 , I(r ,c)min =1 , max=255 , min= 0
I (Stretch)= [7-1/20-1] * [255-0]+0= 80.52 = [12-1/20-1] * [255-0]+0=147.63 = [8-1/20-1] * [255-0]+0=93.94 = [20-1/20-1] * [255-0]+0=255 =[9-1/20-1] * [255-0]+0=107.36 =[6-1/20-1] * [255-0]+0= 67.10 =[10-1/20-1] * [255-0]+0= 120.78 =[15-1/20-1] * [255-0]+0= 187.89 = [1-1/20-1] * [255-0]+0= 0
14-2-2012
Histogram Sliding :- Method can be used to make an image either darker or lighter but retain the relationship between gray-level values. this can be accomplished by simply adding or subtracting a fixed number from all the gray level values as follow
Where the offset value is the amount to slide the histogram ,a positive offset Value will increase the overall brightness where as negative offset will create a darker image
14-2-2012
19
20
14-2-2012
21
17 22 18
30 19 16
20 25 11
Example:- apply histogram slide for the following sub image 7 1
28
20
9 6
10
15
1Slide(I(r , c)) = 7+10 = 17 =12+10 = 22 = 8+10 = 18 = 20+10 = 130 =9+10 = 19 =6+10 = 16 = 10+10 = 20 = 15+10 = 25 = 1+10 = 11
14-2-2012
22histogram shrinking :- which will decrease image contrast by compressing the gray Levels. the histogram of an image can be shrink by the following equation
Where:- I(r , c)max is the largest gray-level value in the image I(r , c) I(r , c)min is the smallest gray level value in the image I(r , c)Shrink( Max) , shrink(min) correspond to the maximum and minimum desired in the compressed histogram.
14-2-2012
23
14-2-2012
24
8.15 10.78 8.6815 9.21 7.639.73 12.36 5
7 12
8
20
9 6
10
15
1Shrink(max)= 15 , shrink(min)= 5I shrink = [15-5/20-1] * [7-1] +5 =8.15 = [15-5/20-1] * [ 12-1]+5=10.78 = [15-5/20-1] * [8-1]+5 =8.68 = [15-5/20-1] * [20-1]+5 =15 = [15-5/20-1] * [9-1]+5 =9.21 = [15-5/20-1] * [6-1]+5 =7.63 = [15-5/20-1] * [10-1]+5 =9.73 = [15-5/20-1] * [15-1]+5 =12.36 = [15-5/20-1] * [1-1]+5 = 5
Example:- apply histogram shrink for the following sub image
14-2-2012
25Image histogram equalization
14-2-2012
Histogram equalization is a technique where the histogram of the
resultant image is as flat as possible (with histogram stretching
the overall shape of the histogram remains the same)
The results in a histogram with a mountain grouped closely
together to "spreading or flatting histogram makes the dark
pixels appear darker and the light pixels appear lighter (the key
word is "appear" the dark pixels in a photograph can not by any
darker. If, however, the pixels that are only slightly lighter
become much lighter, then the dark pixels will appear darker).
26
14-2-2012
27
14-2-2012
28
The histogram equalization process consists of four
steps
1. Find the running sum of the histogram values
2. Normalize the values from step1 by dividing by total number of
pixels.
3. Multiply the values from step2 by the maximum gray level
value and round.
4. Map the gray-level values to the results from step 3, using a
one-to- one correspondence.
14-2-2012
29
Example: apply histogram equalization for the following gray- level valuesGray-level values:- 0 1 2 3 4 5 6Histogram values:- 10 8 9 2 14 1 5
0 1 2 3 4 5 6 7
2 4
6 8
10
12 14
14-2-2012
30
14-2-2012
31
14-2-2012
0 1 2 3 4 5 6 7
1
2
3 4
5
6
7
32
14-2-2012
Step 1: Great a running sum of histogram values. This means that the
first values is 10, the second is 10+8=18, next is 10+8+9=27, and
soon. Here we get 10,18,29,43,44,49,51.
Step 2: Normalize by dividing by total number of pixels. The total
number of pixels is 10+8+9+2+14+1+5+0=51.
Step 3: Multiply these values by the maximum gray – level values in
this case 7 , and then round the result to the closet integer. After this is
done we obtain 1,2,4,4,6,6,7,7.
Step 4: Map the original values to the results from step3 by a one –to-
one correspondence.
33
14-2-2012
34
14-2-2012
4 Histogram of the color image:There is one histogram per color band R, G, & B. Luminosity histogram is from 1 band = (R+G+B)/3 There is one histogram per color band R, G, & B. Luminosity histogram is from 1 band = (R+G+B)/3
35
14-2-2012
36
14-2-2012Histogram Equalization for the color image: