Chapter 2 Part 2-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: Diagonal, Segment, Retinal, Image, Diameter, Interpretation, Dot, Visible, Monochrome

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
2Solutions(Students)
Problem2.1
Thediameter,x,oftheretinal image corresponding tothedot isobtainedfromsimilar
triangles,as showninFig.P2.1.That is,
(d=2)
0:2=(x=2)
0:014
which givesx=0:07d.From thediscussion inSection 2.1.1,and taking someliberties
ofinterpretation,we canthinkofthefovea asasquaresensorarrayhaving on theorderof
337,000 elements,whichtranslatesintoanarray ofsize 580 £580 elements.Assuming
equalspacing betweenelements,thisgives580 elementsand 579 spaceson aline1.5
mm long.Thesize ofeachelementand eachspace isthens= [(1:5mm)=1;159] =
1:3£10¡6m.If thesize (on thefovea)oftheimaged dot isless thanthesize ofasingle
resolution element,we assumethat thedotwill beinvisibletothe eye.In otherwords,
the eyewill notdetectadot ifitsdiameter,d,is suchthat0:07(d)<1:3£10¡6m,or
d<18:6£10¡6m.
Figure P2.1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Chapter 2 Part 2-Digital Image Processing-Solution Manual and more Exercises Digital Image Processing in PDF only on Docsity!

2 Solutions (Students)

Problem 2.

The diameter, x, of the retinal image corresponding to the dot is obtained from similar triangles, as shown in Fig. P2.1. That is, (d=2) 0 : 2 =

(x=2) 0 : 014 which gives x = 0: 07 d. From the discussion in Section 2.1.1, and taking some liberties of interpretation, we can think of the fovea as a square sensor array having on the order of 337,000 elements, which translates into an array of size 580 £ 580 elements. Assuming equal spacing between elements, this gives 580 elements and 579 spaces on a line 1. mm long. The size of each element and each space is then s = [(1: 5 mm)= 1 ; 159] = 1 : 3 £ 10 ¡^6 m. If the size (on the fovea) of the imaged dot is less than the size of a single resolution element, we assume that the dot will be invisible to the eye. In other words, the eye will not detect a dot if its diameter, d, is such that 0 :07(d) < 1 : 3 £ 10 ¡^6 m, or d < 18 : 6 £ 10 ¡^6 m.

Figure P2.

4 Chapter 2 Solutions (Students)

Problem 2.

¸ = c=v = 2: 998 £ 108 (m/s)= 60 (1/s) = 4: 99 £ 106 m = 5000 Km.

Problem 2.

One possible solution is to equip a monochrome camera with a mechanical device that sequentially places a red, a green, and a blue pass Ælter in front of the lens. The strongest camera response determines the color. If all three responses are approximately equal, the object is white. A faster system would utilize three different cameras, each equipped with an individual Ælter. The analysis would be then based on polling the response of each camera. This system would be a little more expensive, but it would be faster and more reliable. Note that both solutions assume that the Æeld of view of the camera(s) is such that it is completely Ælled by a uniform color [i.e., the camera(s) is(are) focused on a part of the vehicle where only its color is seen. Otherwise further analysis would be required to isolate the region of uniform color, which is all that is of interest in solving this problem].

Problem 2.

(a) The total amount of data (including the start and stop bit) in an 8-bit, 1024 £ 1024 image, is (1024)^2 £ [8 + 2] bits. The total time required to transmit this image over a At 56K baud link is (1024)^2 £ [8 + 2]=56000 = 187: 25 sec or about 3.1 min. (b) At 750K this time goes down to about 14 sec.

Problem 2.

Let p and q be as shown in Fig. P2.11. Then, (a) S 1 and S 2 are not 4-connected because q is not in the set N 4 (p)u (b) S 1 and S 2 are 8-connected because q is in the set N 8 (p)u (c) S 1 and S 2 are m -connected because (i) q is in ND(p), and (ii) the set N 4 (p) \ N 4 (q) is empty.

6 Chapter 2 Solutions (Students)

