HW 5, Problems 5.3
EECS 203A, UCI, Fall 2004
by Nasser Abbasi
Question
TextBook: Digital Iage Processing, 2nd edition. By Gonzalez and Woods.
The white bars in the test pattern shown below are 7 pixels wide and 210 pixels high. The separation between bars is 17 pixels. What would this image look like after application of
(a) 3x3 Harmonic mean filter?
(b) 7x7 HMF?
(c) 9x9 HMF?
Answer
HMF is given by whereis the image data under the filter.
Load the original Image and display it first. I downloaded the image from the text book website, and used InfranView to get the image information to find how many pixels the whole image is, then read in into Mathematica to display it.
Since some pixels can have gray level of zero, and for HMF we can not have this, so add a 1 to all pixel values, then after processing, subtract a 1 and plot the image then.
In[3]:=
Out[8]=
In the original image,the vertical white bars look like this (displaying the top end of the white bar) we see that the white bar top starts at row number 24,we see that the strip is 7 pixels wide.
3x3 processing
Now construct each ARM filter, and apply them to the above image
In[9]:=
Out[11]//MatrixForm=
Filter the image with HMF3 and display
Out[18]=
Show the top edge of the white bar BEFORE processing
In[19]:=
Out[19]=
Show the top edge of the white bar AFTER processing
In[20]:=
Out[20]=
After applying the 3x3 filter, the white bar would blur to the
So we see that the white bar is 5 pixels wide, and has 2 rows at the top and at the bottom by symmettry), hence it will be of 206 pixels high. So white strips are more narrow.
7x7 HMF
In[21]:=
Out[24]=
Show the top of the white strip. Now how much more thin it is
In[25]:=
Out[25]=
We see that now the white bar is only 1 pixel wide, and lost 4 rows at the top and 4 rows at the bottom, so it is now 202 pixels high. we see now the white strips are very narrow.
9x9 HMF
In[26]:=
Out[29]=
Out[30]=
In[32]:=
Out[32]//MatrixForm=
We see that the adges now much smother, but the image have become more dark.
3D plots
I'll now display the 3 images in 3D to better illustrat the filter result. I will only plot the region near the end of the top of the first white strip.
Created by Mathematica (November 16, 2004)