You are on page 1of 13

Assignment I

Q 1: Alternating current certainly is part of the electromagnetic spectrum.


commercial alternating current in the United States has a frequency of 60
Hz. What is the wavelength in kilometers of this component of the
spectrum?
Ans: The solution is
λ = c /v
= 2.998×108(m/s)/60(1/s)
= 4.997×106m=4997Km.

Q 2: A common measure of transmission for digital data is the baud rate,


defined asthe number of bits transmitted per second. Generally, transmission
is accomplishedin packets consisting of a start bit, a byte (8 bits) of
information, and a stopbit. Using these facts, answer the following:
(a) How many minutes would it take to transmit a 1024*1024 image with
256gray levels using a 56K baud modem?
(b) What would the time be at 3000K baud, a representative speed of a
phone DSL (digital subscriber line) connection?
Ans. (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 imageover 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.

Q 3. Consider the two image subsets, S1 and S2, shown in the following
figure. ForV= {1}, determine whether these two subsets are (a) 4-adjacent,
(b) 8-adjacent,or (c) m-adjacent.
Ans. Let p and q be as shown in Fig. below. Then,
(a) S1 and S2 are not 4-connectedbecause q is not in the set N4 (p);
(b) S1 and S2 are 8-connected because q is inthe set N8 (p);
(c) S1 and S2 are m-connected because (i) q is in ND (p), and (ii)the set
N4(p) ∩ N4(q) is empty.

Q 3. Consider the image segment shown.


(a) Let V= {0, 1} and compute the lengths of the shortest 4-, 8-, andm-path
betweenp and q. If a particular path does not exist between these two
points,explain why.
(b) Repeat for V= {1, 2}.

3 1 2 1(q)
2 2 0 2
1 2 1 1
(p) 1 0 1 2
Ans:(a) When V = {0,1}, 4-path does not exist between p and q because it is
impossibleto get from p to q by traveling along points that are both 4-
adjacent andalso have values from V . Figure (a) shows this condition; it is
not possibleto get to q. The shortest 8-path is shown in Fig. (b); its length is
4. Thelength of the shortest m- path (shown dashed) is 5. Both of these
shortest pathsare unique in this case.
Q 4: (a) Give the condition(s) under which the D4 distance between two
points p andq is equal to the shortest 4-path between these points.
(b) Is this path unique?
Ans: (a) A shortest 4-path between a point p with coordinates (x,y) and a
point qwith coordinates (s , t ) is shown in Fig., where the assumption is that
allpoints 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 |,
whichwerecognize as the definition of the D4 distance. (Recall thatthis
distance is independent of any paths that may exist between the points.)
The D4 distance obviously is equal to the length of the shortest 4-path when
thelength of the path is |x −s |+ | y –t |.
This occurs whenever we can get from pto q by following a path whose
elements (1) are from V, and (2) are arranged insuch a way that we can
traverse the path fromp to q bymaking turns in atmosttwo directions (e.g.,
right and up).
Q 5: Give a single intensity transformation function for spreading the
intensities of an image so the lowest intensity is 0 and the highest is L-1
Ans:Let f denote the original image. First subtract the minimum value of f
denotedf min from f to yield a function whose minimum value is 0:
g1 = f − f min
Next divide g1 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].

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

Q 6: a) What effect would setting to zero the lowest order bit planes have on
the histograms of an image in general.
b) What would be the effect on the histogram if we set to zero the higher
order bit planes instead.
Ans: (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.
Q 7: a) Develop a procedure for computing the median of an n x
nneighborhood.
b) Propose a technique for updating the median as the center of the
neighborhood is moved from pixel to pixel.
Ans: (a) Numerically sort the n2 values. The median is ζ = [(n2 +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.

$VVLJQPHQW4&RQVLGHUDQ\WZRYDOLGFRORUVFDQGFZLWKFRRUGLQDWHV [\ 
DQG [\ LQWKHFKURPDWLFLW\GLDJUDP
'HULYHWKHQHFHVVDU\JHQHUDOH[SUHVVLRQIURPFRPSXWLQJWKHUHODWLYHSHUFHQWDJH
RIFRORUVFDQGFFRPSRVLQJDJLYHQDFRORUWKDWLVNQRZQWROLHRQWKHVWUDLJKWOLQH
MRLQLQJWKHVHWZRFRORUV
$ns: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 )2]1/2.
Similarly the distance between c1 and c 2 is

The percentage p 2 of c 2 is simply p 2 = 100 −p 1 . In the preceding equation


wesee, for example, thatwhen c = c 1 , thend (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.

Q 2: The following 8 bit images are (left to right) the H,S and I component
images from image below . the numbers indicate gray level values . answer
the following questions , explaining the basis for your answer in each. If it is
not possible to answer a question based on the given information , state why
you cannot do so.
a) give the gray level values of all regions in the hue image.
b) give the gray level value of all regions in the saturated image.
c) give the gray level values of all regions in the intensity image.
a) b) c)

Ans. (a) It is given that the colors in Fig. 1 (a) are primary spectrumcolors. It
also isgiven that the gray-level images in the problem statement are 8-bit
images. Thelatter condition means that hue (angle) can only be divided into
a maximumnumber of 256 values. Because hue values are represented in the
interval from0◦ to 360◦ thismeans that for an 8-bit image the increments
between contiguoushue 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 closestinteger) 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 easilycompute the values of
the other two regions as being 170 and 213. The region inthemiddle
ispurewhite [equal proportions of red,green and blue 1 (a)]so its hue by
definition is 0. This also is true of the black background.

