HW 5, Problems 5.9
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 midpoint filter?
(b) 7x7 ?
(c) 9x9 ?
Answer
Median filter 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[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 Filter
Now construct each filter, and apply them to the above image
In[9]:=
Out[11]//MatrixForm=
Filter the image with Min 3x3 and display
In[12]:=
Out[13]=
Show the top edge of the white bar BEFORE processing
In[14]:=
Out[14]=
Show the top edge of the white bar AFTER processing
In[15]:=
Out[15]=
Look at the data before:
Look at the data after filtering
In[19]:=
Out[19]//MatrixForm=
So we see that the white bar is now is thinner it is 5 pixels wide, but there is a gradual ramp to dark around the edges.
7x7 Filter
In[20]:=
Out[22]=
Now show the top of the white strip. Look now how much more wide it is
In[23]:=
Out[23]=
In[29]:=
Out[29]//MatrixForm=
So we see that the white bar is now is thinner, it is 1 pixels wide. The strip is turning to all gray level.
9x9 Filter
In[30]:=
Out[32]=
In[33]:=
Out[33]=
In[34]:=
Out[34]//MatrixForm=
So we see that the white strips have all now changed to gray level midpoint between scale.
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 ends of the top of the first white strips.
In[39]:=
Out[39]=
Out[40]=
Out[41]=
Created by Mathematica (November 16, 2004)