









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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: Rgb, Component, Values, Monochrome, Image, Cmy, Saturation, Intensity, Hsi, Complemented
Typology: Exercises
1 / 15
This page cannot be seen from the preview
Don't miss anything!










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 ) = ( x 0 − x 1 )^2 +
y 0 − y 1
Similarly the distance between c 1 and c 2
d ( c 1 , c 2 ) = ( x 1 − x 2 )^2 +
y 1 − y 2
The percentage p 1 of c 1 in c is
p 1 =
d ( c 1 , c 2 ) − d ( c , c 1 ) d ( c 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.
Use color filters that are sharply tuned to the wavelengths of the colors of the three objects. With a specific filter in place, only the objects whose color cor- responds to that wavelength will produce a significant response on the mono- chrome camera. A motorized filter wheel can be used to control filter position from a computer. If one of the colors is white, then the response of the three filters will be approximately equal and high. If one of the colors is black, the response of the three filters will be approximately equal and low.
51
Figure P6.
For the image given, the maximum intensity and saturation requirement means that the RGB component values are 0 or 1. We can create Table P6.6 with 0 and 255 representing black and white, respectively. Thus, we get the monochrome displays shown in Fig. P6.6.
(a) All pixel values in the Red image are 255. In the Green image, the first column is all 0’s; the second column all 1’s; and so on until the last column, which is composed of all 255’s. In the Blue image, the first row is all 255’s; the second row all 254’s, and so on until the last row which is composed of all 0’s.
Equation (6.2-1) reveals that each component of the CMY image is a function of a single component of the corresponding RGB image— C 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), we know that s (^) i = k r (^) i for i = 1, 2, 3 (for the R , G , and B components). And from Eq. (6.2-1), we know that the CMY components corresponding to the r (^) i and s (^) i (which we are denoting with primes) are r (^) i ′ = 1 − r (^) i and s (^) i ′ = 1 − s (^) i.
There are two important aspects to this problem. One is to approach it in the HSI space and the other is to use polar coordinates to create a hue image whose values grow as a function of angle. The center of the image is the middle of what- ever image area is used. Then, for example, the values of the hue image along a radius when the angle is 0◦^ would be all 0’s. Then the angle is incremented by, say, one degree, and all the values along that radius would be 1’s, and so on. Values of the saturation image decrease linearly in all radial directions from the origin. The intensity image is just a specified constant. With these basics in mind it is not difficult to write a program that generates the desired result.
(a) It is given that the colors in Fig. 6.16(a) are primary spectrum colors. It also is given that the gray-level images in the problem statement are 8-bit images. The latter condition means that hue (angle) can only be divided into a maximum number of 256 values. Because hue values are represented in the interval from 0 ◦^ to 360◦^ this means that for an 8-bit image the increments between contiguous hue values are now 360 / 255. Another way of looking at this is that the entire [0, 360 ] hue scale is compressed to the range [0, 255]. Thus, for example, yellow (the first primary color we encounter), which is 60◦^ now becomes 43 (the closest integer) in the integer scale of the 8-bit image shown in the problem statement. Similarly, green, which is 120◦^ becomes 85 in this image. From this we easily compute the values of the other two regions as being 170 and 213. The region in the middle is pure white [equal proportions of red green and blue in Fig. 6.61(a)] so its hue by definition is 0. This also is true of the black background.
Using Eq. (6.2-3), we see that the basic problem is that many different colors have the same saturation value. This was demonstrated in Problem 6.12, where pure red, yellow, green, cyan, blue, and magenta all had a saturation of 1. That is, as long as any one of the RGB components is 0, Eq. (6.2-3) yields a saturation of 1. Consider RGB colors (1, 0, 0) and (0, 0.59, 0), which represent shades of red and green. The HSI triplets for these colors [per Eq. (6.4-2) through (6.4-4)] are (0, 1, 0.33) and (0.33, 1, 0.2), respectively. Now, the complements of the begin- ning RGB values (see Section 6.5.2) are (0, 1, 1) and (1, 0.41, 1), respectively; the corresponding colors are cyan and magenta. Their HSI values [per Eqs. (6.4-2) through (6.4-4)] are (0.5, 1, 0.66) and (0.83, 0.48, 0.8), respectively. Thus, for the
red, a starting saturation of 1 yielded the cyan “complemented” saturation of 1, while for the green, a starting saturation of 1 yielded the magenta “comple- mented” saturation of 0.48. That is, the same starting saturation resulted in two different “complemented” saturations. Saturation alone is not enough informa- tion to compute the saturation of the complemented color.
The RGB transformations for a complement [from Fig. 6.33(b)] are:
s (^) i = 1 − r (^) i
where i = 1, 2, 3 (for the R , G , and B components). But from the definition of the CMY space in Eq. (6.2-1), we know that the CMY components corresponding to r (^) i and s (^) i , which we will denote using primes, are
r (^) i ′ = 1 − r (^) i s (^) i ′ = 1 − s (^) i.
Thus, r (^) i = 1 − r (^) i ′
and s ′ i = 1 − s (^) i = 1 − ( 1 − r (^) i ) = 1 −
1 − r (^) i ′
so that s ′^ = 1 − r (^) i ′.
Based on the discussion is Section 6.5.4 and with reference to the color wheel in Fig. 6.32, we can decrease the proportion of yellow by (1) decreasing yellow, (2) increasing blue, (3) increasing cyan and magenta, or (4) decreasing red and green.
The simplest approach conceptually is to transform every input image to the HSI color space, perform histogram specification per the discussion in Section 3.3. on the intensity ( I ) component only (leaving H and S alone), and convert the resulting intensity component with the original hue and saturation components back to the starting color space.
A mean approximation pyramid is created by forming 2×2 block averages. Since the starting image is of size 4 × 4, J = 2 and f
x , y
is placed in level 2 of the mean approximation pyramid. The level 1 approximation is (by taking 2×2 block averages over f
x , y
and subsampling)
and the level 0 approximation is similarly [8.5]. The completed mean approxi- mation pyramid is
Pixel replication is used in the generation of the complementary prediction resid- ual pyramid. Level 0 of the prediction residual pyramid is the lowest resolu- tion approximation, [8.5]. The level 2 prediction residual is obtained by upsam- pling the level 1 approximation and subtracting it from the level 2 approxima-
57
tion (original image). Thus, we get ⎡ ⎢ ⎢⎢ ⎣
Similarly, the level 1 prediction residual is obtained by upsampling the level 0 approximation and subtracting it from the level 1 approximation to yield ' 3.5 5. 11.5 13.
The prediction residual pyramid is therefore ⎡ ⎢ ⎢ ⎢ ⎣
The number of elements in a J + 1 level pyramid where N = 2 J^ is bounded by 4 3 N^ (^2) or 4 3
= 43 22 J^ (see Section 7.1.1):
for J > 0. We can generate the following table: J Pyramid Elements Compression Ratio 0 1 1 1 5 5 / 4 = 1. 2 21 21 / 16 = 1. 3 85 85 / 64 = 1. .. .
All but the trivial case, J = 0, are expansions. The expansion factor is a function of J and bounded by 4/3 or 1.33.
From Eq. (7.2-19), we find that ψ 3,3( x ) = 23 /^2 ψ ( 23 x − 3 ) = 2 2 ψ ( 8 x − 3 )
and using the Haar wavelet function definition from Eq. (7.2-30), obtain the plot in Fig. P7.13.
To express ψ 3,3 ( x ) as a function of scaling functions, we employ Eq. (7.2-28) and the Haar wavelet vector defined in Example 7.6—that is, hψ ( 0 ) = 1 / 2 and hψ ( 1 ) = − 1 / 2. Thus we get
ψ ( x ) =
n
hψ ( n ) 2 ϕ ( 2 x − n )
so that
ψ ( 8 x − 3 ) =
n
hψ ( n ) 2 ϕ ( 2 [ 8 x − 3 ] − n )
2 ϕ ( 16 x − 6 ) +
2 ϕ ( 16 x − 7 )
= ϕ ( 16 x − 6 ) − ϕ ( 16 x − 7 ). Then, since ψ 3,3 ( x ) = 2 2 ψ ( 8 x − 3 ) from above, substitution gives
ψ 3,3 = 2 2 ψ ( 8 x − 3 ) = 2 2 ϕ ( 16 x − 6 ) − 2 2 ϕ ( 16 x − 7 ).
0
2 2
0 3/8 1
-2 2
Figure P7.
2
2
W ϕ(2 , n ) = f ( n ) = {1, 4, -3, 0}
W ϕ(1 , n ) = {5/ 2, -3/ 2}
{-1/ 2, 1/ 2} W ψ(1 , n ) = {-3/ 2, -3/ 2}
{1/ 2, 1/ 2}
{-1/ 2 , -3/ 2, 7/ 2, -3/ 2, 0}
{1/ 2 , 5/ 2, 1/ 2, -3/ 2, 0}
Figure P7.
Intuitively, the continuous wavelet transform (CWT) calculates a “resemblance index” between the signal and the wavelet at various scales and translations. When the index is large, the resemblance is strong; else it is weak. Thus, if a function is similar to itself at different scales, the resemblance index will be sim- ilar at different scales. The CWT coefficient values (the index) will have a char- acteristic pattern. As a result, we can say that the function whose CWT is shown is self-similar—like a fractal signal.
(b) The DWT is a better choice when we need a space saving representation that is sufficient for reconstruction of the original function or image. The CWT is often easier to interpret because the built-in redundancy tends to reinforce traits of the function or image. For example, see the self-similarity of Problem 7.17.
The filter bank is the first bank in Fig. 7.19, as shown in Fig. P7.19:
(a) Input ϕ ( n ) = {1, 1, 1, 1, 1, 1, 1, 1} = ϕ 0,0( n ) for a three-scale wavelet transform with Haar scaling and wavelet functions. Since wavelet transform coefficients measure the similarity of the input to the basis functions, the resulting transform is { Wϕ (0, 0), Wψ (0, 0), Wψ (1, 0), Wψ (1, 1), Wψ (2, 0), Wψ (2, 1), Wψ (2, 2)
(a) Table P8.4 shows the starting intensity values, their 8-bit codes, the IGS sum used in each step, the 4-bit IGS code and its equivalent decoded value (the decimal equivalent of the IGS code multiplied by 16), the error between the decoded IGS intensities and the input values, and the squared error.
(b) Using Eq. (8.1-10) and the squared error values from Table P8.4, the rms error is
e (^) r m s =
or about 7.8 intensity levels. From Eq. (8.1-11), the signal-to-noise ratio is
SN R (^) m s =
Table P8. Intensity 8-bit Code Sum IGS Code Decoded IGS Error Square Error 00000000 108 01101100 01101100 0110 96 -12 144 139 10001011 10010111 1001 144 5 25 135 10000111 10001110 1000 128 -7 49 244 11110100 11110100 1111 240 -4 16 172 10101100 10110000 1011 176 4 16 173 10101101 10101101 1010 160 -13 169 56 00111000 01000101 0100 64 8 64 99 01100011 01101000 0110 96 -3 9
The conversion factors are computed using the logarithmic relationship
log a x =
log b a log b x.
Thus, 1 Hartley = 3.3219 bits and 1 nat = 1.4427 bits.
Let the set of source symbols be
a (^) 1 , a (^) 2 , ..., a (^) q
with probabilities P ( a (^) 1 ) , P ( a (^) 2 ) , ..., P
a (^) q
Then, using Eq. (8.1-6) and the fact that the sum of all P ( a (^) i ) is 1, we get
log q − H = log q
∑^ q
j = 1
a (^) j
∑^ q
j = 1
a (^) j
log P
a (^) j
∑^ q
j = 1
a (^) j
log q +
∑^ q
j = 1
a (^) j
log P
a (^) j
∑^ q
j = 1
a (^) j
log q P
a (^) j
Using the log relationship from Problem 8.6, this becomes
= log e
∑ q
j = 1
a (^) j
ln q P
a (^) j