HW 5, Problems 5.4
EECS 203A, UCI, Fall 2004
by Nasser Abbasi
Question
TextBook: Digital Image 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 contraharmonic mean filter with Q=1?
(b) 7x7 ?
(c) 9x9 ?
Answer
CMF 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.
In[18]:=
Out[23]=
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 Filter
Now construct each ARM filter, and apply them to the above image
In[24]:=
Out[26]//MatrixForm=
Filter the image with HMF3 and display
In[31]:=
Out[34]=
Show the top edge of the white bar BEFORE processing
In[35]:=
Out[35]=
Show the top edge of the white bar AFTER processing
In[46]:=
Out[46]=
After applying the 3x3 filter, the white bar would blur to the
Look at the data before:
In[43]:=
Out[43]//MatrixForm=
Look at the data after filtering
In[44]:=
Out[44]//MatrixForm=
So we see that the white bar is 9 pixels wide, and has added 2 rows at the top and at the bottom by symmetry), hence it will be of 214 pixels high. So white strips are more narrow.
7x7 Filter
In[47]:=
Out[50]=
Show the top of the white strip. Now how much more thick it is
In[55]:=
Out[55]=
In[54]:=
Out[54]//MatrixForm=
We see that now the white bar is 13 pixel wide, and added 4 rows at the top and 4 rows at the bottom, so it is now 218 pixels high. we see now the white strips are very narrow.
9x9 HMF
In[71]:=
Out[71]=
In[70]:=
Out[70]//MatrixForm=
We see that now the white bar is much wider, it is 15 pixel wide, and added 7 rows at the top and 7 rows at the bottom, so it is now 224 pixels high.
3D plots
I'll now display the 3 images in 3D to better illustrate the filter result. I will only plot the region near the end of the top of the first white strip.
In[84]:=
Out[84]=
Out[85]=
Out[86]=
Out[87]=
Created by Mathematica (November 15, 2004)