Ece 565 HW 2 PDF
Ece 565 HW 2 PDF
ANS: Let f denote the input function. Subtracting the minimum value f min from the input
function to get the value of function whose minimum is less than 0
g 1 = f − f min
Divide the value of g with the maximum value and multiply the function with [L − 1] to get the
values ranging from [0, L − 1] .
g1
g = [L − 1] max(g1)
[L−1]
g = f − f min f − f min
This is the intensity transformation function.
Ans: By setting the lower order bit plane of the input image to zero the number of pixels
having different intensity levels would decrease thus some of the histogram peaks will
increase. This will reduce the contrast of the image.
(b). What would be the effect on the histogram if we set zero the higher-order bit
planes instead?
Ans: By setting the higher order bit of the image planes to zero the histogram will
become more narrower than wider reducing the brightness of the image (or) darkening
the image, thus all the pixel intensity values are set below 127 making the histogram
narrower and taller.
3. Show that the 2-D Laplacian operator is isotropic (invariant to rotation). You will need
the following equations relating coordinates for axis rotation by an angle 𝜃:
𝑥=𝑥′𝑐𝑜𝑠𝜃−𝑦′𝑠𝑖𝑛𝜃
𝑦=𝑥′𝑠𝑖𝑛𝜃+𝑦′𝑐𝑜𝑠𝜃
f f
= x cos + y sin
Partial derivative w.r.t x′
2 2 2
f f f f f
x′ 2 = x2
cos2 + x ( y )sincos + y ( x )sincos + y2
sin2
Similarly,
f f x f y
y′ = x y′ + y′ y′
f f
=− x sin + y cos
Taking second derivative,
2 2 2
f f f f f
y′ 2 = x2
sin2 − x ( y )sincos − y ( x )sincos + y2
cos2
Adding both the derivatives we get the following,
2 2 2 2
f f f f
x′ 2 + y2 = 2 + y2
′ x
This proves that the laplacian operator is independent of the rotation dynamics.
4. An image with intensities in the range [0, 1] has the PDF 𝑝𝑟(𝑟) shown below. It is
desired to transform the intensity levels of this images so that they will have the
specified PDF 𝑝𝑧(𝑧) shown. Assume continuous quantities and find the transformation
in terms of 𝑟 and 𝑧 that will accomplish this.
Ans: An image with intensities in the range of [0,1] has Probability Density function
(PDF) p r (r) and the required PDF after transformation be pz (z) .
We know that histogram equalization for an image is given by
r r
s = T (r) ∫ p r (w) dw = ∫(− 2w + 2)dw = − r2 + 2r
0 0
Also ,
z z
v = G(z) = ∫ P z (w) dw = ∫ 2wdw = z 2
0 0
This means that z = G−1 (v) = ± √v
Here v has both positive and negative intensity levels but since we are performing
equalization, only positive intensity levels are allowed so we take the value of z = √v
and plugging in the value of v as − r2 + 2r , we get
z = √− r2 + 2r
5. Obtain the unnormalized and the normalized histograms of the following 8-bit 𝑀×𝑁
image. Show the histogram in a table labeling clearly the values of each histogram
component in terms of 𝑀 and 𝑁.
Ans: Given that the image has MxN pixels, therefore the total number of pixels is M N .
there are 4 divisions on the width axis and 3 divisions on the height axis i.e. M has 3
divisions and N has 4 divisions. So the number of pixels in a localized square is
( M3 )( N4 ) = MN
12 . Therefor, the number of pixels having each intensity value can
be calculated using this for an unnormalized histogram
Pixels with value 127 = M12N
Pixels with values 16 = M6N
Similarly to find the normalized values of histogram we just have to divide the
unnormalized value by MN.
And so on, the calculated normalized and unnormalized values are given below in a table
6. Show that the Fourier transform and its inverse are linear processes.
Ans: To prove that the fourier transform and the inverse fourier is linear, as per linearity
property
[a1 f 1 (x, y ) + a2 f 2 (x, y )] = a1 [f 1 (x, y )] + a2 [f 2 (x, y )]
Here a and b are arbitrary constants.
From definition of the 2D fourier
M −1 N −1
1
[a1 f 1 (x, y ) + a2 f 2 (x, y )] = MN
∑ ∑ [a1 f 1 (x, y ) + a2 f 2 (x, y )] e−j2π((ux/m)+(vy/m))
0 0
Where M,N is the image pixels MxN.
M −1 N −1 M −1 N −1
1
= MN
∑ ∑ [a1 f 1 (x, y )]e−j2π((ux/m)+(vy/m)) + 1
MN
∑ ∑ [a2 f 2 (x, y )] e−j2π((ux/m)+(vy/m))
0 0 0 0
= a1 [f 1 (x, y )] + a2 [f 2 (x, y )]
7. Prove the validity of the convolution theorem for 1-D signals. That is,
()∗()↔()()
8. Show the validity of the following translation properties of 2-D discrete Fourier
transform pairs.
a. (, )2(0 /+0 /) ↔(−0 , −0 )
b. ( − x0 , − y 0 )↔(, )2(x0 u/+y0 v/)
Ans: consider the input function f (x, y ) and it is translated by x0 and
y0
f (x, y ) → f (x − x0 , y − y 0 )
Taking fourier transform
j2π
1 ∑ ∑ f (x − x0 , y − y 0 )e N (u(x−x0 )+v(y−y0 ))
(u, v ) = N
−j2π
(u, v ) = F (u, v ).e N (ux0 +vy 0 )
−2(0+0)
a. (−0 , −0 )↔
2πu0 x 2πv 0 y MN
b. cos( M + N ) ⇔ 2 [δ(u + u0 , v + v 0 ) − (δ(u − u0 , v − v 0 )]
Ans: we know that the fourier transform of a impulse function f (u, v) in the frequency
domain is;
F (u, v ) = δ (u − u0 , v − v 0 )
Its inverse transform is
∞ ∞
f (x, y ) = ∫ ∫ δ(u − u0 , v − v0 )ej2π(ux+vy) dxdy
−∞ −∞
u x v y
Now instead of f (x, y ) we put cos(2π( M0 + N0 )) , taking fourier transform we get the
following result for the fourier transform pair:
u x v0 y 1
{cos(2π( M0 + N ))} = 2 [(M N )[δ(u + u0 , v + v 0 ) − δ (u − u0 , v − v 0 )]]
Similarly the inverse is also true because of the linearity and shifting property, hence the
fourier transform pair is proven;
u x v0 y MN
{cos(2π( M0 + N ))} ⇔ 2 [δ(u + u0 , v + v 0 ) − δ (u − u0 , v − v 0 )]
10. Consider a 3×3 spatial filter that averages the four closest neighbors of a point (𝑥,𝑦) but
excludes the point itself from the average. Find the equivalent filter in the frequency domain.
Ans: given that the 3 x 3 filter averages the four closest neighbours alone, therefore the points
will be like (x+1,y),(x,y+1),(x-1,y),(x,y-1). Therefore the spatial average is given by,
1
g (x, y ) = 4 [f (x, y + 1) + f (x + 1, y ) + f (x − 1, y ) + f (x, y − 1)]
−j2π(ux0 /m +vy 0 /N )
By using the following property f (x − x0 , y − y 0 ) ⇔ F (u, v )e we get the
following answer after taking fourier transform on both sides,
= H(u, v )F (u, v )
Here H (u, v ) is the filter’s transfer function and the function after simplification is given by,
1
H (u, v ) = 4 [cos(2πu/M ) + cos(2πv/N )]
This filter can be represented as follows in the frequency domain;
H (u, v ) = 12 [cos(2π(u − M /2)/M ) + cos(2π(v − N /2)/N )]