Chapter 2 Part 1-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: Retinal, Image, Diameter, Interpretation, Dot, Visible, Monochrome, Camera, Uniform, Color

Typology: Exercises

2011/2012
On special offer
30 Points
Discount

Limited-time offer


Uploaded on 07/23/2012

ganpati
ganpati 🇮🇳

4.1

(30)

56 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 2
Problem Solutions
Problem 2.1
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.017
which gives x=0.085d. 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.5 mm long. The size of each element and
each space is then s=[(1.5mm)/1,159]=1.3 ×106m. 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.085(d)<1.3 ×106m, or d<15.3 ×106m.
x/2
x
Image of the dot
on the fovea
Edge view of dot
d
d/2
0.2 m 0.017 m
Figure P2.1
3
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
Discount

On special offer

Partial preview of the text

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

Chapter 2

Problem Solutions

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 )

(x / 2 )

which gives x = 0.085d. 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.5 mm long. The size of each element and each space is then s = [(1.5mm) / 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.085(d ) < 1.3 × 10 −^6 m, or d < 15.3 × 10 −^6 m.

Image of the dot x x / on the fovea

Edge view of dot

d

d /

0.2 m 0.017 m Figure P2.

4 CHAPTER 2. PROBLEM SOLUTIONS

Problem 2.

The solution is

λ = c / v = 2.998 × 108 (m / s) / 60 ( 1 / s) = 4.997 × 106 m = 4997 Km.

Problem 2.

One possible solution is to equip a monochrome camera with a mechanical de- vice that sequentially places a red, a green and a blue pass filter 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 filter. The analysis then would be 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 field of view of the camera(s) is such that it is com- pletely filled 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 re- quired 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 56K baud link is ( 1024 )^2 × [ 8 + 2 ] / 56000 = 187.25 sec or about 3.1 min.

(b) At 3000K this time goes down to about 3.5 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 ); (b) S 1 and S 2 are 8-connected because q is in the set N 8 (p ); (c) S 1 and S 2 are m-connected because (i) q is in N (^) D (p ), and (ii) the set N 4 (p ) ∩ N 4 (q ) is empty.

6 CHAPTER 2. PROBLEM SOLUTIONS

Figure P.2.

Problem 2.

(a) When V = {0, 1}, 4-path does not exist between p and q because it is impos- sible to 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 condition; it is not possible to get to q. The shortest 8-path is shown in Fig. P2.15(b); its length is 4. The length of the shortest m - path (shown dashed) is 5. Both of these shortest paths are unique in this case.

Problem 2.

