Sie sind auf Seite 1von 28

DIGITAL SIGNAL AND IMAGE PROCESSING (INFORMATION TECHNOLOGY)

DECEMBER 2012 SOLUTIONS (KR-2070)

1(a) Classify the following DT System on linearity, time invariance, and causality. [05]
System Linearity Time Invariance Causal
(i) y(n) = n x(n) Linear Time Variant Causal
(ii) y(n) = ex(n) Non-Linear Time-Invariant Causal
(iii) y(n) = x(2n) Linear Time-Invariant Non-Causal

(b) Consider the image given below. Calculate the direction of the edge at the centre point of the image. [05]

[ ]
50 60 70
f= 5 50 80
7 9 50

Solution:
Using Prewitts Mask Using Sobels Mask

[ ] [ ]
1 1 1 1 2 1
X-direction (Fx) 0 0 0 X-direction (Fx) 0 0 0
1 1 1 1 2 1

[ ]
1 0 1

[ ]
1 0 1
1 0 1 Y-direction (Fy) 2 0 2
Y-direction (Fy)
1 0 1 1 0 1

Applying the above masks at the centre point Applying the above masks at the centre point
of the image we get gradients as: of the image we get gradients as:
Gx = (-50 60 70 + 7 + 9 + 50) = -114 Gx = (-50 120 70 + 7 + 18 + 50)
Gy = (-50 5 7 + 70 + 80 + 50) = 138 = -165
Gradient direction Gy = (-50 10 7 + 70 + 160 + 50)
Gy 138 = 213
=tan1 =tan1 =50.44 Gradient direction
Gx 114
Gy 213
=tan1 =tan1 =52.24
Edge direction = 90= Gx 165
50.44 90 = 90=
Edge direction
=140.44 39.56 52.24 90

=142.24 37.76
[Note: Solve by using any one of the above mask.]

(c) Show that the first difference of a chain code normalizes it to rotation. [05]
Solution:
Consider the object given below The object after rotation in right 900
Start point
Start point
Assume upward direction of movement Direction of movement will be horizontal
The chain code for object using 4-point The chain code for object using 4-point
convention will be convention will be
112223301030 001112230323
The first difference between chain codes will The first difference between chain codes will
be be
0 1 0 0 01 0 1 1 3 3 1 01001011331
Hence, we see that irrespective of rotation, first difference remains the same. Therefore, the first
difference of a chain code normalizes it to rotation.

(d) Prove that two dimensional DFT matrix is an Unitary matrix. [05]
Solution:
Matrix A is an Unitary matrix if A. A*T = I
The 2D-DFT matrix for 4-point DFT is

[ ]
1 1 1 1
1 j 1 j
A=
1 1 1 1
1 j 1 j

[ ]
1 1 1 1
A = 1 j 1 j = A*T
1 1 1 1
1 j 1 j

[ ][ ] [ ]
1 1 1 1 1 1 1 1 4 0 0 0
1 j 1 j 1 j 1 j 0 4 0 0
Now, A. A*T = 1 1 1 1 1 1 1 1 = 0 0 4 0 = 4I
1 j 1 j 1 j 1 j 0 0 0 4

1
Here 4 indicate that the DFT matrix is not normalized. We compensate this by using N in forward or

inverse DFT, where N = 4 in this case.


Hence, A. A*T = I, i.e., two dimensional DFT matrix is an Unitary matrix.

2(a) Find linear convolution of two sequences [04]


1
x(n) = {1, 2, 3} and h(n) = {1, 2 }

Solution: y(n) = x(n) * h(n) = x ( m ) h(nm)


m=

x(n) 1 2 3
h(n)
1 1 2 3
1 1 1 3
2 2 2

5 3
y ( n ) = {1, , 4,
2 2 }

(b) Find the energy of signal x(n) [06]

