Highpass Spatial Filters-Digital Image Processing-Solution Manual, Exercises of Digital Image Processing

This solution manual is for problems related Digital Image processing course. This was recommended by Prof. Anwar Malik at Bengal Engineering and Science University. It includes: Expression, Spatial, Variables, Highpass, Filters, Lowpass, Transfer, Spatial, Fourier, Tansform

Typology: Exercises

2011/2012

Uploaded on 07/23/2012

ganpati
ganpati 🇮🇳

4.1

(30)

56 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
18 Chapter4Solutions(Students)
We nowmakeuseoftheidentity
e¡(2¼)2z2¾2
2e(2¼)2z2¾2
2=1:
Inserting thisidentityinthepreceding integralyields
h(z)=e¡(2¼)2z2¾2
2Z1
¡1
e¡1
2¾2[w2¡j4¼¾2wz¡(2¼)2¾4z2]dw
=e¡(2¼)2z2¾2
2Z1
¡1
e¡1
2¾2[w¡j2¼¾2z]2dw:
Nextwemakethe changeofvariabler=w¡j2¼¾2z.Then,dr=dwand the above
integralbecomes
h(z)== e¡(2¼)2z2¾2
2Z1
¡1
e¡r2
2¾2dr:
Finally,wemultiplyand dividetherightsideofthisequation by p2¼¾:
h(z)=p2¼¾e¡(2¼)2z2¾2
2·1
p2¼¾Z1
¡1
e¡r2
2¾2dr¸:
The expression insidethebracketsisrecognizedasaGaussian probability densityfunc-
tion,whoseintegralfrom¡1to1is1.Then,
h(z)=p2¼¾e¡(2¼)2z2¾2
2:
Going backtotwospatialvariablesgivesthe®nalresult:h(x;y)=p2¼¾e¡2¼2¾2(x2+y2):
Problem4.6
(a)We note®rst that(¡1)x+y=ej¼(x+y).Then,
=hf(x;y)ej¼(x+y)i=1
MN
M¡1
X
x=0
N¡1
X
y=0hf(x;y)ej¼(x+y)ie¡j2¼(ux=M+vy=N)
=1
MN
M¡1
X
x=0
N¡1
X
y=0hf(x;y)e¡j2¼(¡xM
2M¡yN
2N)i
e¡j2¼(ux=M+vy=N)
=1
MN
M¡1
X
x=0
N¡1
X
y=0
f(x;y)e¡j2¼(x[u¡M
2]=M+y[v¡N
2]=N)
=F(u¡M=2;v¡N=2):
Problem4.8
Withreference toEq.(4.4-1),all thehighpass ®ltersin discussedinSection 4.4can be
expresseda1minusthetransfer function oflowpass ®lter (whichweknowdo nothave
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Highpass Spatial Filters-Digital Image Processing-Solution Manual and more Exercises Digital Image Processing in PDF only on Docsity!

18 Chapter 4 Solutions (Students)

We now make use of the identity e¡^ (2¼)

(^2) z (^2) ¾ 2 (^2) e (2¼)

(^2) z (^2) ¾ 2 (^2) = 1:

Inserting this identity in the preceding integral yields h(z) = e¡^ (2¼)

(^2) z (^2) ¾ 2 2

Z 1

¡

e¡^21 ¾^2 [w^2 ¡j^4 ¼¾^2 wz¡(2¼)^2 ¾^4 z^2 ]dw

= e¡^ (2¼)

(^2) z (^2) ¾ 2 2

Z 1

¡

e¡^21 ¾^2 [w^ ¡^ j^2 ¼¾^2 z]

2 dw: Next we make the change of variable r = w ¡ j 2 ¼¾^2 z. Then, dr = dw and the above integral becomes h(z) == e¡^

(2¼)^22 z^2 ¾^2 Z^1 ¡

e¡^ 2 r¾^22 dr: Finally, we multiply and divide the right side of this equation by

p 2 ¼¾: h(z) =

p 2 ¼¾e¡^

(2¼)^22 z^2 ¾^2 ·^1 p 2 ¼¾

Z 1

¡

e¡^ r

2 2 ¾^2 dr

The expression inside the brackets is recognized as a Gaussian probability density func- tion, whose integral from ¡1 to 1 is 1. Then, h(z) =

p 2 ¼¾e¡^

(2¼)^22 z 2 ¾^2 : Going back to two spatial variables gives the Ænal result:h(x; y) =

p 2 ¼¾ e¡^2 ¼^2 ¾^2 (x^2 +y^2 ):

Problem 4.

(a) We note Ærst that (¡1)x+y^ = ej¼(x+y)^. Then,

=

h f(x; y)ej¼(x+y)

i = (^) MN^1

MX¡ 1

x=

NX¡ 1

y=

h f (x; y)ej¼(x+y)

i e¡j^2 ¼(ux=M^ +^ vy=N^ )

= MN^1

MX¡ 1

x=

NX¡ 1

y=

h f (x; y)e¡j^2 ¼(¡^ xM^2 M^ ¡^ yN^2 N^ )

i

e¡j^2 ¼(ux=M^ +^ vy=N^ )

= (^) MN^1

MX¡ 1

x=

NX¡ 1

y=

f(x; y)e¡j^2 ¼(x[u¡^ M^2 ]=M^ +y[v¡^ N^2 ]=N^ )

= F (u ¡ M= 2 ; v ¡ N=2):

Problem 4.

With reference to Eq. (4.4-1), all the highpass Ælters in discussed in Section 4.4 can be expressed a 1 minus the transfer function of lowpass Ælter (which we know do not have

Problem 4.11 19

an impulse at the origin). The inverse Fourier transform of 1 gives an impulse at the origin in the highpass spatial Ælters.

Problem 4.

Starting from Eq. (4.2-30), we easily Ænd the expression for the deÆnition of continuous convolution in one dimension: f (x) ¤ g(x) =

Z 1

¡

f (®)g(x ¡ ®)d®: The Fourier transform of this expression is = [f (x) ¤ g(x)] =

Z 1

¡

·Z 1

¡

f(®)g(x ¡ ®)d®

e¡j^2 ¼uxdx

=

Z 1

¡

f(®)

·Z 1

¡

g(x ¡ ®)e¡j^2 ¼uxdx

d®: The term inside the inner brackets is the Fourier transform of g(x ¡ ®). But, = [g(x ¡ ®)] = G(u)e¡j^2 ¼u® so = [f(x) ¤ g(x)] =

Z 1

¡

f (®)

G(u)e¡j^2 ¼u®

= G(u)

Z 1

¡

f (®)e¡j^2 ¼u®d® = G(u)F (u): This proves that multiplication in the frequency domain is equal to convolution in the spatial domain. The proof that multiplication in the spatial domain is equal to convolu- tion in the spatial domain is done in similar way.

Problem 4.

(a) One application of the Ælter gives: G(u; v) = H(u; v)F (u; v) = e¡D^2 (u;v)=^2 D^02 F (u; v): Similarly, K applications of the Ælter would give GK (u; v) = e¡KD^2 (u;v)=^2 D^20 F (u; v): The inverse DFT of GK (u; v) would give the image resulting from K passes of the Gaussian Ælter. If K is |large enough,} the Gaussian LPF will become a notch pass Ælter, passing only F (0; 0). We know that this term is equal to the average value of the image. So, there is a value of K after which the result of repeated lowpass Æltering

