Documente Academic
Documente Profesional
Documente Cultură
Author: Ying Li
Course: computer for imaging science
Problem Statement:
The main purpose of this project is to reallize a GUI program using IDL. In this
project, I reallized a program, which demo some basic digital image processing tools
with a friendly interface.
High pass filte is inverse to the low pass filter: it block the low freqency of the imput
signal and thus high pass filter can highlight the edges in image that is sharpen the
image. But on the other hand it let all the noises remain.
Band Pass Filter:
Band pass filter let seleted frequency passed and block the others.
Butterworth Filter:
The reason why we want a Butterworth filter is the sharp edge of the ideal filters. We
know that the Fourier Transform of the RECT function is a SINC function. Just
because of that, a step signal go pass a ideal filter will oscillate. The following figure
shows the oscillation of the STEP funciton passed an ideal low pass filter.
figure 1 the output signal of a step function though a ideal low pass filter
So we want a kind of filter whose edge is not so sharp. Butterworth filter is such a
kind of filter. The equation of a butterworth filter is:
| B( ) |=
1
1 + ( / c ) 2 N
3
here, N is the order of the butterworth filter. The bigger of N the sharper of the edge.
f (a ) =
i =0
ni
N tot
where g is the corrputed image obtained by passing the original image f through a
low pass filter (blurring fuction) B and adding noise to it. There are different ways to
restore a motion blurred image. Here I mentioned two methods: inverse filter and
convolve.
Inverse filter:
We can model a blurred image by
G ( , ) = B( , ) F ( , ) + N ( , )
where F is the original image, B is some kind of a low pass filter and G is our blurred
image. So to get back the original image, we would just have to convolve our blurred
function with some kind of a high pass filter H. In the ideal case, we would just
invert all the elements of B to get a high pass filter. But we know the most data in B
are 0 or near to 0. So we need to specify a threshold when the module of the data is
less than the threshold we can set it to be 1(or some value else, here I choose 1). And
get a modifyed inverse filter. From the program, we can see that when there are no
noise or very small amount of noise, the result is pretty good.
The other way is convolve the derivated blurred image with a COMB function.
The motion blur is coursed by the moving of the detector or the object within the
exposure thim T. That is:
T
f ( x. y ) = g ( x x0 (t ), y y0 (t ))dt
0
So,
f ' ( x) = g ( x) g ( x a )
g ( x) = f ' ( x) + ( x)
g ( x + a) = f ' ( x + a ) + f ' ( x ) + ( x)
g ( x + ma) = f ' ( x + la ) + ( x )
l =0
Software Design:
There are 5 modles modules in the program: Zooming Module, Filter Module,
Fourier Transform Module, Histogram Module, and motion blur restoration module.
Each module is not related very much. In order to realize different interface for
each module I use 14 Base_Widgets. I use different kind of widgets in the program:
menu, button, drop list, radio button, label, text, sliderbar, and a module dialogue
form.
1. Flowchart:
Please see it in appendix.
2. Variable Table:
main procedure:
status={whichbase, whichitem, seconditem}
A structure to indicate which module is current module, and the status of the
widgets in the bases.
Zoom module:
Rect={Rect_struct, lx, ly, rx, ry}
A structure to indicate the region of interest, lx:
x coordinate of the left_bottom
corner of rectangle, ly: y coordinate of the left_bottom
corner of the rectangle,
rx: x coordinate of the rectangel's right_top corner, ry: y
coordinate of the right_top
corner of the rectangle.
oldrect={Rect_struct, lx,ly,rx,ry}
To indicate the old rectangle to be erased as
the mouse moving.
oldbutton
A flag to indicate whether the mouse button 1
is beging pressed down now.
imagesize
size of the image
distx
The distance from the mouse to the left_bottom corner of
the rectange( which indicate
a region of interest) on x direction.
disty
The distance from the mouse to the
left_bottom corner of the rectange( which indicate
a region of interest) on y direction.
7
Rect_width
Rect_hight
Filter module:
Cutoff
bandwidth
order
3. User's Guide:
In this program,the menu bar include two menus: file and help. In file menu you can
open a gray level image of the format of JPEG.User can open a new image in every
model with any operation has been done. By choose the radio buttons, which are
always appear on the interface, user can get reach to corresponding module.
In Zooming Module, user can drag the red rectangle appearing on the image any
where of the image to see a zoomed in image on the left side. The program calculate
the position of the red rectangle to prevent it from going outside of the image.
In the Filter Module, user can choose any kind of filter supplied: low pass filter, high
pass filter, band pass filter and buttorworth low pass filter, by select from the filter
drop list. User can also decide the parameters of these fitlers: frequency cutoff, band
width and order for Butterworth filter. By choose from an other drop list, user can
decide which kind of result he want: filtered image, plot of the filter, shade surface of
the filter, the cross section of the filter.
10
11
figure5 histogram
12
13
14
Testing Procedure:
In Zooming Module, open an gray level JPEG image, is every thing ok?
Yes.
Try to drag the red rectangel, with the mouse in the rectangel, does the rectangel
move with the mouse?
Yes.
Try to drag the red rectangel, with the mouse out of the rectangel, does the rectangel
move with the mouse?
No.
Try to drag the red rectangel out of the region of the image, does the rectangle go out
side of the image?
15
No.
Try to drag the red rectangel, with the mouse in the rectangel, does the corresponded
zoomed in region of the image apear in the
other window?
Yes.
Check the 'filter radio button, does the corresponding filter module appear?
Yes.
Does the image of the result displayed in the window is correct?
Yes.
Choose an other kind of filter, does the result freshed and is it correct?
Yes.
Choose an other kind of result such as the shade surface of the fitler, does it appear
on the right position?
Yes.
Try to open a new image here, is it loaded in?
Yes.
Change to the Zoom module, is the image changed, is the size of the window
changed according to the size of the image?
Yes.
Drag the red rectangle and is every thing alright?
Yes.
Choose to histogram module, is the image and corresponding histogram displayed?
Yes.
Press down the 'equalation' button, is the result displayed?
Yes.
Is it right?
Yes.
Choose to Motion Blur and Restoration Module, is the corresponding image as well
as a blured image displayed?
Yes.
Drag the velocity slider bar, does the blured image change according to the value of
the velocity slider bar?
Yes.
Press down the 'inverse filter' button, are the restored image with the power spectrum
of the PSF displayed?
Yes.
Is them correct?
Looks like so.
Press down the other button to see the result of convolving. Is the output refreshed?
Yes.
16
17
Appendix 1:
18
19
20
21
22
23