{
1 n
x ( n )= 2 () ,n 0

( 2 )n ,n<0

Solution:


2
Energy of the signal x(n) is given as E= |x (n)|
n=

n2

|( ) |
1
n2 1
E= |(2) | +
n= n=0 2

1 n
E= |4| +
n=
n

n=0
||
1
4

n n
E=
n=1
|| ||
1
+
1
4 n=0 4

We have,

aN 1
an=
1a
|a|<1
n=N 1
5
E=
3

(c) A particular digital image with 8 quantization level has following histogram. Perform histogram [10]
equalization.
Grey Level 0 1 2 3 4 5 6 7
No. of Pixels 790 102 850 656 329 245 122 81
3
Solution:
Given L= 8 quantization levels. ( L1 )=7

Grey Level No. of Pixels Pr = Cumulative Prob. (L-1)* S Rounding Off


r n n S
N
0 790 0.19 0.19 1.33 1
1 1023 0.25 0.44 3.08 3
2 850 0.21 0.65 4.55 5
3 656 0.16 0.81 5.67 6
4 329 0.08 0.89 6.23 6
5 245 0.06 0.95 6.65 7
6 122 0.03 0.98 6.86 7
7 81 0.02 1.00 7 7
N = n = 4096
Now we take 1st, 2nd, and last column for finding new grey levels.

Old Grey Level No. of Pixels New Grey Level


r n
0 790 1
1 1023 3
2 850 5
3 656 985 6
4 329 6
5 245 7
6 122 448 7
7 81 7

Hence, the equalized histogram is:


Grey Level 0 1 2 3 4 5 6 7
No. of Pixels 0 790 0 102 0 850 985 448
3
Original Histogram
Grey Level No. of Pixels

1023
790 850
656

329
245
122 81
0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
Equaliz ed His tog ram

3(a) What is morphology? Name and explain the basic operation in morphology? [10]

Solution:
Morphology is the science of form and structure.
In image processing, morphology is about regions and shapes.
It is used as a tool for extracting image components that are useful in representation of regions
and shapes.

The basic operations in morphology:


(a) Dilation
A B {z|( B )z A }
Dilation of a set A by structuring element B: all z in A such that B hits
A when origin of B=z

2
A B={ p z p=a+b , a A ,b B }

Dilation is also called a swelling operator.


It adds pixels to the boundaries of the objects in an image. The number of pixels added depends
on the size and shape of the structuring element.
(b) Erosion
Erosion of a set A by structuring element B: all z in A such that B is in A when origin of B=z
AB {z | ( B ) z A}

A B={ p z 2| p+ b A for every b B }


Erosion is also called a shrinking operator.
It reduces the number of pixels from the object boundary. The number of pixels removed depends
on the size of the structuring element.
(c) Opening
A B ( AB) B
Erosion followed by dilation is called opening, and is denoted by
eliminates protrusions
breaks necks
smoothes contour
(d) Closing
Dilation followed by erosion is called Closing, and is denoted by
A B ( A B)B

smooth contour
fuse narrow breaks and long thin gulfs
eliminate small holes
fill gaps in the contour

(b) For the 3 bit 4x4 size image, perform following operations: [10]
(i) Negative
(ii) Thresholding with T=4
(iii) Intensity level slicing with background with r 1=2 and r2= 5
(iv) Bit plane slicing for MSB and LSB plane
(v) Clipping with r1=2 and r2=5
1 2 3 0
2 4 6 7
5 2 4 3
3 2 6 1
Solution:
Given that the image is 3-bit. L=8

(i) Negative
The transformation function is S = (L - 1) r
Where, r is the original image intensity
S is the output image intensity
Negative of the image is:
6 5 4 7
5 3 1 0
2 5 3 4
4 5 1 6

(ii) Thresholding with T=4

The transformation function is


s= {L1,
0, r 4
r>4
Threshold image is:
0 0 0 0
0 0 7 7
7 0 0 0
0 0 7 0
(iii) Intensity level slicing with background with r1=2 and r2= 5

The transformation function is {


s= L1, 2 r 5
r , otherwise
The output image is:
1 7 7 0
7 7 6 7
7 7 7 7
7 7 6 1

(iv) Bit plane slicing for MSB and LSB plane


Convert each pixel intensity of image by 3 binary bits.
Binary Image MSB Plane LSB Plane
001 010 011 000 0 0 0 0 1 0 1 0
010 100 110 111 0 1 1 1 0 0 0 1
101 010 100 011 1 0 1 0 1 0 0 1
011 101 110 001 0 1 1 0 1 1 0 1

(v) Clipping with r1=2 and r2=5

The transformation function is


s=
{(
rr 1 ) + s1 , 2 r <5
s 2 ,5 r ( L1)

s 1=0, s 2=( L1 )=7, r 1=2, r 2=5

s 2s1 70
= =
2
r 2s1 52

The output image is:


0 0 2 0
0 4 7 7
7 0 4 2
2 0 7 0
4(a) Let x(n) = {1, 2, 3, 4, 0, 0, 0, 0}
Find 8-point DFT of x(n). [10]
Solution:
X[K] = {10, -0.414 - j7.242, -2 + j2, 2.414 j1.242, -2, 2.414 + j1.242, -2 j2, -0.414 + j7.242 }
(b)
Given [
f ( x , y )= 5 6 7
8 9 10 ] and [ ]
h ( x , y )= 1 2
3 4 .
[10]

Find the linear convolution of the input image f (x , y) and filter h(x, y) .

Solution:
Let g( x , y ) denote f ( x , y )h( x , y)

Size of f ( x , y ) be M X N = 2 X 3 and of h(x , y) be U X V = 2 X 2

Size of g( x , y ) = [M + U - 1] X [N + V - 1] = 3 X 4

Hence we need to zero pad f ( x , y ) h( x , y ) as below:

[ ] [ ]
0 0 0 0 0 0 0 0
f ( x , y )= 5 6 7 0 and h ( x , y ) = 1 2 0 0 [Note: Bold denotes origin]
8 9 10 0 3 4 0 0
[ ][ ] [ ]
3 0 0 0 0 0 0 2 1 0 0 4 8 24
4 3 0 0 0 0 0 0 2 1 0 0 9 59
0 4 3 0 0 0 0 0 0 2 1 0 10 66
0 0 4 3 0 0 0 0 0 0 2 1 0 40
1 0 0 4 3 0 0 0 0 0 0 2 5 23
g ( x , y )= 2 1 0 0 4 3 0 0 0 0 0 0 6 = 63
0 2 1 0 0 4 3 0 0 0 0 0 7 73
0 0 2 1 0 0 4 3 0 0 0 0 0 48
0 0 0 2 1 0 0 4 3 0 0 0 0 5
0 0 0 0 2 1 0 0 4 3 0 0 0 16
0 0 0 0 0 2 1 0 0 4 3 0 0 19
0 0 0 0 0 0 2 1 0 0 4 3 0 14

[ ]
5 16 19 14
g ( x , y ) = 23 63 73 48
24 59 66 40

5(a) x ( n )=2 ( n ) +3 ( n1 ) +4 ( n2 ) +5 ( n3) [04]


Let
Find four point DFT X(k) using Fast Fourier Transform Flowgraph.
Solution:
Given x ( n )=2 ( n ) +3 ( n1 ) +4 ( n2 ) +5 (n3)

x ( n )={2, 3, 4, 5}

Hence the four point DFT X[k ]= {14, -2+j2, -2, -2-j2}

(b) Explain one level decomposition and reconstruction of digital image using Discrete Wavelet Transform. [06]
Solution:
The Wavelet Transform provides a time-frequency representation of the signal. The Wavelet
Transform uses multi-resolution technique by which different frequencies are analyzed with
different resolutions.

A wave is an oscillating function of time or space and is periodic. In contrast, wavelets are
localized waves. They have their energy concentrated in time or space and are suited to analysis
of transient signals. While Fourier Transform use waves to analyze signals, the Wavelet
Transform uses wavelets of finite energy.

(a) (b)
Figure: Demonstration of (a) a Wave and (b) a Wavelet

[ I ] Two Dimensional Forward Pyramid Decomposition

1. In wavelet Transform, an image signal is passed through an analysis filter bank followed
by decimation operation.
2. The analysis filter bank consists of a LPF and HPF
3. When the signal passes through these filters, it splits into two bands.
4. The LPF which corresponds to an averaging operation extracts texture information of the
signal.
5. The HPF, which corresponds to differencing operation, extracts the detail information of
the signal.
6. The output of filter is decimated by two.
7. A Two dimensional Transform is accomplished by Row-wise filtering operation using
parallel bank of filters followed by Row-wise filtering operation using parallel bank of
filters. Each time the output of filter is decimated by two.
8. This operation splits input image into four bands of data, LL (low-low), HL (high-low),
LH (low-high) and HH (high-high).
9. The LL band can be decomposed once again in the same manner, thereby producing even
more sub bands. This can be done up to any level, thereby resulting in a pyramidal
decomposition.

[ II ] Two Dimensional Inverse Pyramid Reconstruction:


1. In inverse wavelet transform, the decomposed frequency band images LL, LH, HL and
HH are first interpolated by factor two and then further passed through a synthesis filter
bank.
2. The synthesis filter bank consists of a LPF and HPF
3. When the decomposed frequency band image signal is passed through these filters, the
output is merged into single band image.
4. The reconstructed image is exactly same as original input image.

(c) Find the arithmetic code word of the message: INDIA [10]
Calculate the percentage of compression and Bits Per Pixel (BPP) of the compressed message.
Solution:
Symbols Probability
I 0.4
N 0.2
D 0.2
A 0.2

Step-1 : To find interval for first character I


Now, Interval is [ 0.0 to 1.0 ]
Lower range value = 0
Upper range value = 1
No of sub-intervals = 5
UpperLower 1.00.0
intervalStepValue= = =0.2
No . of intervals 5

Interval for Character I is [ 0.0 to 0.4 ]


Step-2 : To find interval for Second character N
Now, Interval is [ 0.0 to 0.4 ]
UpperLower 0.40.0
intervalStepValue= = =0.08
No . of intervals 5
3 2 1
f= 5 2 6
7 9 1
Interval for Character N is [ 0.16 to 0.24 ]
Step-3 : To find interval for Second character D
Now, Interval is [ 0.16 to 0.24 ]
UpperLower 0.240.16
intervalStepValue= = =0.016
No . of intervals 5

Interval for Character D is [ 0.208 to 0.224 ]

Step-4 : To find interval for Second character I


Now, Interval is [ 0.208 to 0.224 ]
UpperLower 0.2240.208
intervalStepValue= = =0.032
No . of intervals 5

Interval for Character I is [ 0.208 to 0.2144 ]

Step-5 : To find interval for Second character A


Now, Interval is [ 0.208 to 0.2144 ]
UpperLower 0.21440.208
intervalStepValue= = =0.00128
No . of intervals 5

Interval for Character A is [ 0.21312 to 0.2144 ]

Arithmetic Codeword for the Message INDIA is [ 0.21312 ]

Size of input message INDIA is 5 characters * 8 bits = 40 bits


Since arithmetic codeword is floating point,
Size of coded message = 4 bytes = 32 bits
Input Message x 100
Percentage of compression = Input Message Messa

4032
=
x 100 =20
40

Compresses Messagebits 32
Bits Per Pixel (BPP) =
= =6.4 BPP
Total Number of Pixels 5

6(a) Given an input image f of size 3X 3. Find the filtered image using median filter mask as given below: [10]

0 1 0
m= 1 1 0
R1 R2 R3
0 1 0
R= R4 R5 R6
R7 R8 R9
Solution:
Note: If the students have taken mask as:

[ ]
0 1 0
m= 1 1 0
0 1 0

Consider the image with virtual rows and columns having repeated border pixels.
Hence the image would become:

[ ]
3 3 2 1 1
3 3 2 1 1
f= 5 5 2 6 6
7 7 9 1 1
7 7 9 1 1

R1 = Median {3, 3, 3, 5} = 3
R2 = Median {2, 3, 2, 2} = 3
R3 = Median {1, 2, 1, 6} = 2
R4 = Median {3, 5, 5, 7} = 5
R5 = Median {2, 5, 2, 9} = 4
R6 = Median {1, 2, 6, 1} = 2
R7 = Median {5, 7, 7, 7} = 7
R8 = Median {2, 7, 9, 9} = 8
R9 = Median {6, 9, 1, 1} = 4
The filtered image would be:

[ ]
3 3 2
R= 5 4 2
7 8 4

Note: If the students have taken mask as:

[ ]
0 1 0
m= 1 1 1
0 1 0

Consider the image with virtual rows and columns having repeated border pixels.
Hence the image would become:

[ ]
3 3 2 1 1
3 3 2 1 1
f= 5 5 2 6 6
7 7 9 1 1
7 7 9 1 1

R1 = Median {3, 3, 3, 2, 5} = 3
R2 = Median {2, 3, 2, 1, 2} = 2
R3 = Median {1, 2, 1, 1, 6} = 1
R4 = Median {3, 5, 5, 2, 7} = 5
R5 = Median {2, 5, 2, 6, 9} = 5
R6 = Median {1, 2, 6, 6, 1} = 2
R7 = Median {5, 7, 7, 9, 7} = 7
R8 = Median {2, 7, 9, 1, 9} = 7
R9 = Median {6, 9, 1, 1, 1} = 1
The filtered image would be:

[ ]
3 3 1
R= 5 5 2
7 7 1

(b) Write note on Discrete Cosine Transform (DCT) and its applications. Find DCT of given 4X4 image. [10]
2 0 1 0
1 1 0 1
1 0 0 1
2 1 2 3
Solution:
Discrete Cosine Transform (DCT) uses only the real-valued discrete sinusoidal signal. Hence DCT is
purely real. It is orthogonal matrix.
The general equation for the 1D (N data items) DCT is defined by the following equation:

The general equation for a 2D (N by N image) DCT is defined by the following equation:
N 1
C (u, v) (u ) (v) f ( x, y ) cos 2N
cos
(2 x 1) u




(2 x 1) v
2N
x 0

for u,v = 0,1,....,N-1

1
( N ) ,u=0
Where (u) =
{
( u ) =
2
N
,u=1, ., N1

Applications:
Used widely in JPEG image compression
Gives better energy compaction
Converts a signal into elementary frequency components.

We will find the DCT using the matrix notation T =C F C '


[ ]
0.5 0.5 0.5 0.5
0.653 0.2705 0.2705 0.653
Where C= 0.5 0.5 0.5 0.5
0.2705 0.653 0.653 0.2705

[ ][ ][ ]
0.5 0.5 0.5 0.5 2 0 1 0 0.5 0.653 0.5 0.2705
T = 0.653 0.2705 0.2705 0.653 1 1 0 1 0.5 0.2705 0.5 0.653
0.5 0.5 0.5 0.5 1 0 0 1 0.5 0.2705 0.5 0.653
0.2705 0.653 0.653 0.2705 2 1 2 1 0.5 0.653 0.5 0.2705

[ ]
4 0.1912 5.25 0.4612
1.4972 1.3524 0.4618 0.3533
T =
1.5 0.0792 0 1.1148
0.1912 0.3533 0.1912 0.6459

7 Write short notes on any four of the following:- [20]


(a) Digital Watermarking
Objective:
Digital watermarking is a method of hiding one data-set inside another data set. In the case of
images, which are 2-dimensional in nature, digital watermarking is used to hide one image inside
another image with or without visual secrecy. When the watermark is visible, the technique is
known as visible watermarking and when the watermarked image is invisible, the technique is
known as invisible watermarking. The main objective while carrying out invisible watermarking
involves:

1. The image obtained after watermarking must be as close to the host image as possible
2. The retrieved secret image must be as visually similar to the intended secret image as possible

As a general rule of thumb, the watermarked and retrieved images must be acceptable using the
subjective and objective criteria. A subjective criterion involves the visual check of the images
for distortions or irregularities whereas the objective criteria can be defined by correlation
coefficient (CC) or mean square error (MSE).

Different Methods:
The various methods used for digital image watermarking include:
1. Watermarking in spatial domain
2. Watermarking in frequency domain
a. Using FFT
b. Using DCT
c. Using hybrid of FFT and DCT
3. Watermarking in Wavelet domain using DWT coefficients
4. Hybrid-domain watermarking
5. Signal coding techniques like PCM, RLE etc.
6. LSB based bit-coded watermarking
7. Region of Interest Watermarking
8. Neural Network based watermarking

The algorithm will be shown for DWT based digital image watermarking because it provides the
best objective/subjective criteria based results and remain unaffected of different attacks in the
frequency or spatial domains.

Algorithm:

1. Read the images which act as the host image and the secret image.
2. The hierarchy will be to try to hide the secret image inside the host image and then retrieve the
secret image from the host.
3. First, convert the images into their DWT coefficients. The four DWT coefficients are
approximation, horizontal edge, vertical edge and diagonal edge and are obtained by LL, LH, HL
and HH respectively (where L stands for low-pass filtering and H stands for high-pass filtering
and LL stands for low-pass followed by low-pass and so on). They correspond to their respective
names and are shown below (clock-wise from top-left LL, LH, HH, HL):

4. Once each coefficient of each image is saved, one needs to replace every alternate pixel in the
HH or HL or LH component of hosts DWT by the LL component of the secret image.
5. It must be noted that the LL or the approximation component of the host must remain
untouched as it has the maximum energy component of the original host.
6. Once this process is done, the new HH/HL/LH must be recombined with the host LL by taking
IDWT to form the host image again.
7. This step gives us the final watermarked image. MSE or correlation coefficient of watermarked
image w.r.t. original host can give us an estimate of the quality of watermarking.
8. In order to retrieve the secret image, the DWT of the host needs to be taken first.
9. This must be followed by re-extraction of the alternate pixels of the secret images LL
component.
10. This retrieved LL component can be combined with other secret image components with
IDWT to obtain the retrieved secret image.
11. Again, MSE and correlation coefficient can be calculated in order to get an estimation of how
successful the retrieval is.

Application:
1. Visible logo watermarking for copyrights and important documents
2. Invisible watermarking for copyright protection and image hiding

(b) Lossy Image Compression


1. It removes visually irrelevant data.
2. There is always a loss of information.
3. Erms is never equal to zero
4. It is irreversible
5. Compression ratio can be very large
6. Used in speech and images
7. Lossy compression is most commonly used to compress multimedia
data (audio, video, and still images), especially in applications such as
streaming media and internet telephony.
Methods for lossy compression:
Reducing the color space to the most common colors in the image. The selected colors
are specified in the color palette in the header of the compressed image. Each pixel just
references the index of a color in the color palette. This method can be combined with
dithering to avoid posterization.
Chroma subsampling. This takes advantage of the fact that the human eye perceives
spatial changes of brightness more sharply than those of color, by averaging or dropping
some of the chrominance information in the image.
Transform coding. This is the most commonly used method. In particular, a Fourier-
related transform such as the Discrete Cosine Transform (DCT) is widely used.

(c) Hadamard Transform


Inverse 1-D Hadamard
Transform

--Real, Symmetric, and orthogonal: H=H*=HT= H-1


Ultra Fast Transform (1)
GoodVery Good energy compactness
(d) Content Based Image Retrieval
Objective:
The main objective of CBIR is to match the results of an image-centric search with the query
image. The results are typically obtained using robust matching and mining techniques. This
enables the user to match the image with several images in the database and retrieve similar
relevant information from it. It is specifically helpful when associated text of an image is
unavailable; direct image search can especially benefit the user.

Different Methods :
Different methods of CBIR include:
1. Correlation coefficient technique
2. Colour models:
1. RGB colour space based Euclidean distance
2. RGB colour space based Minkowskis distance
3. HSV colour space based Euclidean distance
4. HSV colour space based Minkowskis distance
5. YUV colour space based Euclidean distance
6. YUV colour space based Minkowskis distance
3. Feature Extraction based on wavelets and frequency domain components
Among the above stated methods, RGB colour space based Euclidean distance method is chosen
for its simplicity and accuracy in results
Algorithm:
1. Just like any other search technique, the first step is always to create a lengthy database. This
will enable the user to search from a wider range and types of images.
2. Once the database is formed, the query image is taken from the user as input.
3. The inputs R, G, and B planes are split and a mean distance is calculated with each image of
the database one after the other.
4. The Euclidean distance can be calculated by:
Dist = (a12 a22)0.5 where a1 and a2 are the data sets (in this case images)
5. Minimum distance indicated the maximum match between the query image and the image in
the database
6. Display best N results to complete the search.
Applications:
1. Image Mining
2. DNA search
3. RBC/WBC count and detection of deterioration
4. Tuberculosis detection in healthy cells
5. WBC mutation study

(e) Region Based Segmentation


The main goal of segmentation is to partition an image into regions. Some segmentation methods such as
"Thresholding" achieve this goal by looking for the boundaries between regions based on discontinuities
in gray levels or color properties. Region-based segmentation is a technique for determining the region
directly. The basic formulation for Region-Based Segmentation is:
1. i=1 n Ri=R

2. Ri ist h e connected region ,i=1 , 2, .,n

3. Ri Rj=,i=1,2, n
4. P(Ri)=TRUE, i=1,2.n
5. P(Ri Rj =FALSE for any adjacent regi on Ri and Rj

P (Ri)is a logical predicate defined over the points in set P (Rk)and is the null set.

(a) means that the segmentation must be complete; that is, every pixel must be in a region.

(b) requires that points in a region must be connected in some predefined sense.

(c) indicates that the regions must be disjoint.

(d) deals with the properties that must be satisfied by the pixels in a segmented region.

Techniques used can be:

1. Region Growing

2. Region Split and Merge.

----------------The End---------------
A particular digital image with 8 quantization level has following histogram. Perform histogram
equalization.

Grey Level 0 1 2 3 4 5 6 7
No. of Pixels 790 102 850 656 329 245 122 81
3
Solution:Given L= 8 quantization levels. ( L1 )=7

Grey Level No. of Pixels Pr = Cumulative Prob. (L-1)* S Rounding Off


r n n S
N
0 790 0.19 0.19 1.33 1
1 1023 0.25 0.44 3.08 3
2 850 0.21 0.65 4.55 5
3 656 0.16 0.81 5.67 6
4 329 0.08 0.89 6.23 6
5 245 0.06 0.95 6.65 7
6 122 0.03 0.98 6.86 7
7 81 0.02 1.00 7 7
N = n = 4096
Now we take 1st, 2nd, and last column for finding new grey levels.

Old Grey Level No. of Pixels New Grey Level


r n
0 790 1
1 1023 3
2 850 5
3 656 985 6
4 329 6
5 245 7
6 122 448 7
7 81 7
Hence, the equalized histogram is:
Grey Level 0 1 2 3 4 5 6 7
No. of Pixels 0 790 0 102 0 850 985 448
3

Original Histogram Equalized Histogram


Grey Level No. of Pixels Grey Level No. of Pixels

1023 985
1023
790 850
790 850
656
448
329
245
122 81 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
0 0 0

Consider the image given below. Calculate the direction of the edge at the centre point of the image.

[ ]
50 60 70
f= 5 50 80
7 9 50

Solution:

Using Prewitts Mask Using Sobels Mask

[ ] [ ]
1 1 1 1 2 1
X-direction (Fx) 0 0 0 X-direction (Fx) 0 0 0
1 1 1 1 2 1

[ ]
1 0 1

[ ]
1 0 1
1 0 1 Y-direction (Fy) 2 0 2
Y-direction (Fy)
1 0 1 1 0 1

Applying the above masks at the centre


Applying the above masks at the centre
point of the image we get gradients as:
point of the image we get gradients as:
Gx = (-50 60 70 + 7 + 9 + 50) = -114
Gx = (-50 120 70 + 7 + 18 + 50)
Gy = (-50 5 7 + 70 + 80 + 50) = 138
= -165
Gradient direction Gy = (-50 10 7 + 70 + 160 + 50)
Gy 138 = 213
=tan1 =tan1 =50.44 Gradient direction
Gx 114
Gy 213
=tan1 =tan1 =52.24
Edge direction = 90 = Gx 165
50.44 90 Edge direction = 90 =

=140.44 39.56 52.24 90

=142.24 37.76
[Note: Solve by using any one of the above mask.]

Given an input image f of size 3X 3. Find the filtered image using median filter mask as given below:

R1 R2 R3 0 1 0
R= R4 m=
R5 R6 1 1 0
R7 R8 R9 0 1 0
Solution:

Note: If the students have taken mask as:

[ ]
0 1 0
m= 1 1 0
0 1 0

Consider the image with virtual rows and columns having repeated border pixels.
Hence the image would become:

[ ]
3 3 2 1 1
3 3 2 1 1
f= 5 5 2 6 6
7 7 9 1 1
7 7 9 1 1

R1 = Median {3, 3, 3, 5} = 3 R2 = Median {2, 3, 2, 2} = 2.5


R3 = Median {1, 2, 1, 6} = 1.5 R4 = Median {3, 5, 5, 7} = 5
R5 = Median {2, 5, 2, 9} = 3.5 R6 = Median {1, 2, 6, 1} = 1.5
R7 = Median {5, 7, 7, 7} = 7 R8 = Median {2, 7, 9, 9} = 8
R9 = Median {6, 9, 1, 1} = 3.5
The filtered image would be:

[ ]
3 2.5 1.5
R= 5 3.5 1.5
7 8 3.5

Note: If the students have taken mask as:

[ ]
0 1 0
m= 1 1 1
0 1 0

Consider the image with virtual rows and columns having repeated border pixels.
Hence the image would become:

[ ]
3 3 2 1 1
3 3 2 1 1
f= 5 5 2 6 6
7 7 9 1 1
7 7 9 1 1

R1 = Median {3, 3, 3, 2, 5} = 3 R2 = Median {2, 3, 2, 1, 2} = 2


R3 = Median {1, 2, 1, 1, 6} = 1 R4 = Median {3, 5, 5, 2, 7} = 5
R5 = Median {2, 5, 2, 6, 9} = 5 R6 = Median {1, 2, 6, 6, 1} = 2
R7 = Median {5, 7, 7, 9, 7} = 7 R8 = Median {2, 7, 9, 1, 9} = 7
R9 = Median {6, 9, 1, 1, 1} = 1
The filtered image would be:

[ ]
3 3 1
R= 5 5 2
7 7 1

Find the arithmetic code word of the message: INDIA

Calculate the percentage of compression and Bits Per Pixel (BPP) of the compressed message.

Solution:

Symbols Probability
I 0.4
N 0.2
D 0.2
A 0.2
Step-1 : To find interval for first character I
Now, Interval is [ 0.0 to 1.0 ]
Lower range value = 0
Upper range value = 1
No of sub-intervals = 5
UpperLower 1.00.0
intervalStepValue= = =0.2
No . of intervals 5

Interval for Character I is [ 0.0 to 0.4 ]


Step-2 : To find interval for Second character N
Now, Interval is [ 0.0 to 0.4 ]
UpperLower 0.40.0
intervalStepValue= = =0.08
No . of intervals 5

Interval for Character N is [ 0.16 to 0.24 ]


Step-3 : To find interval for Second character D
Now, Interval is [ 0.16 to 0.24 ]
UpperLower 0.240.16
intervalStepValue= = =0.016
No . of intervals 5

Interval for Character D is [ 0.208 to 0.224 ]

Step-4 : To find interval for Second character I


Now, Interval is [ 0.208 to 0.224 ]
UpperLower 0.2240.208
intervalStepValue= = =0.032
No . of intervals 5

Interval for Character I is [ 0.208 to 0.2144 ]

Step-5 : To find interval for Second character A


Now, Interval is [ 0.208 to 0.2144 ]
UpperLower 0.21440.208
intervalStepValue= = =0.00128
No . of intervals 5
Interval for Character A is [ 0.21312 to 0.2144 ]

Arithmetic Codeword for the Message INDIA is [ 0.21312 ]

Size of input message INDIA is 5 characters * 8 bits = 40 bits


Since arithmetic codeword is floating point,
Size of coded message = 4 bytes = 32 bits
Input Message x 100
Percentage of compression = Input Mess age Message

4032
=
x 100 =20
40

Compresses Messagebits 32
Bits Per Pixel (BPP) =
= =6.4 BPP
Total Number of Pixels 5

Find the arithmetic code word of the message: HELLO


Calculate the percentage of compression and Bits Per Pixel (BPP) of the compressed message.
Solution:

Symbols Probability
H 0.2
E 0.2
L 0.4
O 0.2

Characters Step1 Step2 Step3 Step4 Step5


Upper 1.0 0.2 0.08 0.072 0.0688
Value

O 0.8- 0.16-0.2 0.072-0.08 0.0688-0.072 0.06752-0.0688


1.0
L 0.4- 0.08-0.16 0.056-0.072 0.0624-0.0688 0.06496-0.06752
0.8
E 0.2- 0.04-0.08 0.048-0.056 0.0592-0.0624 0.06368-0.06496
0.4
H 0.0- 0.0-0.04 0.04-0.048 0.056-0.0592 0.0624-0.06368
0.2
Lower 0.0 0.0 0.04 0.056 0.0624
Value

Step-1 : To find interval for first character H

Now, Interval is [ 0.0 to 1.0 ]


Lower range value = 0
Upper range value = 1
No of sub-intervals = 5
UpperLower 1.00.0
interval StepValue= = =0.2
No .of intervals 5

Interval for Character H is [ 0.0 to 0.2 ]

Step-2 : To find interval for Second character E


Now, Interval is [ 0.0 to 0.2 ]
UpperLower 0.20.0
interval StepValue= = =0.04
No .of intervals 5

Interval for Character E is [ 0.04 to 0.08 ]


Step-3 : To find interval for third character L
Now, Interval is [ 0.04 to 0.08 ]
UpperLower 0.040.08
interval StepValue= = =0.008
No .of intervals 5

Interval for Character L is [ 0.056 to 0.072 ]

Step-4 : To find interval for fourth character L


Now, Interval is [ 0.056 to 0.072 ]
UpperLower 0.0720.056
interval StepValue= = =0.0 0 32
No .of intervals 5

Interval for Character L is [ 0.0624 to 0.0688 ]

Step-5 : To find interval for fifth character O


Now, Interval is [ 0.0624 to 0.0688 ]
UpperLower 0.06880.0624
interval StepValue= = =0.00128
No .of intervals 5

Interval for Character O is [ 0.06752 to 0.0688 ]

Arithmetic Codeword for the Message INDIA is [ 0.06752 ]

Size of input message HELLO is 5 characters * 8 bits = 40 bits


Since arithmetic codeword is floating point,
Size of coded message = 4 bytes = 32 bits
Input Message x 100
Percentage of compression = Input Message Message

4032
=
x 100 =20
40

Compresses Messagebits 32
Bits Per Pixel (BPP) =
= =6.4 BPP
T otal Number of Pixels 5

Das könnte Ihnen auch gefallen