I need to do the following for an image in the matlab:
- Load the image.
- compute FFT ( Fast Fourier Transform ) of the image.
- shift frequency components to the center.
- crop the image like follow ( if the image res. is 1000x1000 , the needed part of the image is like the following Coordinates: 100,100,800,800. which is a smaller image. (The idea of applying filter to remove high frequencies).
- inverse shift.
- inverse fourier transform.
. . .
My code look like this:
I = imread('2.jpg'); %loading
ID = im2double(I);
FID = fft2(ID); %FFT
F = fftshift(FID); %shifting
F = imcrop(F,[100, 100, 800, 800]);
FID = ifftshift(F); %inverse of shifting
IFID = ifft2(FID); %inverse of FFT
I8 = im2uint8(IFID);
The problem is when i want to Crop the image, imcrop function couldn't crop an image of type "complex double" , as i think ..
Error:
Error using imcrop>checkCData (line 410) Invalid input image.
Error in imcrop>parseInputs (line 256) checkCData(a);
Error in imcrop (line 93) [x,y,a,cm,spatial_rect,h_image,placement_cancelled] = parseInputs(varargin{:});
ِAny help ? .. also are there another function for cropping?