00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <string.h>
00004 #include "FloatImage2D.h"
00005 #include "FloatKernel2D.h"
00006 #include "FourierTransform2D.h"
00007
00008
00009
00010
00011
00012
00013
00014 int main(int argc, char *argv[])
00015 {
00016
00017 if (argc != 2) {
00018 cout << "Usage: " << argv[0] << " <input_image>" << endl;
00019 exit(0);
00020 }
00021
00022
00023 FloatImage2D im0(256,256,"res.pgm");
00024 im0.readImage(argv[1]);
00025 im0.showImage();
00026
00027
00028 cout << "Original image statistics" << endl;
00029 cout << " Min: " << im0.min() << endl;
00030 cout << " Max: " << im0.max() << endl;
00031 cout << " Avg: " << im0.avg() << endl;
00032 cout << " Std. dev.: " << im0.dev() << endl << endl;
00033
00034
00035 FourierTransform2D a(im0);
00036
00037
00038 a.fft();
00039
00040
00041
00042
00043 a.showMagnitude(1);
00044 a.showPhase(0);
00045
00046
00047 FloatImage2D real, imag;
00048 real = a.getReal();
00049 imag = a.getImag();
00050 real.showImage();
00051
00052
00053 a.ifft();
00054
00055
00056
00057 FloatImage2D real1, imag1;
00058 real1 = a.getReal();
00059 imag1 = a.getImag();
00060
00061
00062
00063 real1.showImage();
00064 cout << "FFT-IFFT image statistics" << endl;
00065 cout << " Min: " << real1.min() << endl;
00066 cout << " Max: " << real1.max() << endl;
00067 cout << " Avg: " << real1.avg() << endl;
00068 cout << " Std. dev.: " << real1.dev() << endl << endl;
00069
00070 getchar();
00071
00072
00073 a.closeWindows();
00074
00075
00076 im0.closeWindow();
00077 real.closeWindow();
00078
00079 real1.closeWindow();
00080
00081
00082 return(1);
00083 }
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094