get from p to q by traveling along points that are both 4-adjacent and also have values from V. Figure P2.15(a) shows this conditionuit is not possible to get to q. The shortest 8-path is shown in Fig. P2.15(b)uits length is 4. The length of shortest m- path (shown dashed) is 5. Both of these shortest paths are unique in this case. (b) One possibility for the shortest 4-path when V = f 1 ; 2 g is shown in Fig. P2.15(c)uits length is 6. It is easily veri®ed that another 4-path of the same length exists between p and q. One possibility for the shortest 8-path (it is not unique) is shown in Fig. P2.15(d)uits length is 4. The length of a shortest m-path (shoen dashed) is 6. This path is not unique.

Figure P2.

Problem 2.

(a) A shortest 4-path between a point p with coordinates (x; y) and a point q with coor- dinates (s; t) is shown in Fig. P2.16, where the assumption is that all points along the path are from V. The length of the segments of the path are jx ¡ sj and jy ¡ tj, respec- tively. The total path length is jx ¡ sj + jy ¡ tj, which we recognize as the de®nition of the D 4 distance, as given in Eq. (2.5-16). (Recall that this distance is independent of any paths that may exist between the points.) The D 4 distance obviously is equal to the length of the shortest 4-path when the length of the path is jx ¡ sj + jy ¡ tj. This oc- curs whenever we can get from p to q by following a path whose elements (1) are from V; and (2) are arranged in such a way that we can traverse the path from p to q by mak- ing turns in at most two directions (e.g., right and up). (b) The path may of may not be unique, depending on V and the values of the points along the way.

Problem 2.18 7

Figure P2.

Problem 2.

With reference to Eq. (2.6-1), let H denote the neighborhood sum operator, let S 1 and S 2 denote two different small subimage areas of the same size, and let S 1 +S 2 denote the corresponding pixel-by-pixel sum of the elements in S 1 and S 2 , as explained in Section 2.5.4. Note that the size of the neighborhood (i.e., number of pixels) is not changed by this pixel-by-pixel sum. The operator H computes the sum of pixel values is a given neighborhood. Then, H(aS 1 + bS 2 ) means: (1) multiplying the pixels in each of the subimage areas by the constants shown, (2) adding the pixel-by-pixel values from S 1 and S 2 (which produces a single subimage area), and (3) computing the sum of the values of all the pixels in that single subimage area. Let ap 1 and bp 2 denote two arbitrary (but corresponding ) pixels from aS 1 + bS 2. Then we can write H(aS 1 + bS 2 ) =

X

p 1 2 S 1 and p 22 S 2

ap 1 + bp 2

=

X

p 1 2 S 1

ap 1 +

X

p 22 S 2

bp 2

= a

X

p 1 2 S 1

p 1 + b

X

p 2 2 S 2

p 2

= aH(S 1 ) + bH(S 2 )

which, according to Eq. (2.6-1), indicates that H is a linear operator.

10 Chapter 3 Solutions (Students)

in Section 3.3.1 that the transformation T (r) satisÆes conditions (a) and (b) stated in that section. However, we see from Fig. P3.8(b) that the inverse transformation from s back to r is not single valued, as there are an inÆnite number of possible mappings from s = 1= 2 back to r. It is important to note that the reason the inverse transformation function turned out not to be single valued is the gap in pr (r) in the interval [1= 4 ; 3 =4].

Figure P3.8.

Problem 3.

(c) If none of the gray levels rk; k = 1; 2 ; : : : ; L ¡ 1 ; are 0, then T (rk) will be strictly monotonic. This implies that the inverse transformation will be of Ænite slope and this will be single-valued.

Problem 3.

The value of the histogram component corresponding to the k th intensity level in a neigh- borhood is pr (rk ) = n nk

Problem 3.14 11

for k = 1; 2 ; : : : ; K ¡ 1 ;where nk is the number of pixels having gray level value rk, n is the total number of pixels in the neighborhood, and K is the total number of possible gray levels. Suppose that the neighborhood is moved one pixel to the right. This deletes the leftmost column and introduces a new column on the right. The updated histogram then becomes p^0 r (rk) = n^1 [nk ¡ nLk + nRk ]