Q 3. Show that the saturation component of the complement of a color


image cannot be computed from the saturation component of the input image
alone.
Ans. Using Eq.
3
S=1- [min (R, G, B)] ………A
(𝑅+𝐺+𝐵)
we see that the basic problem is that many different colorshave the same
saturation value. Pure red, yellow, green, cyan, blue, and magenta all have a
saturation of 1. Thatis, as long as any one of the RGB components is 0, Eq.A
yields a saturationof 1.Consider RGB colors (1, 0, 0) and (0, 0.59, 0), which
represent shades of redand green. The HSI triplets for these colors are(0, 1,
0.33) and (0.33, 1, 0.2) respectively. Now, the complements of the
beginningRGB values are (0, 1,and 1) and (1, 0.41,1), respectively;
thecorrespondingcolors are cyan and magenta. Their HSI values are (0.5,
1,0.66) and (0.83, 0.48,0.8) respectively. Thus, for thered, a starting
saturation of 1 yielded the cyan “complemented” saturation of1, while for
the green, a starting saturation of 1 yielded the magenta
“complemented”saturation of 0.48. That is, the same starting saturation
resulted in twodifferent “complemented” saturations. Saturation alone is not
enough informationto compute the saturation of the complemented color.

Q 4: Derive the CMY transformations to generate the complement of a color


image.
Ans.The RGB transformations for a complement [from Fig. 6.33(b)] are:
s i = 1−r i
wherei = 1, 2, 3 (for the R, G, and B components). But fromthe definition of
theCMY space in Eq. (6.2-1), we know that the CMY components
corresponding tor i and s i , which we will denote using primes, are
Assignment 3
Q 1:The base e unit of information is commonly called a nat, and the base-
10 information unit is called a Hartley. Compute the conversion factor
needed to relate these units to the base-2 unit of information (the bit).
Ans: The conversion factors are computed using the logarithmic relationship

Thus, 1 Hartley = 3.3219 bits and 1 nat = 1.4427 bits.

Q 2. Prove that, for a zero- memory source with q symbols, the maximum
value of the entropy is log q, which is achieved if and only if all source
symbols are equiprobable. [Hint: consider the quantity log q – H (z) and note
the inequality lnx≤ x - 1.
Ans.Let the set of source symbolsbe{a 1 , a 2 , ...,a q }with probabilities [P
(a 1 ),P (a 2 ) , ...,P(a q )]T. .
Then, using Eq.
𝑗
H = - ∑𝑗=1 𝑃( 𝑎𝑗 ) log 𝑃 (𝑎𝑗 )
and the fact that the sumof all P (a i ) is 1, we get
Therefore, H is always less than, or equal to, logq. Furthermore, in viewof
theequality condition (x = 1) for ln1/x ≥ 1−x, which was introduced at only
onepoint in the above derivation, we will have strict equality if and only if P
(a j ) =1/q for all j.

Q 3:Using the Huffman code decode the encoded string


0101000001010111110100.
Ans: a 3 a 6 a 6 a 2 a 5 a 2 a 2 a 2 a 4

Q 4: the arithmetic process is the reverse of the encoding procedure.Decode


the message 0.23355 given the coding model.

Symbol Probability
a 0.2
e 0.3
i 0.1
o 0.2
u 0.1
! 0.1

Ans:The arithmetic decoding process is the reverse of the encoding


procedure. Startby dividing the [0, 1) interval according to the symbol
probabilities. This isshown in Table P8.18. The decoder immediately knows
the message 0.23355begins with an “e”, since the coded message lies in the
interval [0.2, 0.5). Thismakes it clear that the second symbol is an “a”,
which narrows the interval to[0.2, 0.26). To further see this, divide the
interval [0.2, 0.5) according to the symbolprobabilities. Proceeding like this,
which is the same procedure used to codethemessage, we get “eaii!”.
Assignment 4
Q 1: A binary image contains straight lines oriented horizontally, vertically,
at 450, and at - 450. Give a set of 3 x 3 masks that can be used to detect 1-
pixel breaks in these lines. Assume that the intensities of the lines and
background are 1 and 0, respectively.
Ans:The masks would have the coefficients shown in Fig. Each mask
wouldyield a value of 0 when centered on a pixel of an unbroken 3-pixel
segment orientedin the direction favored by that mask. Conversely, the
response would bea +2 when a mask is centered on a one-pixel gap in a 3-
pixel segment orientedin the direction favored by thatmask.

Q 2: What is the order of the shape number of the figure given below?

Ans:The number of symbols in the first difference is equal to the number of


segmentprimitives in the boundary, so the shape order is 12.
Q 3: Obtain the gray level co-occurrence matrix of a 5 x 5 image composed
of a check board of alternating 1’s and 0’s if the position operator Q is
defined as “ one pixel to the right” .
Ans :(a) The image is
0 1 0 1 0
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
0 1 0 1 0
Let z 1 = 0 and z 2 = 1. Because there are only two intensity levels, matrix G is
oforder 2×2. Element g 11 is the number of pixels valued 0 located one pixel
to theright of a 0. By inspection, g 11 = 0. Similarly, g 12 = 10, g 21 = 10, and
g 22 = 0.The total number of pixels satisfying the predicate P is 20, so the
normalizedco-occurrence matrix is

G= 0 ½
½ 0

You might also like