Problem 4.21 21

squares, square root, or absolute values must be computed directly in the spatial domain.

Problem 4.

Recall that the reason for padding is to establish a }buffer} between the periods that are implicit in the DFT. Imagine the image on the left being duplicated inÆnitely many times to cover the xy-plane. The result would be a checkerboard, with each square being in the checkerboard being the image (and the black extensions). Now imagine doing the same thing to the image on the right. The results would be indistinguishable. Thus, either form of padding accomplishes the same separation between images, as desired.

Problem 4.

(a) and (b) See Figs. P4.24(a) and (b).

Figures P4.24(a) and (b)

Problem 4.

Because M = 2n, we can write Eqs. (4.6-47) and (4.6-48) respectively as m(n) =^12 Mn and a(n) = Mn: Proof by induction begins by showing that both equations hold for n = 1: m(1) =^12 (2)(1) = 1 and a(1) = (2)(1) = 2:

22 Chapter 4 Solutions (Students)

We know these results to be correct from the discussion in Section 4.6.6. Next, we assume that the equations hold for n. Then, we are required to prove that they also are true for n + 1. From Eq. (4.6-45), m(n + 1) = 2m(n) + 2n: Substituting m(n) from above, m(n + 1) = 2

μ 1 2 Mn

  • 2n

= 2

μ 1 2 2

nn

  • 2n = 2 n(n + 1) = (^12)

2 n+