for k = 0; 1 ; : : : ; K ¡ 1 , where nLk is the number of occurrences of level rk on the left column and nRk is the similar quantity on the right column. The preceding equation can be written also as p^0 r(rk) = pr(rk ) + n^1 [nRk ¡ nLk ]

for k = 0; 1 ; : : : ; K ¡ 1 : The same concept applies to other modes of neighborhood motion: p^0 r(rk) = pr(rk) + n^1 [bk ¡ ak ]

for k = 0; 1 ; : : : ; K ¡ 1 , where ak is the number of pixels with value rk in the neighbor- hood area deleted by the move, and bk is the corresponding number introduced by the move.

¾^2 g = ¾^2 f + (^) K^12 [¾^2 ´ 1 + ¾^2 ´ 2 + ¢ ¢ ¢ + ¾^2 ´K ]

The Ærst term on the right side is 0 because the elements of f are constants. The various ¾^2 ´i are simply samples of the noise, which is has variance ¾^2 ´. Thus, ¾^2 ´i = ¾^2 ´ and we have ¾^2 g = (^) KK 2 ¾^2 ´ = (^) K^1 ¾^2 ´

which proves the validity of Eq. (3.4-5).

Problem 3.

Let g(x; y) denote the golden image, and let f (x; y) denote any input image acquired during routine operation of the system. Change detection via subtraction is based on computing the simple difference d(x; y) = g(x; y) ¡ f (x; y). The resulting image d(x; y) can be used in two fundamental ways for change detection. One way is use a pixel-by-pixel analysis. In this case we say that f (x; y) is }close enough} to the golden image if all the pixels in d(x; y) fall within a speciÆed threshold band [Tmin; Tmax] where Tmin is negative and Tmax is positive. Usually, the same value of threshold is

Problem 3.19 13

scale factor), the net effect of the lowpass Ælter operation is to add all the gray levels of pixels under the mask. Initially, it takes 8 additions to produce the response of the mask. However, when the mask moves one pixel location to the right, it picks up only one new column. The new response can be computed as Rnew = Rold ¡ C 1 + C 3 where C 1 is the sum of pixels under the Ærst column of the mask before it was moved, and C 3 is the similar sum in the column it picked up after it moved. This is the basic box-Ælter or moving-average equation. For a 3 £ 3 mask it takes 2 additions to get C 3 (C 1 was already computed). To this we add one subtraction and one addition to get Rnew. Thus, a total of 4 arithmetic operations are needed to update the response after one move. This is a recursive procedure for moving from left to right along one row of the image. When we get to the end of a row, we move down one pixel (the nature of the computation is the same) and continue the scan in the opposite direction.

For a mask of size n £ n, (n ¡ 1) additions are needed to obtain C 3 , plus the single subtraction and addition needed to obtain Rnew, which gives a total of (n + 1) arith- metic operations after each move. A brute-force implementation would require n^2 ¡ 1 additions after each move.

Problem 3.

(a) There are n^2 points in an n £ n median Ælter mask. Since n is odd, the median value, ³, is such that there are (n^2 ¡ 1)= 2 points with values less than or equal to ³ and the same number with values greater than or equal to ³. However, since the area A (number of points) in the cluster is less than one half n^2 , and A and n are integers, it follows that A is always less than or equal to (n^2 ¡ 1)= 2. Thus, even in the extreme case when all cluster points are encompassed by the Ælter mask, there are not enough points in the cluster for any of them to be equal to the value of the median (remember, we are assuming that all cluster points are lighter or darker than the background points). Therefore, if the center point in the mask is a cluster point, it will be set to the median value, which is a background shade, and thus it will be |eliminated} from the cluster. This conclusion obviously applies to the less extreme case when the number of cluster points encompassed by the mask is less than the maximum size of the cluster.

14 Chapter 3 Solutions (Students)

Problem 3.

(a) Numerically sort the n^2 values. The median is ³ = [(n^2 + 1)=2]-th largest value.

