EE 583 Lecture06
EE 583 Lecture06
EE 583 Lecture06
s=T(r)
s=T(r)
A/2
B/2
L0
L0
(a)
Ae
aL0
A/ 2
L0
(b)
T (r ) Ae
solving for a :
(c)
ar 2
a 0.693 / L20
Then:
s T (r ) Ae
0.693 2
r
L20
Prepared By: Dr. Hasan Demirel, PhD
s=T(r)
Example 1(PR3.1):
D
B
B/2
C
L0
In Figure (b):
B(1 e
) B/2
s T (r ) B(1 e
0.693
2 r2
L0
L0
(c)
(b)
s T( r ) B Be
Then:
a r 2
B( 1 e
a r 2
a 0.693 / L20
)
s T (r ) ( D C )(1 e
0.693 2
r
L20
)C
Consider mod(x,y) to be the modular division resulting the remainder of the integer
division x/y.
7
255
for
2
r
For Bit plane 7 (MSB): the following
T (r )
function can be written
otherwise
0
255
T (r )
0
255
T (r )
0
255
T (r )
0
255
T (r )
0
255
T (r )
0
255
T (r )
0
255
T (r )
0
255
T (r )
0
for 26 mod(r , 27 )
otherwise
250
200
s=T(r)
Note that all the 1s corresponding to bit
6 are scaled to 255 and all the bits
corresponding to 0s are scaled down to
0.
150
s
100
50
50
31=00011111
100
150
200
111=01101111
190=10111110
250
250=11001110
a) Removing the low order bit planes would mean the loss of some high frequency details.
Furthermore the image histogram will be more sparse as compared with the all 8-bit
plane case.
This is because, there will be no component representing intermediate pixel values
such as 1,2,3,4, 5, 6,7 and 9,10,11,12,13,14,15 etc. Instead there will be 0 and 8 and 16 etc.
This would cause the height some of the remaining histogram peaks to increase in general.
Typically, less variability in gray level values will reduce contrast.
2000
1000
1500
800
1000
600
500
400
200
0
0
0
0
50
100
150
200
250
50
100
150
200
250
1200
1000
1000
800
800
600
600
400
400
200
200
0
0
50
100
150
200
250
50
100
150
200
250
MSB removed
Prepared By: Dr. Hasan Demirel, PhD
sk T (rk )
j 0
nr j
1 k
nr j
n n j 0
Since every pixel (and no others) with value rk is mapped to value sk, it follows that nsk = nrk . A
second pass of histogram equalization would produce values vk according
to the transformation:
k
vk T ( sk )
ns j
, but ns j nr j , then
j 0 n
k n
r
vk T ( sk ) j sk
j 0 n
Which shows that a second pass of histogram equalization would yield the same result
as the first pass.
Prepared By: Dr. Hasan Demirel, PhD
0.9
0.9
0.8
0.8
0.7
0.7
0.6
0.6
0.5
0.4
0.4
0.3
0.3
0.2
0.2
0.1
0.1
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0.5
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
6000
6000
5000
5000
4000
4000
3000
3000
2000
2000
1000
1000
50
100
150
200
250
50
100
150
200
250
averaging masks of sizes n=23, 25 and 45 respectively. The vertical bars on the lower part
of (a) and (c) are blurred, but clear separation exists between them. However, the bars
have merged in in image (b), in spite of the fact that the mask that produced the image is
significantly smaller than the mask produced image (c) .Explain this.
(Note that the vertical bars are 5 pixels wide and 20 pixels apart.)
Original image
(a)
(b)
(c)
(a)
(b)
(c)
The reason why the mask with size n=25 producing merged uniform region around the bars is
because of the sizes of the bars and the separation of the bars in the horizontal direction. The
width of each bar is 5 pixels and each bar is separated by 20 pixels.
In such an environment as the mask moves in the horizontal direction there will be 5 black and
20 light gray pixels in each row at a time. This will provide the same average value for each pixel
in the region producing a merged uniform gray level.
However this will not be the same in 23 and 45 pixel masks!!
Laplacian operation and averaging can be expressed by the following 3x3 masks:
Laplacian g ( x, y) f ( x 1, y) f ( x 1, y) f ( x, y 1) f ( x, y 1) 4 f ( x, y)
1 9
Averaging h( x, y ) fi
9 i 1
1/9
1/9
1/9
1/9
1/9
1/9
-4
1/9
1/9
1/9
Averaging Mask
Laplacian Mask
Both of the two operators are multiplying the pixels in a 3x3 neighborhood with constant
numbers and perform the addition. Therefore, these operations are linear operations.
The order of two linear operations does not matter. The result would be same in any order.
x x cos q y sin q
y x sin q y cos q
Taking the partial derivative of this expression again with respect to x yields:
Taking the partial derivative of this expression again with respect to y yields:
The nearly periodic bright points in the frequency spectrum corresponds to the periodic bars as well as
the repeating boxes, letters and circles in the horizontal direction.
1
F( u,v )
MN
M 1 N 1
1
F( u M / 2,v N / 2 )
MN
M 1 N 1
MN
f ( x, y )e
j 2 ( ux / M vy / N )
x 0 y 0
f ( x, y )e
j 2 (( u M / 2 )x / M ( v N / 2 ) y / N )
x 0 y 0
M 1 N 1
f ( x, y )e
j 2 (( ux / M 1 / 2 x ) ( vy / N 1 / 2 y ))
x 0 y 0
always zero
MN
M 1 N 1
f ( x, y )( 1 )
x 0 y 0
x y
e j 2( ux / M vy / N )
Prepared By: Dr. Hasan Demirel, PhD
f ( x, y)e j 2 (u0 x / M v0 y / N ) F (u u0 , v v0 )
1
[ f ( x, y )e j 2 (u0 x / M v0 y / N ) ]
MN
1
MN
f ( x, y)e
M 1 N 1
j 2 ( u0 x / M v0 y / N )
j 2 ( ux / M vy / N )
x 0 y 0
M 1 N 1
f ( x, y )e j 2 ([ u u0 ] x / M [ v v0 ] y / N )
x 0 y 0
F (u u0 , v v0 )
Similarly, it can be shown that :
f ( x, y)(1) x y F (u M / 2, v N / 2)
f ( x M / 2, y N / 2) F (u, v)(1)u v
M 1 N 1
F (u, v)e j 2 (u ( x ) / M v ( y ) / N )
u 0 v 0
f ( x, y)
Which simply mirrors f(x,y) about the origin, thus producing the image on
the right
Prepared By: Dr. Hasan Demirel, PhD
four immediate neighbors of a point (x,y), but excludes the point itself.
(a) Find the equivalent filter H(u,v) in the frequency domain.
(b) Show that H(u,v) is a lowpass filter.
Where the H(u,v) is the filter function. We get the following transfer function:
four immediate neighbors of a point (x,y), but excludes the point itself.
(a) Find the equivalent filter H(u,v) in the frequency domain.
(b) Show that H(u,v) is a lowpass filter.
b) Consider one variable for convenience. As u ranges from 0 to M, the value of cos(2[u-M/2]/M)
starts at -1, peaks at 1 when u = M/2 (the center of the filter) and then decreases to -1 again when u = M.
Thus, we see that the amplitude of the filter decreases as a function of distance from the origin of the
centered filter, which is the characteristic of a lowpass filter.
A similar argument is easily carried out when considering both variables simultaneously.
Where
of the left corresponds to the original image, and the spectrum on the right was obtained after the
image was padded with zeros.
(a) Explain the difference of the overall contrast.
(b) Explain the significant increase in signal strength along the vertical and the horizontal axes of
the spectrum shown on the right.
(a) Padding with zero increases the size but reduces the average
gray level of image. The average gray level of the padded image is
less than the original image. F(0,0) in the padded image is less than
F(0,0) of the original image. All the others away from the origin are
less in the padded image than the original image. This produces a
narrower range of values hence a lower contrast spectrum in the
padded image.
(b) Padding with 0s introduces significant discontinuities at the borders of the original image. This
process introduces strong horizontal and vertical edges where the image ends abruptly and then continues
with o values. These sharp transitions correspond to the strength of the spectrum along the horizontal and
vertical axes.
Image Restoration
Restoration in the presence of Noise: Only-Spatial Filtering
Example 1-PR5.10: Given the two subimages below. The sub image on the
left is the result of using arithmetic mean filter of size 3x3. The other
subimage is the result of using the geometric mean filter of the same size.
a) Why the subimage obtained with geometric filtering is less blurred. Hint you
can start your analysis with 1-D step edge profile of the image.
b) Explain why the black components on the right image are thicker.
1
f ( x, y )
g ( s, t )
mn s ,tS xy
mn
f ( x, y ) g ( s, t )
s ,tS xy
Image Restoration
Restoration in the presence of Noise: Only-Spatial Filtering
Example 1-PR5.10 :
a) If we take a rough estimate of 1-D
Step function profile before the filtering:
Arithmetic mean filtering:
Before filtering:
6666006666
After filtering:
6664224666
f ( x, y ) 1
g ( s, t )
mn s ,tS xy
Before filtering:
6666006666
After filtering:
6660000666
f ( x, y )
g ( s, t )
s ,tS xy
1
mn
Image Restoration
Restoration in the presence of Noise: Only-Spatial Filtering
Example 1-PR5.10 :
a) The resulting 1-D profiles clearly indicates that the arithmetic mean filter
produces smoother/blurred transition and
b) The geometric filtering increases the thickness of the black components.
Arithmetic mean filtering:
Before filtering:
6666006666
After filtering:
6664224666
6666006666
After filtering:
6660000666