Given an image, I'm applying the fft on it and then the inverse fft.
I'm expecting to get the same results as in the original image, but I'm getting huge numbers instead.
I'm using the following simple code:
fid=fopen("C:\\res3\\padded2.txt","w+");
for (int i=0;i<padded2.rows;i++){
for (int j=0;j<padded.cols;j++){
fprintf(fid,"%f ", padded2.at<float>(i,j));
}
fprintf(fid,"\n");
}
fclose(fid);
Mat fftimg;
dft(padded2, fftimg);
Mat ifftimg;
dft(fftimg,ifftimg,cv::DFT_INVERSE);
fid=fopen("C:\\res3\\inversefftimage.txt","w+");
for (int i=0;i<ifftimg.rows;i++){
for (int j=0;j<ifftimg.cols;j++){
fprintf(fid,"%f ",ifftimg.at<float>(i,j));
}
fprintf(fid,"\n");
}
fclose(fid);
As you can see, I'm printing the image to a file before and after the fft+ifft. When I check the files, I see very different numbers after the fft+ifft. The numbers after fft+ifft are much much larger(around 30,000 instead of being around 4-5).
Can someone please explain me this behavior? What should I change to get the same results?
I'm working on OpenCV 2.4.5 with VS 2012 and windows 8.
Thanks in advance!
Gil.