title: Is there any way to filter noise in an rgb image using fft and return a coloured image as output in matlab
body: <p>This is the code i came up with.I found many other ways of filtering but iim trying to filter the image using fourier transform only.i triend to split the image into three channels and then do fft on each of the images and log transformations but when i try to recombine the inverse shifter image,im not able to obtain the filtered image.<a href="https://i.stack.imgur.com/kNU39.jpg" rel="nofollow noreferrer">enter image description here</a>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>clear all;
  rgbImage = imread('simg.jpg');
  clear all;
  rgbImage = imread('simg.jpg');
  figure(1);imshow(rgbImage); title('Original Image');
  % Get the dimensions of the image.  numberOfColorBands should be = 3.
  [rows, columns, numberOfColorBands] = size(rgbImage);
  % Display the original color image.
  subplot(3, 4, 1);
  imshow(rgbImage);
  title('Original color Image', 'FontSize', 12);
  
  % Extract the individual red, green, and blue color channels.
  redChannel = rgbImage(:, :, 1);
  greenChannel = rgbImage(:, :, 2);
  blueChannel = rgbImage(:, :, 3);
  % Display the individual red, green, and blue color channels.
  subplot(3, 4, 2);
  imshow(redChannel);
  title('Red Channel', 'FontSize', 12);
  subplot(3, 4, 3);
  imshow(greenChannel);
  title('Green Channel', 'FontSize', 12);
  subplot(3, 4, 4);
  imshow(blueChannel);
  title('Blue Channel', 'FontSize', 12);
  
  fr1 = fft2(redChannel);
  fr2 = fft2(greenChannel);
  fr3 = fft2(blueChannel);
  
  %FSF = cat(3,fr1,fr2,fr3);
  Fsh1 = fftshift(fr1);
  Fsh2 = fftshift(fr2);
  Fsh3 = fftshift(fr3);
  %subplot(3, 4, 5);
  %imshow((Fsh1));
  %title('Fsh1', 'FontSize', 12);
  
  
  log1 = log(1+abs(Fsh1));
  log2 = log(1+abs(Fsh2));
  log3 = log(1+abs(Fsh3));
  %subplot(3, 4, 6);
  %imshow(real(log1));
  %title('log1', 'FontSize', 12);
  
  
  
  %FSF = cat(3, log1, log2, log3);
  %FSF = cat(3,Fsh1,Fsh2,Fsh3);
  %subplot(3, 4, 7);
  %imshow(real(FSF));
  %title('fsf', 'FontSize', 12);
  
  
  frr1 = ifftshift(Fsh1);
  frr2 = ifftshift(Fsh2);
  frr3 = ifftshift(Fsh3);
  FR = cat(3,frr1,frr2,frr3);
  subplot(3, 4, 6);
  imshow(abs(FR));
  subplot(3, 4, 7);
  logR = log(1+abs(FR));
  imshow(real(FR));
  
  f = ifft2(FR);
  subplot(3, 4, 8);
  imshow(abs(f))
  title('final', 'FontSize', 12);</code></pre>
  </div>
  </div>
  </p>