Remove periodic Noise and convert photo to RGB again

8 views (last 30 days)
Here i have an image with periodic noise and i want to convert it to frequency domain using Fourier transform and apply notch filter to remove noise and then inverese fourier transform to get image to spatial domain again and convert it to RGB image again. Here is my code for that but i just convert image to frequence domain and apply filter but doesn't work and after that inverese fourier transform to convert image to spatial domain but can't convert it to RGB and just saw image without colors.
f = im2double(rgb2gray(imread('Moire2.bmp')));
imshow(f), title('Original Image');
F = fft2(f);
%create filter for noise removal but doesn't work and need changes
H = ones(size(f));
x = 10;
H(165-x:169+x, 127-x:131+x) = 0;
H(170-x:174+x, 61-x:65+x) = 0;
H = ifftshift(H);
% apply your own filter to image
filtered = F .* H;
figure, imshow(filtered) , title('Filter');
% inverse fourier trensform to restore image to spatial Domain again and i want to convert it to RGB image but can't do that
f1 = ifft2(filtered);
figure, imshow(f1), title('Restored Image');
  4 Comments
Bjorn Gustavsson
Bjorn Gustavsson on 6 Dec 2019
Just to add to Johannes' comment: Try this to get a grip on the different colour-components:
subplot(3,2,1)
imagesc(Im1(:,:,1))
subplot(3,2,2)
imagesc(log10(abs(fft2(Im1(:,:,1)))))
subplot(3,2,3)
imagesc(Im1(:,:,2))
subplot(3,2,4)
imagesc(log10(abs(fft2(Im1(:,:,2)))))
subplot(3,2,5)
imagesc(Im1(:,:,3))
subplot(3,2,6)
imagesc(log10(abs(fft2(Im1(:,:,3)))))
Then you'll see the intensity in each colour-plane and the corresponding FFT - you might consider throwing in a call to fftshift as well to get the DC-component in the centre to help your manual inspection along.
Ahmed Emad
Ahmed Emad on 6 Dec 2019
But image still have periodic noise and filter doesn't work correctly , So please help me to remove periodic noise and don't care about convert to RGB now because the main purpose of my question is to remove periodic noise using Notch filter and i can't do that correctly KALYAN ACHARJYA Bjorn Gustavsson Johannes Fischer

Sign in to comment.

Answers (0)

Products


Release

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!