chapter - 2 : image enhancementimage enhancement refers to sharpening of image features such as...
TRANSCRIPT
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
15
15
The principal objective of enhancement technique is to process a given image so that the result is more suitable than the original image for a specific application. Image Enhancement refers to sharpening of image features such as edges, boundaries or contrast to make a graphic display more useful for display and analysis. Image enhancement includes gray level and contrast manipulation, noise reduction, edge-sharpening, filtering, interpolation, magnification, pseudo-coloring and so on. The enhancement process does not increase the inherent information content in the data. But it does increase the dynamic range of the chosen feature so that they con be detected easily.
------------------------------------------------------------------------------------------------------- Q(1) Explain in detail enhancement techniques in spatial domain used for
images. (10M Dec05 IT) (10M Dec.04 I.T)
The principal objective of enhancement technique is to process a given image so that the result is more suitable than the original image for a specific application. Image Enhancement Techniques are mainly classified into two broad categories– (i) Spatial domain method and (ii) Frequency domain method
Spatial Domain Methods are as follows:-
a) Enhancement by point operations –
1) Contrast Stretching 2) Clipping & Thresholding 3) Digital Negative 4) Intensity Level Slicing 5) Bit Level Slicing 6) Histogram Modeling : Histogram Equalization and Specification
Chapter - 2 : IMAGE ENHANCEMENT
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
16
16
b) Spatial Filtering
1) Low pass filtering 2) Weighted Average Filter 3) Median filtering 4) High pass filtering 5) High Boost filtering 6) Derivative filters 7) Magnification and zooming
Refer .. . . .
Q(2) What are the different reasons for poor contrast? (3M May03 BE Etrx) Q(3) Obtain the gray level transformation function that stretches gray scale
range (0, 10) into (0, 15) shifts range (10,20) to (15,25) and compress range (20,30) into (25,30).
Q(4) Explain the technique of contrast intensification. If the gray level intensity changes are to be made shown in figure below, derive the necessary expression for obtaining new pixel value using the slope. Draw freq. Tables for original and new image and discuss the resulting changes in original image.
Q(5) A detail Enhancement Techniques is performed as per following criteria:
⎥⎦
⎤⎢⎣
⎡ ≤≤=
otherwiserr
s537
where r and s are the intensities for the input and output image respectively. Determine the output image when, detail enhancement techniques is applied on following:- (12M Dec05 Comp)
2 3 4 2 5 5 2 4 3 6 3 5 5 3 5 5
0 1 0 2 1 6 2 3 5 5 1 6 2 4 4 3 2 1 1 3 5 3 0 1 2 1 2 6 6 2
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
17
17
Q(6) A 4 x 4 image that uses 4 bits to represent pixels is shown below.
I
Max γ
I2
β
α I1
0 m1 m2 Max
(a) Draw Frequency table showing intensities mi and number of pixels having gray level ‘I’.
(b) Perform Contrast Stretching using the equations and find new image. Assume α = ϒ = 1 β = 2 m1 = 5 and m2 = 10.
(c) Draw a new frequency table and comment on the performance.
Q(7) Explain in detail following image enhancement technique in spatial domain. (20M Dec06 IT) (a) Image Negative (d) High Pass Filter (b) Bit Plane Slicing (e) Low Pass Filter (c) Contrast Stretching (f) Median Filter
Q(8) Explain Image Averaging and Image Subtraction. (5M Dec06 Comp)
(8M Dec 04 Comp)
Q(9) For the 3 bit 4x4 size image perform following operations: [10 M , MAY 07 , ETRX] (10M May 07 I.T.)
(a) Negation (b) Thresholding with T=4 (c) Intensity level slicing with background with
r1=2 and r2= 5 (d) Bit plane slicing for MSB and LSB plane (e) Clipping with r1=2 and r2=5
10 3 12 8
11 13 9 6
5 4 3 5
8 10 10 7
2 1 3 4 5 7 4 2 0 1 3 5 1 4 6 0 4 0 2 3 2 1 6 1 4
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
18
18
Solution : (a) Negation: Output Image =
(b) Thresholding with T = 4
Thresholding Tx is given by ⎥⎦
⎤⎢⎣
⎡ =≥=
otherwiserTrif
s47
Output Image =
(c) Intensity level slicing with background
It is defined as , ⎥⎦
⎤⎢⎣
⎡ ≤≤=
otherwiserrif
s527
Output Image =
(d) Bit Plane Slicing
Bit planes of Input Image:
B2 Bit Plane (MSB) B1 Bit Plane B0 Bit Plane (LSB)
5 6 4 3 2 0 3 5 7 6 4 2 6 3 1 7 3 7 5 4 5 6 1 6 3
0 0 0 7 7 7 7 0 0 0 0 7 0 7 7 0 7 0 0 0 0 0 7 0 7
7 0 7 7 7 7 7 7 0 1 7 7 1 7 6 0 7 0 7 7 7 1 6 1 7
0 0 0 1 1 1 1 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 0 1
0 1 1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0 1 0 1 0
1 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0 0
S = 7 – r
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
19
19
Bit plane slicing is defined as ⎥⎦
⎤⎢⎣
⎡ −=
otherwiserbif
s n 17
Applying Bit plane slicing for MSB and LSB plane we get,
MSB Output LSB Output
e) Clipping with r1 = 2 and r2 = 5
S (i) To find slope B
7 33.237==B
(ii) To find s for 2 < r < 5
B (r, s) 20
−−
=rsB
S = B (r – 2) 0 2 5 7 Put B = 7/3
Clipping Tx is given by,
⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢
⎣
⎡
≤≤<≤<≤
−=755220
7
)2(37
0
rrr
rS
Output Image =
7 0 7 0 0 7 0 7 0 0 7 0 0 0 7 0 0 0 7 7 7 0 7 0 0
0 0 0 7 7 7 7 0 0 0 0 7 0 7 7 0 7 0 0 0 0 0 7 0 7
0 0 2 5 7 7 5 0 0 0 2 7 0 5 7 0 5 0 0 2 0 0 7 0 5
)2(37
−= rS
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
20
20
Q(10) What do you understand by Gamma correction – Explain (6M May06 Comp)(5M Dec 04 Comp)
(i) Most of the input and output devices such as image capturing, printing and display devices respond according to a power law.
(ii) The exponent “ γ “ in the power law equation is referred to as gamma.
(iii) This process used to correct this power law response phenomena is called gamma correction.
(iv) For example, Cathode Ray Tube (CRT) devices have intensity to voltage response that is a power function with γ varying from approximately 1.8 to 2.5.
(v) Such display system tends to produce images that are darker than intended. Gamma correction can be applied to solve such problems.
(vi) Gamma correction method is as follows : First process the input image with s = c rγ.
Then display the image on the CRT. (vii) When gamma corrected image is displayed on the screen, the output
device is close in appearance to the original image. Refer …
Q(11) Write short note on Thresholding (5M Dec 04 Comp) Q(12) Plot the histogram for the following image. Perform
Histogram equalization and then plot the equalized histogram and give histogram equalized image. (8M Dec 04 Comp)
Q(13) Grey level histogram of an image is given below, Compute histogram
equalization. Draw the histogram of input & output image. (8M May 06 I.T)
1 1 5 3 3 1 2 6 6 7 1 4 0 6 2 4 4 2 5 2 7 4 0 2 2
GREY LEVEL 0 1 2 3 4 5 6
7
FREQUENCY 790 1023 850 656 329 245 122 81
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
21
21
Q(14) The gray level distribution of an 8-level image of 64 x 64 size is
specified under two different contrast conditions by two histogram A and B as given below. Modify the histogram A as given in histogram B. Modify above histogram such that the desired distribution is as follows, (10M Dec05 IT)
Histogram (A)
Histogram (B)
Q(15) What information can be obtained from histogram of an image? (4M May06 Etrx)
Q(16) A digital image with 8 quantization levels is given below. f(x,y)=|i-j| for i,j = 0,1,2,3,4,5,6,7. Perform Histogram Equalization. Derive the Transformation function and draw new histogram. (10M Dec05 Etrx)
Grey Level rk 0 1 2 3 4 5 6
7
No. of pixel Nrk 790 1023 850 656 329 245 122 81
Grey Level Zk 0 1 2 3 4 5 6
7
No. of pixel Nzk 0 0 0 614 819 1230 819 614
0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7 1 1 0 1 2 3 4 5 6 2 2 1 0 1 2 3 4 5 3 3 2 1 0 1 2 3 4 4 4 3 2 1 0 1 2 3 5 5 4 3 2 1 0 1 2 6 6 5 4 3 2 1 0 1 7 7 6 5 4 3 2 1 0
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
22
22
Q(17) Suppose that a digital image is subjected to histogram evaluation. Show that a second pass of histogram equalization will produce exactly the same result as the first pass. (10M May05 Comp)
Q(18) For continuous image histogram can be perfectly equalized but it may not be so for a digital image, justify. (4M May06 Etrx)
Q(19) Explain Zooming of an Image. Does it increase the information content of
an image?
Q(20) Perform Zooming on the following Image by Replication and Linear Interpolation. Is the result Same in both the cases ? (10M Dec 04 Comp)
( Spatial Filtering ) Q(21) Explain Filtering in Spatial Domain. (10M Dec05 IT) (10M Dec 04 Comp)
The use of spatial masks for image processing is called spatial filtering and the masks are called spatial filters.
For example consider digital sub-image I and 3x3 filter mask w :
The response of a linear mask is, R = w1z1 + w2z2 + ………..+w9z9
If the center of the mask is at location (x,y) in the image, the gray level of the pixel located at (x,y) is replaced by R. The mask is then moved to the next pixel location in the image and the process is repeated. This continues until all pixel locations have been covered. Refer …
1 2 5 2 1 2 3 4 1 2 4 1 3 1 1 4 2 5 1 1 1 1 7 1 3
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
23
23
Q(22) Four different transfer functions/operators are given below. If these are operated on a large digital image repeatedly many times (say infinite times) what will be the final image ?. Give proper reasoning for your answer.
255 255 220
30
0 100 255 0 100 200 255
(A) Thresholding (B) Contrast Stretching
Lmax 1 9
0 255
(C) Low Pass Filter Mask (D) Image Transformation
Solution :
a) Thresholding
(i) Thresholding Transformation is defined as,
(ii) In first pass, all the input pixels greater than 100 will get changed to 255 and the remaining pixels will get changed to 0. This gives binary image.
(iii) After first pass, thresholding operation gives binary image with only
two distinct pixel values: “0” and “255” (iv) In second pass, input image is binary image. Thresholding operation
gives the same result.
That means, when thresholding operation is repeatedly applied, there is no change in the output image obtained after the first pass.
(v) Thresholding Transformation gives only one type of output image.
1 1 1
1 1 1
1 1 1
Slope -1/2 Lmax/2
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
24
24
-------------------------------------------------------------------------------------------------
b) Contrast Stretching
(i) The Linear Contrast Stretching Transformation function is defined as,
Where
By substituting, we get,
(ii) Each time, contrast stretching transformation will produce the following output.
Case -1 When 1000 ≤≤ r The output S < r i.e. output pixel amplitude will be smaller than input pixel amplitude Case -2 When TThresholdr ≤≤100 The output S < r
i.e. output pixel amplitude will be smaller than input pixel amplitude Case -3 When Threshold T 200≤≤ r The output S > r
i.e. output pixel amplitude will be Larger than input pixel amplitude
Case -4 When 255200 ≤≤ r The output S > r i.e. output pixel amplitude will be Larger than input pixel amplitude
To find Threshold T:
That means,
When 1770 ≤≤ r The output S > r
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
25
25
When 177>r The output S < r
(iii) When contrast stretching transformation is repeatedly applied, all the input pixels will get reduced further in the output image. After n successive applications the pixel value will become “0”.
(iv) Similarly all the input pixels will get amplified in the output image. After n successive applications, the pixel value will become “255”
(v) That means after n repeated applications of the contrast stretching
transformation function, we get an image having only two grey levels. This is Binary Image.
-------------------------------------------------------------------------------------------------
c) Low Pass Filter
(i) LPF attenuates High Frequency components by distributing its energy in all 8 directions using averaging of neighbouring pixels.
(ii) LPF averaging mask is given by
Consider a Digital Impulse Image F.
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
.....
.....
..81..
.....
.....
F
The output of LPF is given by
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
.....
.999.
.999.
.999.
.....
1L
Due to averaging, the amplitude of distinct pixels reduces. (iii) After second pass,
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
1232124642369632464212321
2L L P F L1
L P F F
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
26
26
(iv) The difference between neighbouring pixels gets further reduced, i.e.
high frequency components get further suppressed. (v) By repeatedly applying Low Pass filtering, a stage will come when all
pixel values will become equal and the image will become Low Pass Flat Image.
Q(23) Can Median Filter reduce noise? Explain in detail with example the situation where it is most effective. (5M)
Q(24) Define the following Spatial filters:
1) Median 2) Min 3) Max Consider the digital Image. Calculate the value at pt g(2,2) = 7 (5M May05 Comp)
Solution :
At (2,2); i) Median filter: The response of median filter at (2,2) is given by
ii) Max Filter
iii) Min Filter
Q(25) Show that High pass = Original – Low pass. (12M May06 I.T) (10M May05 Comp ) (4 M ,MAY 07, ETRX)
Q(26) Explain operation and application of each of the following; Give 3x3 mask
wherever applicable 1) Low pass filter (2M May06 Etrx) 2) Median filter (2M May06 Etrx)
0 1 0 6 7 2 0 1 6 5 1 1 7 5 6 1 0 6 6 5 2 5 6 7 6
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
27
27
Q(27) The 3x3 matrix shown below is frequently used to compute the derivative in x direction at each point in an image. Give an ALU procedure to implement this operation. (10M Dec05 Etrx)
Solution”: Consider a Digital Subimage as shown in figure below : Mask (Given ) The response of the filter is given by, Z5 = W5Z5 + W4Z4 + W1Z1 + W2Z2 + W3Z3 + W6Z6 + W7Z7 + W8Z8 + W9Z9 .
ALU procedure :
Buffer A Buffer B ------- Multiply A with W5
Shift Right ------- ------- Add A * W4
Shift Down ------- ------- Add A * W1
Shift Left ------- ------- Add A * W2
Shift Left ------- ------- Add A * W3
Up ------- ------- Add A * W6
Up ------- ------- Add A * W9 Right ------- ------- Add A * W8 Right ------- ------- Add A * W7 Down -------
Left
-1 -2 -1 0 0 0 1 2 1
Z1 Z2 Z3 Z4 Z5 Z6 Z7 Z8 Z9
W1 W2 W3W4 W5 W6W7 W8 W9
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
28
28
Q(28) Given below is 5x5 image. Operate on the central 3x3 pixels by low pass
and high pass filter masks and obtain 3x3 images as outputs. (12M May06 Etrx)
6 5 12 12 3 14 12 13 10 9 10 15 4 10 6 8 3 7 4 7 8 3 10 8 5
Q(29) Write Short Notes on: (a) Filtering in the Spatial and Frequency Domains. (5M Dec06 Comp)
(b) Smoothing and sharpening Filters. (6M May06 Comp) Q(30) Justify /Contradict the following statements: (a) For digital images having salt pepper noise , median filter is the best filter (6M May06 Comp) (b) Laplacian is better than gradient for detection of edges. (6M May06 Comp) Q(31) State whether True or False. Hence justify
(a) Image can be obtained if histogram is given (4M)
(b) Histogram equalization and Linear contrast stretching always give the same result. (4M)
Q(32) Show that: (4M each , MAY 07 , ETRX) (a) Poorly illuminated images can be easily segmented. (b) Laplacian is not a good edge detector.
Q(33) Justify/contradict following statements. (20M Dec.04 I.T) (a) Enhancement process does not change the information content of image. (b) For digital image having salt paper noise, median filter is the best filter. (c) For continuous image histogram can be perfectly equalized, but it may
not be so for digital image. (d) Quality of pictures depends on the number of pixels and gray level that
represent the picture.
Using these outputs verify Original Image = LPF Image + HPF Image. In case of discrepancy explain the reasons
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
29
29
(f) Median filter is the best solution to remove salt and pepper noise (4M MAY – 07 IT) Q(34) TRUE OR FALSE and justify (each) (3M May06 Etrx) [a] Histogram is a unique representation of an image . [b] Second pass of histogram equalization will produce exactly the same
result as the first pass. [c] The principal function of median filter is to force points with distinct
intensity to be more like their neighbors. Q(35) Show that: (4M each , MAY 07 , ETRX) (a) Poorly illuminated images can be easily segmented.
Poorly illuminated images can not be easily segmented as segmentation is based on one of two basic properties of gray level values : discontinuity and similarity. In the first category, the approach is to partition an image based on abrupt changes in gray level. The principal areas of interest within this category are detection of isolated points and detection of lines and edges in an image. In the second category, the principal approach is thresholding, region growing and region splitting and merging. The concept of segmenting an image based on discontinuity or similarity of the gray level values of its pixels is applicable to both static & dynamic (time varying) images. As in the poorly illuminated images all the pixel have same or almost the same gray level, hence it is very difficult to decide the value of the Threshold based on which the segmentation will be done .
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
30
30
Q(36) If all the pixels in an image are shuffled, will there be any change in the histogram?
Justify your answer.
(i) If all the pixels in an image are shuffled, there will not be any change in the histogram of the image. A histogram gives only the frequency of occurrence of the gray level. Consider two images, 1 and 2, as given below:
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
5379642497538421
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
6424842197535379
Image 1 Image 2
(ii) Image 2 is obtained by shuffling the row of image 1. Their corresponding histograms are shown below.
(ii) From the two histograms, it is clear that even if all the pixels in an image are shuffled, there will not be any change in the histogram of the image.
Q(37) What is the impact of applying the following look-up table?
Index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 LUT 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15
On the 8 bit image given below:
⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
431554013510169138
12158431022121215136
121351211071301214721831162914
Solution : On applying the look-up table on the given image, we get the resultant image as
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
31
31
⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
109151010814101381112141214151210988991414151411
141410141381114814151198129131191215
By comparing the resultant image with the original image, it is obvious that the brightness of the resultant image is better than the original image.
Q(38) Given ⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
317464523
),( yxf
Find the output image g(x,y) using logarithmic Transformation
g(x,y) = 106 Log10[1+ f(x,y)]
By Logarithmic Transformation
g(x,y) = 106 Log10[1+ f(x,y)]
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
63.8231.9195.7374.0989.5874.0982.4850.5763.82
y)g(x, == By rounding == ⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
643296749074825164
Q(39) Given ⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
317464523
),( yxf
Find the output image g(x,y) using Power Law Transformation 2]),([),( yxfyxg =
By Power Law Transformation 2rs = where r and s are normalized input and output
image pixel values.
To find Normalized input image pixel values, divide every input image pixel value by max value.
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
32
32
Here max pixel value is 7. So, 7
),( yxfr =
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
428.0143.01571.0857.0571.0714.0286.0428.0
),( yxfNormalized
By Power Law Transformation 2rs = we get,
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
183.020.01326.0734.0326.0509.0081.0183.0
),( yxgimageoutputNormalized
To find de-normalized output image pixel values, multiply every output image pixel value by max value.
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=−
117252411
),( yxgimageoutputnormalizedDe
Q(40) Explain High-boost Filtering.
(i) A high-boost filter is also known as a high-frequency emphasis filter. A high-boost
filter is used to retain some of the low frequency components to aid in the interpretation of an image.
(ii) In high-boost filtering, the input image f(m, n) is multiplied by an amplification factor
A before subtracting the low-pass image. Thus, the high-boost filter expression becomes,
(iii) High-boost = A f(m, n) – low pass Adding and subtracting 1 with the gain factor, we get High-boost = (A - 1) f(m, n) + f(m, n) – low pass But f(m, n) – low pass = high pass Substituting this in the above equation, we get High boost = (A-1) x f(m, n) + high pass
Q(41) State whether True or False. Hence justify.
(a) Image can be obtained if histogram is given : TRUE
(b) Histogram equalization and Linear contrast stretching always give the same result. FALSE
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
33
33
( c) Enhancement process does not change the information content of image. TRUE
(d) For digital image having salt paper noise, median filter is the best filter. TRUE
(e) For continuous image histogram can be perfectly equalized, but it may
not be so for digital image. TRUE (f) Quality of pictures depends on the number of pixels and gray level that
represent the picture. TRUE
(g) Median filter is the best solution to remove salt and pepper noise TRUE (h) Histogram is a unique representation of an image . FALSE
(i) Second pass of histogram equalization will produce exactly the same
result as the first pass. TRUE
(i) The principal function of median filter is to force points with distinct intensity to be more like their neighbors. TRUE
Q(42) Explain Zooming of an Image. Does it increase the information content of an image?
Zooming means magnifying the SIZE of the image. Zooming operation increases the physical dimension of the image in Horizontal, vertical or in both direction.
Zooming increases the size of the image horizontally by repeatedly displaying the original information of the image. It does not add any extra information into it.
There are two methods of zooming – Replication and Interpolation.
(1) REPLICATION : - Replication is a zero order hold where each pixel along a scan line is repeated and then each scan line is repeated. This is equivalent to taking M x N image and interlacing it by rows and columns of zerus to obtain a 2 M x 2N matrix an convolving the result with an away H defined as
⎥⎦
⎤⎢⎣
⎡=
1111
H
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
34
34
(2) LINEAR INTERPOLATION : - Linear interpolation is a first order hold where a straight line is first fitted in between pixels along a row. Then pixels along each column are interpolated along a straight line.
For ex. 2 x 2 magnification linear - interpolation along ROW gives
g1 (x, 2y) = f (x, y)
g1 (x, 2y + 1) = ½ [ f (x, y) + f (x, y + 1) ] 0 ≤ x ≤ M - 1
0 ≤ y ≤ N - 1
Linear interpolation along column given,
g2 (2x, y) = g1 (x, y)
g2 (2x + 1, y) = ½ [ g1 (x, y) + g1 (x1 + 1, y) ]
It is assumed that input image is zero outside [ O , N –1] x [ O , N –1 ].
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
12
24
75.15.3
5.13
5.11
32
5.25.1
21
= By Rounding
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
12
24
24
23
21
32
32
21
ANS
Zero Column
Interpulate Rows
Zero Column
⎥⎦
⎤⎢⎣
⎡4321
⎥⎦
⎤⎢⎣
⎡04030201
⎥⎦
⎤⎢⎣
⎡245.33125.11
Interpulate Column
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
02
04
05.3
03
01
02
05.1
01
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
35
35
Q(43) Perform Zooming on the following Image by Replication and Linear Interpolation. Is the
result Same in both the cases ? (10M Dec 04 Comp)
Solution : Step I Interpolate ROWS
(1) In each ROW, Insert alternate ZERO between every two elements
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
03010701010101050204010103010402010403020102050201
(2) Interpolate ROWS by averaging neighbouring pixels in Horizontal Direction
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
5.13214741115.0111355.32345.011123215.24
125.115.245.335.225.015.125.355.325.11
Step II Interpolate COLUMNS
(1) In each COLUMN, Insert alternate ZERO between every two elements
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
00000000005.1321474111
00000000005.0111355.3234
00000000005.011123215.24
0000000000125.115.245.335.220000000000
5.015.125.355.325.11
1 2 5 2 1 2 3 4 1 2 4 1 3 1 1 4 2 5 1 1 1 1 7 1 3
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
36
36
(2) Interpolate ROWS by averaging neighbouring pixels in Horizontal Direction
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
0.751.751.50.523.520.50.50.51.5321474111121.513.563.751.522.50.5111353.52340.51112.542.751.52.7540.511123212.540.751.51.2512.253.52.7522.53121.512.543.532.520.751.51.51.534.53.52.521.50.511.523.553.521.51
After rounding we get,
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
1221242111232147411112214642231111354234111134323411112321341211243233122134433212223543221122454221
Q(44) State and explain the features of median filtering. Complete the output of
median filter in the following cases: (8M Dec05 Comp) (a) x(n)={8 2 4 3 4} and w={-1 0 1} (b) x(n)={2 4 8 3 2} and w={-1 0 1 2}
Solution : (a) Given x (n) { 8, 2, 4, 3, 4 }
with repeated border value we get, x (n) = 8 {8, 2, 4, 3, 4} 4 4 (i) At n=0, y(0) = 1 x(n) = 8 { 8, 2, 4, 3, 4} 4 w(n) = [-1, 0, 1] y(0) = median {8, 8, 2} = median {2, [8], 8} =[8] (ii) At n = 1, y(1) = median {8, 2, 4} = median {2, 4, 8} = [4] (iii) At n = 2, y(2) = median {2, 4, 3} = median {2, 3, 4} = [3]
IP Help Line : 9 9 8 7 0 3 0 8 8 1 www.guideforengineers.com
37
37
(iv) At n = 3, y(3) = median {4, 3, 4} = median {3, 4, 4} = [4] (v) At n = 4, y(4) = median {3, 4, 4} = [4] y(n) = {8, 4, 3, 4, 4}
(b) Given x(n) {2, 4, 8, 3, 2}
Considering repeated border values we get, x(n) = 0, 2, {2, 4, 8, 3, 2}, 2, 2 w(n) = {-1, 0, 1, 2} (i) At n = 0, y(0) = median {2, 2, 4, 8} = Average {2, 4} = [3] (ii) At n = 1, y(1) = median {4, 8, 3, 2} = median {2, 3, 4, 8} = Average {3, 4} = [3.5] (iii) At n = 2, y(2) = median {8, 3, 2, 2}
= median {2, 2, 3, 8} = Average {2, 3} = [5.5]
(iv) At n = 3, y(3) = median {8, 3, 2, 2} = median {2, 2, 3, 8} = Average {2, 3} = [2.5] (v) At n = 4, y(4) = median {3, 2, 2, 2}
= median {2, 2, 2, 3} = Average {2, 2} = [2]
Ans = y(n) = [3, 3.5, 3.5, 2.5, 2]