(n + 1): Therefore, Eq. (4.6-47) is valid for all n.

From Eq. (4.6-46), a(n + 1) = 2a(n) + 2n+1: Substituting the above expression for a(n) yields a(n + 1) = 2 Mn + 2n+ = 2(2nn) + 2n+ = 2 n+1(n + 1) which completes the proof.

24 Chapter 5 Solutions (Students)

Problem 5.

The solutions to (a), (b), and (c) are shown in Fig. P5.5, from left to right:

Figure P5.

Problem 5.

The solutions to (a), (b), and (c) are shown in Fig. P5.7, from left to right:

Figure P5.

Problem 5.

The solutions to (a), (b), and (c) are shown in Fig. P5.9, from left to right:

Problem 5.10 25

Figure P5.

Problem 5.

(a) The key to this problem is that the geometric mean is zero whenever any pixel is zero. Draw a proÆle of an ideal edge with a few points valued 0 and a few points valued

  1. The geometric mean will give only values of 0 and 1, whereas the arithmetic mean will give intermediate values (blur).

Problem 5.

A bandpass Ælter is obtained by subtracting the corresponding bandreject Ælter from 1: Hbp(u; v) = 1 ¡ Hbr(u; v): Then:

(a) Ideal bandpass Ælter:

HIbp(u; v) =

0 if D(u; v) < D 0 ¡ W 2 1 if D 0 ¡ W 2 · D(u; v) · D 0 + W 2 : 0 D(u; v) > D 0 + W 2

(b) Butterworth bandpass Ælter: HBbp(u; v) = 1 ¡ 1 1 +

h (^) D(u;v)W D^2 (u;v)¡D^20

i 2 n

h (^) D(u;v)W D^2 (u;v)¡D^20

i 2 n

h (^) D(u;v)W D^2 (u;v)¡D^20

i 2 n :

Problem 5.18 27

It is given that f (x; y) = ±(x ¡ a); so f (®; ¯) = ±(® ¡ a): Then, using the impulse response given in the problem statement,

g(x; y) =

ZZ 1

¡

±(® ¡ a)e¡[(x¡®)

(^2) +(y¡¯) (^2) ] d® d¯

=

ZZ 1

¡

±(® ¡ a)e¡[(x¡®)

2 ]

e¡[(y¡¯)

2 ]

d® d¯

=

Z 1

¡

±(® ¡ a)e¡[(x¡®)^2 ]^ d®

Z 1

¡

e¡[(y¡¯)^2 ]^ d¯

= e¡[(x¡a)

2 ] Z^1

¡

e¡[(y¡¯)

2 ]

d¯ where we used the fact that the integral of the impulse is nonzero only when ® = a: Next, we note that (^) Z 1 ¡

e¡[(y¡¯)

2 ]

d¯ =

Z 1

¡

e¡[(¯¡y)

2 ]

d¯ which is in the form of a constant times a Gaussian density with variance ¾^2 = 1= 2 or standard deviation ¾ = 1=

p

  1. In other words,

e¡[(¯¡y)^2 ] =

p 2 ¼(1=2)

p^1 2 ¼(1=2)

e

¡(1=2)

· (^) (¯¡y) 2 (1=2)

The integral from minus to plus inÆnity of the quantity inside the brackets is 1, so g(x; y) =

p ¼e¡[(x¡a)

2 ]

which is a blurred version of the original image.

Problem 5.

Following the procedure in Section 5.6.3,

H(u; v) =

Z T

0

e¡j^2 ¼ux^0 (t)dt

=

Z T

0

e¡j^2 ¼u[(1=2)at^2 ]dt

=

Z T

0

e¡j¼uat^2 dt

=

Z T

0

cos(¼uat^2 ) ¡ j sin(¼uat^2 )

dt

=

r T 2 2 ¼uaT 2

C(p¼uaT ) ¡ jS(p¼uaT )

where C(x) =

r 2 ¼ T

Z (^) x

0

cos t^2 dt

28 Chapter 5 Solutions (Students)

and S(x) =

r 2 ¼

Z (^) x

0

sin t^2 dt:

These are Fresnel cosine and sine integrals. They can be found, for example, the Hand- book of Mathematical Functions , by Abramowitz, or other similar reference.

Problem 5.

