MATLAB: Fftshift and ifftshif of an image

image fftshift

HI, i have loaded and calculate the FFT of a RGB image and do the FFTshift to center the spectrum. My problem is that if I pass the return of fft to fftshift, fftshift mix up the chromatic planes (the 3rd dimension), so I have to run the fftshift function on every color plane, one for red, another for blue, and another for green. Specifically what I do is:
F=fft2(IMG_gray);
S(:,:,1)=fftshift(F(:,:,1));
S(:,:,2)=fftshift(F(:,:,2));
S(:,:,3)=fftshift(F(:,:,3));
Is there a function that do not mix up the color planes?

Best Answer

What you're already doing seems fine. If the idea is to do things in a single statement, you could do
S=fftshift(fftshift(F,1),2);