pkg://kfourier-1.1c.tar.gz:155851/
kfourier-1.1/
kfourier/
help/kfourier.html
downloads
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (X11; I; Linux 2.0.29 i586) [Netscape]">
</HEAD>
<BODY>
<CENTER>
<H1>
<B><U><FONT SIZE=+2>KFOURIER</FONT></U></B></H1></CENTER>
<CENTER><FONT SIZE=+2>By <B>Antonio Larrosa Jimenez</B></FONT></CENTER>
<CENTER><FONT SIZE=+1></FONT></CENTER>
<B><FONT SIZE=+2>Index</FONT></B>
<OL>
<UL>
<LI>
<A HREF="#0. How to install the program and where to find it">0. How to install
the program and where to find it</A></LI>
<LI>
<A HREF="#1. How to load images">1. How to load images</A></LI>
<UL>
<LI>
<A HREF="#1.1 How to save images">1.1 How to save images</A></LI>
</UL>
<LI>
<A HREF="#2. Doing the Fourier transform of an image">2. Doing the
Fourier transform of an image</A></LI>
<UL>
<LI>
<A HREF="#2.1. Original transform">2.1. Original transformada</A></LI>
<LI>
<A HREF="#2.2. Fast transform">2.2. Fast transform</A></LI>
</UL>
<LI>
<A HREF="#3. Some filters">3. Some filters</A></LI>
</UL>
<UL>
<UL>
<LI>
<A HREF="#3.1. Low pass filters">3.1. Low pass filters</A></LI>
<LI>
<A HREF="#3.2. High pass filters">3.2. High pass filters</A></LI>
<LI>
<A HREF="#3.3. Band pass filters">3.3. Band pass filters</A></LI>
<LI>
<A HREF="#3.4. Band stop filters">3.4. Band stop filters</A></LI>
<LI>
<A HREF="#3.5. Linear interpolation filters">3.5. Linear interpolation filters</A></LI>
</UL>
<LI>
<A HREF="#4. Filter options">4. Filter options</A></LI>
<UL>
<LI>
<A HREF="#4.1. Pass and stop value change">4.1. Pass and stop value change</A></LI>
<LI>
<A HREF="#4.2. Activating/Desactivating cuadrants">4.2. Activating/Desactivating
cuadrants</A></LI>
<LI>
<A HREF="#4.3. Changing center of filters">4.3. Changing center of filters</A></LI>
</UL>
<LI>
<A HREF="#5. Color options">5. Color options</A></LI>
<UL>
<LI>
<A HREF="#5.1. RGB">5.1 RGB</A></LI>
<LI>
<A HREF="#5.2. HSV">5.2 HSV</A></LI>
</UL>
<LI>
<A HREF="#6. Examples">6. Examples</A></LI>
</UL>
</OL>
<P>
NOTE: I've not included the bitmaps in the source package because it would
make it grow up to 1.5 Mb , so it will appear some broken links through this
file, if you want to have also the images, go to kfourier's homepage and
download the images from there, where you will find them in a separate package.
Sorry for the inconveniences.
</P>
<A NAME="0. How to install the program and where to find it"></A><B><FONT SIZE=+2>0.
How to install the program and where to find it</FONT></B>
<BR>Once installed the KDE libs, you just have to decompress the file kfourier-1.1.tgz and execute in the newly created directory :
<BR>"configure", "make" and "make install" (the last one as root)
<BR>You can now run kfourier !
<BR>You can download the latest version of kfourier from its homepage, at <A HREF="http://www.arrakis.es/~rlarrosa/kfourier.html"> http://www.arrakis.es/~rlarrosa/kfourier.html</A>
<P><A NAME="1. How to load images"></A><B><FONT SIZE=+2>1. How to load images</FONT></B>
<P>To load an image you can use 3 methods:
<BR> 1. Press 'Open ...' from the 'File' menu
<BR> 2. Press the 'Open file' button in the toolbar (<IMG SRC="fileopen.xpm" ALIGN=TEXTTOP>)
<BR> 3. Take a file from the kfm and drag it to kfourier's window (doing Drag&Drop)
<P>You can open files in xpm,gif and bmp formats
<BR>When you load an image, it should appear a column with 4 images
, the first one (upper) is the loaded image, and the other 3 are the decomposition in <A HREF="#5.1. RGB">RGB</A>
or <A HREF="#5.2. HSV">HSV</A> following the choosed <A HREF="#5. Color options">color option</A>
<BR>
<P><A NAME="1.1 How to save an image"></A><B><FONT SIZE=+2>1.1 How to save an image</FONT></B>
<P>To save an image to the disk, you just have to choose the option "Save(BMP)
..." or "Save (XPM)..." from the 'File" menu, once done that, just click
<BR>with the mouse on the image you wish to save, then it will appear a window
where you can write the name of the new file
<P>If you decide not to save an image just before clicking over any, but you have already selected the "Save ..." menu, you can press on it again to deselect it
<P>You can choose to save in XPM or BMP formats by selecting the 'Save (XPM)...' or 'Save (BMP)...' options in the menu. It's not possible to save an image in
gif format because I would need a licence from Compuserve who has a patent over
the gif format.
<P><A NAME="2. Doing the Fourier transform of an image"></A><B><FONT SIZE=+2>2.
Doing the Fourier transform of an image</FONT></B>
<P>When doing the Fourier transform of an image the result will appear in a second row just next to the first. The Fourier transform is made to the 3 decomposed planes of the original image and then they are joint to make the Fourier transform (upper)
<P>After doing the Fourier transform, you can do the inverse Fourier transform
that generates new images that appear on a third row in which it appear again
a general image and their decomposition (or perhaps it would be better to say
that appear three images that are joint to make a general image)
<P>There are two methods to do the Fourier transform :
<P><A NAME="2.1. Original transform"></A><B><FONT SIZE=+2>2.1. Original transform</FONT></B>
<P>This method uses the definition of the Fourier transform to calculate it.
Due to the lot of sins, cosins, and additions that are required for each point, this method is EXTREMELY SLOW.
<BR>You can choose the menu option "Transform | Forward F.T." or
from the toolbar, the button <IMG SRC="forward.xpm" ALIGN=TEXTTOP>
<P>To calculate the inverse, you just have to choose "Transform | Inverse F.T."
or from the toolbar, the button <IMG SRC="back.xpm" ALIGN=TEXTTOP>
<BR>
<P><A NAME="2.2. Fast transform"></A><B><FONT SIZE=+2>2.2. Fast transform</FONT></B>
<P>The more often used method is the fast Fourier transform (or FFT)
<BR>It's millions and millions faster than the original, and with the same precision.
<BR>I found the one-dimensional FFT algorith in Dr Dobbs Journal of February from 1995 and then I change it a little to use the data type that I needed and to clarify it a little. Also, the algorithm was one-dimensional and I needed to do a two-dimensional FFT, so I had to divide a two dimensional F.T. in many one-dimensional in different directions to use this algorithm
<BR>You can choose the "Transform | Forward FFT" option in the menu, or in the toolbar, the button <IMG SRC="finish.xpm" ALIGN=TEXTTOP> , or just the space key from the keyboard
<BR>To do the inverse FFT, you can choose "Transform | Inverse FFT", the button <IMG SRC="start.xpm" ALIGN=TEXTTOP> in the toolbar or the backspace key
<BR>To realize a FFT it's needed for the dimensions of the image to be a power of 2 (32, 64, 128 , etc.) that's why if you load an image with other dimensions (i.e. 55x81) instead of rejecting it, kfourier first expands the image (in the example, to 64x128), doing black all the created frame and then it calculates the FFT. To do the inverse, the image that is shown in the screen is cropped so that the black frame is not showed.
<P><A NAME="3. Some filters"></A><B><FONT SIZE=+2>3. Some filters</FONT></B>
<P>You have to choose from the Filters menu, the filter you want to use
<BR>Once choosed, you can use it by pressing with the left mouse button over
an image of the central column (Fourier transforms). Some filters require
two parameter, so they also use the right button.
<BR>The filters can be used on the three channels or just on only one of them, by pressing on the upper image, or in the three others.
<P><A NAME="3.1. Low pass filters"></A><B><FONT SIZE=+2>3.1. Low pass filters</FONT></B>
<P>The low pass filters remove the high frequencies of an image, thus leaving a soften image.
<BR>Pressing with the left button over a point of the transform, you select the limit radius, so that higher frequencies will be removed
<BR>Example:
<BR><IMG SRC="pasobaja.xpm" >
<P><A NAME="3.2. High pass filters"></A><B><FONT SIZE=+2>3.2. High pass filters</FONT></B>
<P>The high pass filters remove the low frequencies, so the result image has increased the edges contrast
<BR>It's used just as the low pass filter
<BR>Example:
<BR> <IMG SRC="pasoalta.xpm" >
<P><A NAME="3.3. Band pass filters"></A><B><FONT SIZE=+2>3.3. Band pass filters</FONT></B>
<P>Tha band pass filters, remove the frequencies that are lower than a specified one and higher that another specified one
<BR>For that you must define a circular crown, you can do that, by pressing
with the right button on the bigger radius, and then with the left button on the smallest one.
<BR>Example:
<BR> <IMG SRC="pasobanda.xpm" >
<P><A NAME="3.4. Band stop filters"></A><B><FONT SIZE=+2>3.4. Band stop filters</FONT></B>
<P>The band stop filters remove a range of frequencies.
They work as the band pass filters.
<BR>Example:
<BR><IMG SRC="parobanda.xpm" >
<P><A NAME="3.5. Linear interpolation filters"></A><B><FONT SIZE=+2>3.5. Linear interpolation filters</FONT></B>
<P>This filter is similar to the Butterworth one, but while a Butterworth filter uses a function like this :
<BR><IMG SRC="grafbutter.xpm" >
<BR>The linear interpolation uses one like that :
<BR><IMG SRC="graflin.xpm" >
<BR>I have made this in that way because I though that it might be more useful to have a filter with two parameters thus defining a range of frequencies
where the filter works (so it's used as a band pass or band stop filter)
<P>Example:
<BR><IMG SRC="interplin.xpm" >
<BR>
<P><A NAME="4. Filter options"></A><B><FONT SIZE=+2>4. Filter options</FONT></B>
<P>The filters are highly configurables, so they are some options
that change the way of working of any of them.
<P><A NAME="4.1. Pass and stop value change"></A><B><FONT SIZE=+2>4.1.
Pass and stop value change</FONT></B>
<P>When a value of the transform can pass or not, it's really multiplied by a pass or stop value.
<BR>By default, the pass value is 1 (leaving the value just as it is) and the
stop value is 0 (multiplying by 0, the value is made 0)
<BR>But this values are configurable, so it's possible that a low pass filter multiply the low frequencies by 2 and make 0 the high freqs. or soft them a little, multiplying them by 0.3
<BR>It's also possible (but not too interesting) to use a low pass filter achieve the same result than a high pass filter, just by making 0 the pass value and 1 the stop value
<BR>Example:
<BR>By setting both the pass and stop value to -1 you can obtaing with any filter the same result :
<BR><IMG SRC="negativo.xpm" >
<P>This is obviously the negative of the image, because the Fourier transform is a linear transform
<P><A NAME="4.2. Activating/Desactivating cuadrants"></A><B><FONT SIZE=+2>4.2. Activating/Desactivating cuadrants</FONT></B>
<P>To understand better the workings of a Fourier transform, it's possible to see what happens if you make the filter work only over one or selected cuadrants instead of all the transform.
<BR>In the Filters menu, Cuadrants submenu, you can activate and desactivate the 4 cuadrants
<BR>This are the results of removing the 3 cuadrants and leaving only ...
<BR>...the first cuadrant, the second :
<BR><IMG SRC="cuad1.xpm" ><IMG SRC="cuad2.xpm" >
<P>... the third cuadrant, and the fourth:
<BR><IMG SRC="cuad3.xpm" ><IMG SRC="cuad4.xpm" >
<P><A NAME="4.3. Changing center of filters"></A><B><FONT SIZE=+2>4.3. Changing center of filters</FONT></B>
<P>By default the center of filters is set to the center of the image
(void value of the frequencies), but, what about removing one of the following "stars" ?
<BR><IMG SRC="joelmag.xpm" >
<P>This is possible by changing the center of the filters, so if you then choose a high pass filter, you can remove that point of accumulation of frequencies
<BR>Once choosen the option, the center of the filters will be set
on the point where you press the left button. If once choosen, you decide
not to change the center, you can desactivate it by choosing it again
from the menu
<P><A NAME="5. Color options"></A><B><FONT SIZE=+2>5. Color options</FONT></B>
<P>In the 'Options' menu, you can change the decomposition method of the images:
<P><A NAME="5.1. RGB"></A><B><FONT SIZE=+2>5.1. RGB</FONT></B>
<P>If you choose RGB, the images will be decomposed in the Red, Green and Blue channels:
<BR><IMG SRC="r.xpm" ><IMG SRC="g.xpm" ><IMG SRC="b.xpm" >
<BR>
<BR>
<P><A NAME="5.2. HSV"></A><B><FONT SIZE=+2>5.2. HSV</FONT></B>
<BR>
<BR>If you choose HSV, the images will be decomposed in the Hue, Saturation and Value channels:
<BR><IMG SRC="h.xpm" ><IMG SRC="s.xpm" ><IMG SRC="v.xpm" >
<P><A NAME="6. Examples"></A><B><FONT SIZE=+2>6. Examples</FONT></B>
<P>To finish, I will give two examples:
<BR><A HREF="#4.3. Changing center of filters">Placing the center</A>
of the filters in the middle of the second cuadrant and using a <A HREF="#3.5. Linear interpolation filters"> linear filter
</A> closing it each time , you can get the following sequence of Fourier transforms and images:
<P><IMG SRC="bordef1.xpm" ><IMG SRC="bordef2.xpm" ><IMG SRC="bordef3.xpm" ><IMG SRC="bordef4.xpm" >
<BR><IMG SRC="bordet1.xpm" ><IMG SRC="bordet2.xpm" ><IMG SRC="bordet3.xpm" ><IMG SRC="bordet4.xpm" >
<BR>
</P>
<P>
And an example on how to use the Fourier transform to remove noise of an image, the original image and it transform are:
<P><IMG SRC="moose1_orig.xpm" ><IMG SRC="moose2_fourier.xpm" >
</P>
<P>
If we use a band stop filter the transform and the image are left this way:
<P><IMG SRC="moose3_fourier.xpm" ><IMG SRC="moose4_final.xpm" >
</P>
<P>
and the noise has been removed from the original image !
</P>
</BODY>
</HTML>