Académique Documents
Professionnel Documents
Culture Documents
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
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 }
{
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
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.
2
A B={ p z p=a+b , a 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
s 2s1 70
= =
2
r 2s1 52
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 g( x , y ) = [M + U - 1] X [N + V - 1] = 3 X 4
[ ] [ ]
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
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
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.
(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
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
[ ]
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
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.
[ ][ ][ ]
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
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
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
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.
(d) deals with the properties that must be satisfied by the pixels in a segmented region.
1. Region Growing
----------------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
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:
[ ] [ ]
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
=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:
[ ]
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
[ ]
3 2.5 1.5
R= 5 3.5 1.5
7 8 3.5
[ ]
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
[ ]
3 3 1
R= 5 5 2
7 7 1
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
Compresses Messagebits 32
Bits Per Pixel (BPP) =
= =6.4 BPP
Total Number of Pixels 5
Symbols Probability
H 0.2
E 0.2
L 0.4
O 0.2
Compresses Messagebits 32
Bits Per Pixel (BPP) =
= =6.4 BPP
T otal Number of Pixels 5