Measure the average value of the background. Set all pixels in the image, except the cross hairs, to that gray level. Denote the Fourier transform of this image by G(u; v). Since the characteristics of the cross hairs are given with a high degree of accuracy, we can construct an image of the background (of the same size) using the background gray levels determined previously. We then construct a model of the cross hairs in the correct location (determined from he given image) using the provided dimensions and gray level of the crosshairs. Denote by F (u; v) the Fourier transform of this new image

. The ratio G(u; v)=F (u; v) is an estimate of the blurring function H(u; v). In the likely event of vanishing values in F (u; v), we can construct a radially-limited Ælter using the method discussed in connection with Fig. 5.27. Because we know F (u; v) and G(u; v), and an estimate of H(u; v), we can also reÆne our estimate of the blurring function by substituting G and H in Eq. (5.8-3) and adjusting K to get as close as possible to a good result for F (u; v) [the result can be evaluated visually by taking the inverse Fourier transform]. The resulting Ælter in either case can then be used to deblur the image of the heart, if desired.

Problem 5.

This is a simple plugin problem. Its purpose is to gain familiarity with the various terms of the Wiener Ælter. From Eq. (5.8-3),

HW (u; v) =

H(u; v)

jH(u; v)j^2 jH(u; v)j^2 + K

where jH(u; v)j^2 = H¤(u; v)H(u; v) = 2 ¼¾^2 (u^2 + v^2 )^2 e¡^4 ¼^2 ¾^2 (x^2 +y^2 )^ : Then, HW (u; v) = ¡

" (^) p £^2 ¼¾(u^2 +^ v^2 )e¡^2 ¼^2 ¾^2 (x^2 +y^2 ) 2 ¼¾^2 (u^2 + v^2 )^2 e¡^4 ¼^2 ¾^2 (x^2 +y^2 )

+ K

6 Solutions (Students)

Problem 6.

Denote by c the given color, and let its coordinates be denoted by (x 0 ; y 0 ). The distance between c and c 1 is d(c; c 1 ) =

h (x 0 ¡ x 1 )^2 + (y 0 ¡ y 1 )^2

i 1 = 2 : Similarly the distance between c 1 and c 2 d(c 1 ; c 2 ) =

h (x 1 ¡ x 2 )^2 + (y 1 ¡ y 2 )^2

i 1 = 2 : The percentage p 1 of c 1 in c is p 1 = d(c^1 ; c d^2 (c)^ ¡^ d(c; c^1 ) 1 ; c 2 )^

The percentage p 2 of c 2 is simply p 2 = 100 ¡ p 1. In the preceding equation we see, for example, that when c = c 1 , then d(c; c 1 ) = 0 and it follows that p 1 = 100% and p 2 = 0%. Similarly, when d(c; c 1 ) = d(c 1 ; c 2 ); it follows that p 1 = 0% and p 2 = 100%. Values in between are easily seen to follow from these simple relations.

Problem 6.

Use color Ælters sharply tuned to the wavelengths of the colors of the three objects. Thus, with a speciÆc Ælter in place, only the objects whose color corresponds to that wavelength will produce a predominant response on the monochrome camera. A mo- torized Ælter wheel can be used to control Ælter position from a computer. If one of the colors is white, then the response of the three Ælters will be approximately equal and high. If one of the colors is black, the response of the three Ælters will be approximately equal and low.

Problem 6.

For the image given, the maximum intensity and saturation requirement means that the

32 Chapter 6 Solutions (Students)

RGB component values are 0 or 1. We can create the following table with 0 and 255 representing black and white, respectively: Table P6. Color R G B Mono R Mono G Mono B Black 0 0 0 0 0 0 Red 1 0 0 255 0 0 Yellow 1 1 0 255 255 0 Green 0 1 0 0 255 0 Cyan 0 1 1 0 255 255 Blue 0 0 1 0 0 255 Magenta 1 0 1 255 0 255 White 1 1 1 255 255 255

Gray 0.5 0.5 0.5 128 128 128

Thus, we get the monochrome displays shown in Fig. P6.6.

Figure P6.

Problem 6.

(a) All pixel values in the Red image are 255. In the Green image, the Ærst column is all 0zsu the second column all 1zsu and so on until the last column, which is composed of all 255zs. In the Blue image, the Ærst row is all 255zsu the second row all 254zs, and so on until the last row which is composed of all 0zs.

Problem 6.

Equation (6.2-1) reveals that each component of the CMY image is a function of a single component of the corresponding RGB imagexC is a function of R, M of G, and Y of B. For clarity, we will use a prime to denote the CMY components. From Eq. (6.5-6),