2

I am working on application to enhance an image using FFT.

I have implemented the code for FFT:

enter image description here

For the first formula in above picture i have implemented code as below :

  void fft(int x , int y , int size) {

    for(int i=x; i<x+32 ; i++){
        for(int j=y ; j<y+32 ; j++){
            double kth = -2 * Math.PI * (((i*x)/size)+((j*y)/size));
            ComplexNumber expo = new ComplexNumber(Math.cos(kth),Math.sin(kth));
            output.values[i][j] = ComplexNumber.cMult(input.values[x][y],expo) ;
            intermediate.values[i][j] = output.values[i][j];
            input.values[i][j] = output.values[i][j];
        }

    }

}

I have also implemented code for second and third formula but the result I am getting is not correct. What should I do ?

Is the code implemented for the first equation correct?

Edited

I have tried with suggested functions in Catalano framework on the fingerprint image. Input image and output image after applying the Catalano framework :

Input Image

enter image description here

Fourier Transform

enter image description here

Frequency Filter

enter image description here

Output

enter image description here

As I am applying it on fingerprint image the difference between input image and output image is not so effective.The contrast between ridges and valleys in the fingerprint image is not clearly differentiable even after applying the FFT.So is there any addition parameters needed to do operation on fingerprint image?

4

2 回答 2

5

you can use FFT in java as follow:

This link is dead (http://blog.datasingularity.com/?p=53)

http://introcs.cs.princeton.edu/java/97data/FFT.java.html

and refer the info for FFTW is the 'fastest fourier transform in the west', and has some Java wrappers: from http://www.fftw.org/download.html

于 2013-10-17T09:49:08.730 回答
2

You can use Catalano Framework.

See the code below and the results.

FastBitmap fb = new FastBitmap("c:\\files\\test.bmp");
fb.toGrayscale();
JOptionPane.showMessageDialog(null, fb.toIcon(), "Image", JOptionPane.PLAIN_MESSAGE); 

FourierTransform ft = new FourierTransform(fb);
ft.Forward();
fb = ft.toFastBitmap();
JOptionPane.showMessageDialog(null, fb.toIcon(), "Fourier Transform", JOptionPane.PLAIN_MESSAGE);

FrequencyFilter ff = new FrequencyFilter(0, 60);
ff.ApplyInPlace(ft);
fb = ft.toFastBitmap();
JOptionPane.showMessageDialog(null, fb.toIcon(), "Frequency Filter", JOptionPane.PLAIN_MESSAGE);

ft.Backward();
fb = ft.toFastBitmap();
JOptionPane.showMessageDialog(null, fb.toIcon(), "Result", JOptionPane.PLAIN_MESSAGE);

Original image

Fourier Transform

Frequency Filter

Result

于 2013-10-31T10:38:17.830 回答