(a) A shortest 4-path between a point p with coordinates (x , y ) and a point q with coordinates (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 |x − s | and

y − t

, respectively. The total path length is |x − s |+

y − t

, which we recognize as the definition of the D 4 distance, as given in Eq. (2.5-2). (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 |x − s | +

y − t

. This occurs 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 making turns in at most two directions (e.g., right and up).

Problem 2.

With reference to Eq. (2.6-1), let H denote the sum operator, let S 1 and S 2 de- note 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.6.1. 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 in a given neighborhood. Then, H (aS 1 + bS 2 ) means: (1) mul- tiply the pixels in each of the subimage areas by the constants shown, (2) add

Figure P2.

the pixel-by-pixel values from aS 1 and bS 2 (which produces a single subimage area), and (3) compute the sum of the values of all the pixels in that single subim- age area. Let a p 1 and b p 2 denote two arbitrary (but corresponding) pixels from aS 1 + bS 2. Then we can write

H (aS 1 + bS 2 ) =

p 1 ∈S 1 and p 2 ∈S 2

a p 1 + b p 2

p 1 ∈S 1

a p 1 +

p 2 ∈S 2

b p 2

= a

p 1 ∈S 1

p 1 + b

p 2 ∈S 2

p 2

= a H (S 1 ) + b H (S 2 )

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

Problem 2.

From Eq. (2.6-5), at any point (x , y ),

g =

K

∑K

i = 1

g (^) i =

K

∑K

i = 1

f (^) i +

K

∑K

i = 1

η i.

Then

E {g } =

K

∑K

i = 1

E { f (^) i } +

K

∑K

i = 1

E { η i }.

But all the f (^) i are the same image, so E { f (^) i } = f. Also, it is given that the noise has zero mean, so E { η i } = 0. Thus, it follows that E {g } = f , which proves the validity of Eq. (2.6-6).

Figure P2.

comparing the differences between them makes no sense. Often, special mark- ings are manufactured into the product for mechanical or image-based align- ment Controlled illumination (note that “illumination” is not limited to visible light) obviously is important because changes in illumination can affect dramatically the values in a difference image. One approach used often in conjunction with illumination control is intensity scaling based on actual conditions. For exam- ple, the products could have one or more small patches of a tightly controlled color, and the intensity (and perhaps even color) of each pixels in the entire im- age would be modified based on the actual versus expected intensity and/or color of the patches in the image being processed. Finally, the noise content of a difference image needs to be low enough so that it does not materially affect comparisons between the golden and input im- ages. Good signal strength goes a long way toward reducing the effects of noise. Another (sometimes complementary) approach is to implement image process- ing techniques (e.g., image averaging) to reduce noise. Obviously there are a number if variations of the basic theme just described. For example, additional intelligence in the form of tests that are more sophisti- cated than pixel-by-pixel threshold comparisons can be implemented. A tech- nique used often in this regard is to subdivide the golden image into different regions and perform different (usually more than one) tests in each of the re- gions, based on expected region content.

Problem 2.

(a) The answer is shown in Fig. P2.23.

10 CHAPTER 2. PROBLEM SOLUTIONS

Problem 2.

From Eq. (2.6-27) and the definition of separable kernels,

T (u , v ) =

M∑ − 1

x = 0

N∑ − 1

y = 0

f (x , y )r (x , y , u , v )

M∑ − 1

x = 0

r 1 (x , u )

N∑ − 1

y = 0

f (x , y )r 2 (y , v )

M∑ − 1

x = 0

T (x , v )r 1 (x , u )

where T (x , v ) =

N∑ − 1

y = 0

f (x , y )r 2 (y , v ).

For a fixed value of x , this equation is recognized as the 1-D transform along one row of f (x , y ). By letting x vary from 0 to M − 1 we compute the entire array T (x , v ). Then, by substituting this array into the last line of the previous equa- tion we have the 1-D transform along the columns of T (x , v ). In other words, when a kernel is separable, we can compute the 1-D transform along the rows of the image. Then we compute the 1-D transform along the columns of this in- termediate result to obtain the final 2-D transform, T (u , v ). We obtain the same result by computing the 1-D transform along the columns of f (x , y ) followed by the 1-D transform along the rows of the intermediate result. This result plays an important role in Chapter 4 when we discuss the 2-D Fourier transform. From Eq. (2.6-33), the 2-D Fourier transform is given by

T (u , v ) =

M∑ − 1

x = 0

N∑ − 1

y = 0

f (x , y )e −j^2 π (u x^ / M^ +v y^ / N^ ).

It is easily verified that the Fourier transform kernel is separable (Problem 2.25), so we can write this equation as

T (u , v ) =

M∑ − 1

x = 0

N∑ − 1

y = 0

f (x , y )e −j^2 π (u x^ / M^ +v y^ / N^ )

M∑ − 1

x = 0

e −j^2 π (u x^ / M^ )

N∑ − 1

y = 0

f (x , y )e −j^2 π (v y^ / N^ )

M∑ − 1

x = 0

T (x , v )e −j^2 π (u x^ / M^ )

Chapter 3

Problem Solutions

Problem 3.

Let f denote the original image. First subtract the minimum value of f denoted f (^) min from f to yield a function whose minimum value is 0:

g 1 = f − f (^) min

Next divide g 1 by its maximum value to yield a function in the range [0, 1] and multiply the result by L − 1 to yield a function with values in the range [0, L − 1 ]

g =

L − 1

max

g 1

 (^) g 1

L − 1

max

f − f (^) min

f − f (^) min

Keep in mind that f (^) min is a scalar and f is an image.

Problem 3.

(a) s = T (r ) = (^1) +(m^1 / r )E.

Problem 3.

(a) The number of pixels having different intensity level values would decrease, thus causing the number of components in the histogram to decrease. Because the number of pixels would not change, this would cause the height of some of the remaining histogram peaks to increase in general. Typically, less variability in intensity level values will reduce contrast.

13

14 CHAPTER 3. PROBLEM SOLUTIONS

L - 1

2( L - 1)

0 L /4 L /2 3 /4 L L - 1

L - 1

( L - 1)/

L - 1

0 L /4 L /2 3 /4 L

Figure P3.9.

Problem 3.

All that histogram equalization does is remap histogram components on the in- tensity scale. To obtain a uniform (flat) histogram would require in general that pixel intensities actually be redistributed so that there are L groups of n / L pixels with the same intensity, where L is the number of allowed discrete intensity lev- els and n = M N is the total number of pixels in the input image. The histogram equalization method has no provisions for this type of (artificial) intensity redis- tribution process.

Problem 3.

We are interested in just one example in order to satisfy the statement of the problem. Consider the probability density function in Fig. P3.9(a). A plot of the transformation T (r ) in Eq. (3.3-4) using this particular density function is shown in Fig. P3.9(b). Because p (^) r (r ) is a probability density function we know from the discussion in Section 3.3.1 that the transformation T (r ) satisfies con-

16 CHAPTER 3. PROBLEM SOLUTIONS

Problem 3.

The purpose of this simple problem is to make the student think of the meaning of histograms and arrive at the conclusion that histograms carry no information about spatial properties of images. Thus, the only time that the histogram of the images formed by the operations shown in the problem statement can be de- termined in terms of the original histograms is when one (both) of the images is (are) constant. In (d) we have the additional requirement that none of the pixels of g (x , y ) can be 0. Assume for convenience that the histograms are not normalized, so that, for example, h (^) f (r (^) k ) is the number of pixels in f (x , y ) having intensity level r (^) k. Assume also that all the pixels in g (x , y ) have constant value c. The pixels of both images are assumed to be positive. Finally, let u (^) k denote the intensity levels of the pixels of the images formed by any of the arithmetic oper- ations given in the problem statement. Under the preceding set of conditions, the histograms are determined as follows: (a) We obtain the histogram hsum(u^ k )^ of the sum by letting^ u^ k =^ r^ k +^ c^ , and also hsum(u (^) k ) = h (^) f (r (^) k ) for all k. In other words, the values (height) of the compo- nents of hsum are the same as the components of h (^) f , but their locations on the intensity axis are shifted right by an amount c.

Problem 3.

(a) Consider a 3 × 3 mask first. Because all the coefficients are 1 (we are ignoring the 1/9 scale factor), the net effect of the lowpass filter operation is to add all the intensity values 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 first 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-filter 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 ) arithmetic operations after each move. A brute-force implementation would require n^2 − 1 additions after each move.

Problem 3.

(a) The key to solving this problem is to recognize (1) that the convolution re- sult at any location (x , y ) consists of centering the mask at that point and then forming the sum of the products of the mask coefficients with the corresponding pixels in the image; and (2) that convolution of the mask with the entire image results in every pixel in the image being visited only once by every element of the mask (i.e., every pixel is multiplied once by every coefficient of the mask). Because the coefficients of the mask sum to zero, this means that the sum of the products of the coefficients with the same pixel also sum to zero. Carrying out this argument for every pixel in the image leads to the conclusion that the sum of the elements of the convolution array also sum to zero.

Problem 3.

(a) There are n^2 points in an n × n median filter mask. Because 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 ζ. How- ever, because 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 encom- passed by the filter 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.

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