2. Histogram processing
• Histogram: gray level against number of pixel for gray level
• provide distribution of pixel values.
• Illustrate brightness and contrast of image
3. MATLAB code
• For gray &binary image imhist(image) display histogram of 2d image
• For RGB image imhist(RGB(:,:,1)) imhist(RGB(:,:,2)) imhist(RGB(:,:,3))
• Task1
• Create function that get gray or RGB image and return histogram
•
6. Basic intensity transformation functions
• There are three basic Types of functions:
Linear(negative and Identity transformation).
Logarithmic (Log and invers-log transformation).
Power-low(nth-power and nth-root transformation).
8. Logarithmic transformation
• General form:
s = c * log𝟐(𝟏 + 𝒓)
The log transformation maps a narrow range of low input grey level values into
a wider range of output values .(brights images).
• The inverse log transformation performs the opposite transformation .
S=exp(r)
9. • The negative of the image with intensity level in the range [0,L-1]
is given by the expression: S=L-1-r
• Power-law (gamma) transformation
s= 𝑐 ∗ 𝑟𝑦
11. Q)A 4x4 , 4bits/pixel image passes through appoint-wise intensity transformation given
by
S=T(r) = αlog2 1 + 𝑟 + 𝛽
Where α and 𝛽 are unknown parameters. Only a few pixels are available in the input
and output images , as shown below
(a) Find α and 𝛽
(b)what is the value of the pixel with the “?” mark in the output image.
(c)what is the value of the pixel with the “?” mark in the input image.
3
15
?
1 3
5
11
8
? 5
T(r)
12. Q) A4x4,4bits/pixel image (shown below) passes through one
point-wise intensity transformations given by
S=T(r)= round(5 𝑟 )
7 3 4 1
1 2 0 3
4 2 2 1
0 3 5 1
T(r)
14. Contrast stretching example
• Q) A4*4, 4bits/pixel original image is given by
Apply full-scale contrast stretch to the image . show your work and sketch the
resulting image
• old min=6 old max=14
• new min=0 new max=15
• New value=
6−6
14−6
∗ 15 − 0 + 0 = 0
• New value=
13−6
14−6
∗ 15 − 0 + 0 =13
15. Contrast stretching matlab code
• Imadjust(I,[oldmin oldmax],[newmin newmax])
• Task3
Contrast stretching mfile that take gray or RGB image
Min(min(I))
Max(max(I))
17. Bit Plane Slicing
• Often by isolating particular bits of the pixel values in an image we can
highlight interesting aspects of that image
• 10110011
most
• most least
• significant significant