Chapter 3 problems
Chapter 3 problems
Problems
Solutions to the problems marked with an asterisk (*) are in the DIP4E Student Support Package (consult the book
website: www.ImageProcessingPlace.com).
3.1 Give a single intensity transformation function cant bit plane (see Fig. 3.13). (Hint: Use an
for spreading the intensities of an image so the 8-bit truth table to determine the form of
lowest intensity is 0 and the highest is L − 1. each transformation function.)
3.2 Do the following: (b) How many intensity transformation functions
would there be for 16-bit images?
(a) * Give a continuous function for implement-
ing the contrast stretching transformation in (c) Is the basic approach in (a) limited to images
Fig. 3.2(a). In addition to m, your function in which the number of intensity levels is an
must include a parameter, E, for control- integer power of 2, or is the method general
ling the slope of the function as it transi- for any number of integer intensity levels?
tions from low to high intensity values. Your (d) If the method is general, how would it be dif-
function should be normalized so that its ferent from your solution in (a)?
minimum and maximum values are 0 and 1, 3.4 Do the following:
respectively.
(a) Propose a method for extracting the bit planes
(b) Sketch a family of transformations as a
of an image based on converting the value of
function of parameter E, for a fixed value
its pixels to binary.
m = L 2, where L is the number of intensity
levels in the image.. (b) Find all the bit planes of the following 4-bit
image:
3.3 Do the following:
0 1 8 6
(a) * Propose a set of intensity-slicing transforma- 2 2 1 1
tion functions capable of producing all the 1 15 14 12
individual bit planes of an 8-bit monochrome
3 6 9 10
image. For example, applying to an image a
transformation function with the property 3.5 In general:
T (r ) = 0 if r is 0 or even, and T (r ) = 1 if r is
odd, produces an image of the least signifi- (a) * What effect would setting to zero the lower-
www.EBooksWorld.ir
order bit planes have on the histogram of an (a) * Find the transformation function that will
image? map the input intensity values, r, into values,
(b) What would be the effect on the histogram s, of a histogram-equalized image.
if we set to zero the higher-order bit planes (b) * Find the transformation function that (when
instead? applied to the histogram-equalized intensi-
3.6 Explain why the discrete histogram equalization ties, s) will produce an image whose intensity
technique does not yield a flat histogram in gen- PDF is pz (z) = 3z2 (L − 1)3 for 0 ≤ z ≤ L − 1
eral. and pz (z) = 0 for other values of z.
3.7 Suppose that a digital image is subjected to histo- (c) Express the transformation function from (b)
gram equalization. Show that a second pass of his- directly in terms of r, the intensities of the
togram equalization (on the histogram-equalized input image.
image) will produce exactly the same result as the 3.12 An image with intensities in the range [0, 1] has
first pass. the PDF, pr (r ), shown in the following figure. It
3.8 Assuming continuous values, show by an exam- is desired to transform the intensity levels of this
ple that it is possible to have a case in which the image so that they will have the specified pz (z)
transformation function given in Eq. (3-11) satis- shown in the figure. Assume continuous quantities,
fies conditions (a) and (b) discussed in Section 3.3, and find the transformation (expressed in terms
but its inverse may fail condition (a). of r and z) that will accomplish this.
3.9 Do the following: pr (r) pz (z)
www.EBooksWorld.ir
www.EBooksWorld.ir
3.26 The two images shown in the following figure are cients sum to 0. Show that the sum of the pixel
quite different, but their histograms are the same. values in the filtered image also is 0.
Suppose that each image is blurred using a 3 × 3 3.33 A single point of light can be modeled by a digital
box kernel.
image consisting of all 0’s, with a 1 in the location
(a) * Would the histograms of the blurred images of the point of light. If you view a single point of
still be equal? Explain. light through a defocused lens, it will appear as a
fuzzy blob whose size depends on the amount by
which the lens is defocused. We mentioned in Sec-
tion 3.5 that filtering an image with a box kernel
is a poor model for a defocused lens, and that a
better approximation is obtained with a Gauss-
ian kernel. Using the single-point-of-light analogy,
explain why this is so.
(b) If your answer is no, either sketch the two 3.34 In the original image used to generate the three
histograms or give two tables detailing the blurred images shown, the vertical bars are 5 pix-
histogram components. els wide, 100 pixels high, and their separation is
3.27 An image is filtered four times using a Gaussian 20 pixels. The image was blurred using square box
kernel of size 3 × 3 with a standard deviation of kernels of sizes 23, 25, and 45 elements on the side,
1.0. Because of the associative property of con- respectively. The vertical bars on the left, lower
volution, we know that equivalent results can be part of (a) and (c) are blurred, but a clear separa-
obtained using a single Gaussian kernel formed tion exists between them.
by convolving the individual kernels.
(a) * What is the size of the single Gaussian ker-
nel?
(b) What is its standard deviation?
3.28 An image is filtered with three Gaussian lowpass
kernels of sizes 3 × 3, 5 × 5, and 7 × 7, and stan-
dard deviations 1.5, 2, and 4, respectively. A com-
posite filter, w, is formed as the convolution of
(a) (b)
these three filters.
(a) * Is the resulting filter Gaussian? Explain.
(b) What is its standard deviation?
(c) What is its size?
3.29 * Discuss the limiting effect of repeatedly filtering
an image with a 3 × 3 lowpass filter kernel. You
may ignore border effects. (c)
3.30 In Fig. 3.42(b) the corners of the estimated shad-
ing pattern appear darker or lighter than their However, the bars have merged in image (b), de-
surrounding areas. Explain the reason for this. spite the fact that the kernel used to generate this
image is much smaller than the kernel that pro-
3.31 * An image is filtered with a kernel whose coeffi- duced image (c). Explain the reason for this.
cients sum to 1. Show that the sum of the pixel
values in the original and filtered images is the 3.35 Consider an application such as in Fig. 3.41, in
same. which it is desired to eliminate objects smaller
than those enclosed by a square of size q × q pix-
3.32 An image is filtered with a kernel whose coeffi- els. Suppose that we want to reduce the average
www.EBooksWorld.ir
intensity of those objects to one-tenth of their in the center yields sharper results than the one
original average value. In this way, their intensity with a −4 in the center. Explain the reason why.
will be closer to the intensity of the background
3.41 * Give a 3 × 3 kernel for performing unsharp mask-
and they can be eliminated by thresholding. Give
ing in a single pass through an image. Assume that
the (odd) size of the smallest box kernel that will
the average image is obtained using a box filter of
yield the desired reduction in average intensity in size 3 × 3.
only one pass of the kernel over the image.
3.42 Show that subtracting the Laplacian from an im-
3.36 With reference to order-statistic filters (see Sec-
age gives a result that is proportional to the un-
tion 3.5):
sharp mask in Eq. (3-55). Use the definition for
(a) * We mentioned that isolated clusters of dark the Laplacian given in Eq. (3-53).
or light (with respect to the background) pix-
els whose area is less than one-half the area 3.43 Do the following:
of a median filter are forced to the median (a) * Show that the magnitude of the gradient giv-
value of the neighbors by the filter. Assume en in Eq. (3-58) is an isotropic operation (see
a filter of size n × n (n odd) and explain why the statement of Problem 3.39).
this is so.
(b) Show that the isotropic property is lost in
(b) Consider an image having various sets of general if the gradient is computed using
pixel clusters. Assume that all points in a Eq. (3-59).
cluster are lighter or darker than the back-
3.44 Are any of the following highpass (sharpening)
ground (but not both simultaneously in the
kernels separable? For those that are, find vectors
same cluster), and that the area of each clus-
v and w such that vwT equals the kernel(s).
ter is less than or equal to n2 2. In terms of
n, under what condition would one or more (a) The Laplacian kernels in Figs. 3.45(a) and (b).
of these clusters cease to be isolated in the
(b) The Roberts cross-gradient kernels shown in
sense described in part (a)?
Figs. 3.50(b) and (c).
3.37 Do the following:
(c) * The Sobel kernels in Figs. 3.50(d) and (e).
(a) * Develop a procedure for computing the median
of an n × n neighborhood. 3.45 In a character recognition application, text pages
(b) Propose a technique for updating the median are reduced to binary using a thresholding trans-
as the center of the neighborhood is moved formation function of the form in Fig. 3.2(b). This
from pixel to pixel. is followed by a procedure that thins the charac-
ters until they become strings of binary 1’s on a
3.38 In a given application, a smoothing kernel is background of 0’s. Due to noise, binarization and
applied to input images to reduce noise, then a thinning result in broken strings of characters
Laplacian kernel is applied to enhance fine details. with gaps ranging from 1 to 3 pixels. One way
Would the result be the same if the order of these to “repair” the gaps is to run a smoothing kernel
operations is reversed? over the binary image to blur it, and thus create
3.39 * Show that the Laplacian defined in Eq. (3-50) is bridges of nonzero pixels between gaps.
isotropic (invariant to rotation). Assume continu-
(a) * Give the (odd) size of the smallest box ker-
ous quantities. From Table 2.3, coordinate rota-
nel capable of performing this task.
tion by an angle u is given by
x = x cos u − y sin u and y = x sin u + y cos u (b) After bridging the gaps, the image is thresh-
olded to convert it back to binary form. For
your answer in (a), what is the minimum val-
where ( x, y) and ( x, y) are the unrotated and
ue of the threshold required to accomplish
rotated coordinates, respectively.
this, without causing the segments to break
3.40 * You saw in Fig. 3.46 that the Laplacian with a −8 up again?
www.EBooksWorld.ir
3.46 A manufacturing company purchased an imag- mination of the scene changes from natural day-
ing system whose function is to either smooth light to artificial lighting. At no time is the scene
or sharpen images. The results of using the sys- without illumination, so it is always possible to
tem on the manufacturing floor have been poor, obtain an acceptable image. Because the range of
and the plant manager suspects that the system illumination is such that it is always in the linear
is not smoothing and sharpening images the way operating range of the camera, it is decided not
it should. You are hired as a consultant to deter- to employ any compensating mechanisms on the
mine if the system is performing these functions camera itself. Rather, it is decided to use image
properly. How would you determine if the system processing techniques to post-process, and thus
is working correctly? (Hint: Study the statements normalize, the images to the equivalent of con-
of Problems 3.31 and 3.32). stant illumination. Propose a method to do this.
You are at liberty to use any method you wish,
3.47 A CCD TV camera is used to perform a long-term
but state clearly all the assumptions you made in
study by observing the same area 24 hours a day, for
arriving at your design.
30 days. Digital images are captured and transmit-
ted to a central location every 5 minutes. The illu-
www.EBooksWorld.ir