# How to provide pseudo (false) color to inverse fast fourier transformed image (IFFT)

11 views (last 30 days)
Anurag Gaur on 6 May 2022
Answered: Paras Gupta on 18 Nov 2023 at 10:48
I have post-processed an image (code is given below)
subcrop=rgb2gray(imcrop(image,[415 59 526 687])); % crop the region of interest
T=fft2(subcrop); % fast fourier transformation of cropped image
FFT=T; % store into another variable named FFT
FFTS=fftshift(FFT); % shift the frequency of image to the center of FFT frequency domain
FFT2=(FFTS-min(min(FFTS)))./(max(max(FFTS))).*255;
imshow(FFT2) % diaplay the centre shifted frequency
[r,c]=size(subcrop); % creating a matrix of same size of image
TS=circshift(FFTS,77); % shift the pole by a value of 77 (1st order frequency) to the center (zeroth order frequency) , this step is requirement of the objective
gauss=fspecial('gaussian',[r,c],19); % creating a gaussina filter of size r,c
gaussian=mat2gray(gauss);
SP=TS.*gaussian; % multiplying TS with a gaussian filter
output_image=(ifft2(SP)); % inverse FFT of SP
imshow(output_image) % display the final output
Now I wanted to provide fasle or Pseudo color to 'output_image" based on intesnity gradient but I am unable to add this.
I have tried using rgb2ind as well as real(), imag() but these are not working.
raw image (rgb) and post-processed images are attached

Paras Gupta on 18 Nov 2023 at 10:48
Hi Anurag,
I understand that you want to apply a pseudo-color to your processed image based on intensity gradients. The following code illsutarates one way to achieve the same in MATLAB.
% Extracting real part
temp = real(output_image);
% Normalize gradient values to range [0, 1]
% Map the gradient to a pseudo-color image
% Or create an RGB image using the normalized gradient as the intensity for all channels
% Display the pseudo-color image
You can refer to the following documentation links for information on the functions used in the code:
Hope this helps.