The output from FFT2 is always a double. Therefore, the rest of the sequence of operations will be working with doubles. The image arithmetic functions maintain the types of the input. Therefore, they will treat the data as doubles, even though you may have intended for them to be treated like the original image. When you use the image arithmetic functions on a double, it is also possible to produce negative results, because the output will be a double array. Finally, the output from IFFT2 is also always a double and could contain negative values. Therefore, the result of the sequence of operations will be an array of double, instead of the original type.
To work around this issue, you should use IM2DOUBLE to convert the image data to a double, perform the operations, and then convert back to the original data type.
Example:
I = imread('moon.tif');
ID = im2double(I);
FID = fft2(ID);
IFID = ifft2(FID);
I8 = im2uint8(IFID);
Best Answer