(b) Once the values have been sorted one time, we simply delete the values in the trailing edge of the neighborhood and insert the values in the leading edge in the appropriate locations in the sorted array.

Problem 3.

From Fig. 3.35, the vertical bars are 5 pixels wide, 100 pixels high, and their separation is 20 pixels. The phenomenon in question is related to the horizontal separation between bars, so we can simplify the problem by considering a single scan line through the bars in the image. The key to answering this question lies in the fact that the distance (in pixels) between the onset of one bar and the onset of the next one (say, to its right) is 25 pixels. Consider the scan line shown in Fig. P3.22. Also shown is a cross section of a 25 £ 25 mask. The response of the mask is the average of the pixels that it encompasses. We note that when the mask moves one pixel to the right, it loses on value of the vertical bar on the left, but it picks up an identical one on the right, so the response doesnzt change. In fact, the number of pixels belonging to the vertical bars and contained within the mask does not change, regardless of where the mask is located (as long as it is contained within the bars, and not near the edges of the set of bars). The fact that the number of bar pixels under the mask does not change is due to the peculiar separation between bars and the width of the lines in relation to the 25-pixel width of the mask This constant response is the reason no white gaps is seen in the image shown in the problem statement. Note that this constant response does not happen with the 23 £ 23 or the 45 £ 45 masks because they are not }synchronized} with the width of the bars and their separation.

Figure P3.

16 Chapter 3 Solutions (Students)

f(x; y) ¡ r^2 f (x; y) = f (x; y) ¡ [f (x + 1; y) + f (x ¡ 1 ; y) + f (x; y + 1) +f (x; y ¡ 1) ¡ 4 f (x; y)] = 6 f (x; y) ¡ [f (x + 1; y) + f(x ¡ 1 ; y) + f (x; y + 1) +f (x; y ¡ 1) + f (x; y)] = 5 f 1 : 2 f(x; y)¡ 1 5 [f^ (x^ + 1; y) +^ f(x^ ¡^1 ; y) +^ f^ (x; y^ + 1) +f (x; y ¡ 1) + f(x; y)]g = 5

1 : 2 f (x; y) ¡ f (x; y)

where f (x; y) denotes the average of f (x; y) in a predeÆned neighborhood that is cen- tered at (x; y) and includes the center pixel and its four immediate neighbors. Treating the constants in the last line of the above equation as proportionality factors, we may write f (x; y) ¡ r^2 f (x; y) s f(x; y) ¡ f (x; y): The right side of this equation is recognized as the deÆnition of unsharp masking given in Eq. (3.7-7). Thus, it has been demonstrated that subtracting the Laplacian from an image is proportional to unsharp masking.

4 Solutions (Students)

Problem 4.

By direct substitution of f (x) [Eq. (4.2-6)] into F (u) [Eq. (4.2-5)]:

F (u) = (^) M^1

MX ¡ 1

x=

"MX ¡ 1

r=

F (r)ej^2 ¼rx=M

e¡j^2 ¼ux=M

= M^1

MX ¡ 1

r=

F (r)

MX ¡ 1

x=

ej^2 ¼rx=M^ e¡j^2 ¼ux=M

= (^) M^1 F (u) [M] = F (u) where the third step follows from the orthogonality condition given in the problem state- ment. Substitution of F (u) into f (x) is handled in a similar manner.

Problem 4.

An important aspect of this problem is to recognize that the quantity (u^2 + v^2 ) can be replaced by the distance squared, D^2 (u; v). This reduces the problem to one vari- able, which is notationally easier to manage. Rather than carry an award capital letter throughout the development, we deÆne w^2 , D^2 (u; v) = (u^2 + v^2 ). Then we proceed as follows: H(w) = e¡w^2 =^2 ¾^2 : The inverse Fourier transform is h(z) =

Z 1

¡

H(w)ej^2 ¼wz^ dw

=

Z 1

¡

e¡w^2 =^2 ¾^2 ej^2 ¼wz^ dw

=

Z 1

¡

e¡^2 ¾^12 [w

(^2) ¡j 4 ¼¾ (^2) wz] dw: