How Can I remove the Periodic Noise lines from Color image attached?

69 views (last 30 days)
Hy, I am trying to filter out the periodic lines in Colour image attached using FFT and IFFT and median filter. Can anybody help me in this please. The end result should be same colour picture but those grey lines gone or atlease faded away. Help will be appreciated
I am attaching the Picture and Code modified with the help of @Image Analyst.
% Demo to filter an image, with periodic ripple, in the Fourier domain.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 14;
%Read Image
grayImage = imread('Cereal_noise.png');
[rows, columns, numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
grayImage = rgb2gray(grayImage);
subplot(2, 3, 1);
imshow(grayImage, [0 255]);
title('Original Image', 'FontSize', fontSize);
set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure.
% Compute the 2D fft.
frequencyImage = fftshift(fft2(grayImage));
% Take log magnitude so we can see it better in the display.
amplitudeImage = log(abs(frequencyImage));
minValue = min(min(amplitudeImage))
maxValue = max(max(amplitudeImage))
subplot(2, 3, 4);
imshow(amplitudeImage, []);
caption = sprintf('Notice the two spikes\nperpendicular to the periodic frequency');
title(caption, 'FontSize', fontSize);
axis on;
% zoom(10)
% Find the location of the big spikes.
amplitudeThreshold = 16;
brightSpikes = amplitudeImage > amplitudeThreshold; % Binary image.
subplot(2, 3, 5);
axis on;
title('Bright Spikes', 'FontSize', fontSize);
% Let user see the image.
promptMessage = sprintf('The image below shows the bright spikes.\nNow we will exclude the central spike.');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
% Exclude the central DC spike. Everything from row 115 to 143.
brightSpikes(115:143, :) = 0;
title('Bright spikes other than central spike', 'FontSize', fontSize);
promptMessage = sprintf('Now we will use these bright spikes to filter (mask) the spectrum.');
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
% Filter/mask the spectrum.
frequencyImage(brightSpikes) = 0;
% Take log magnitude so we can see it better in the display.
amplitudeImage2 = log(abs(frequencyImage));
minValue = min(min(amplitudeImage2))
maxValue = max(max(amplitudeImage2))
subplot(2, 3, 5);
imshow(amplitudeImage2, [minValue maxValue]);
axis on;
title('Spikes zeroed out', 'FontSize', fontSize);
% zoom(10)
filteredImage = ifft2(fftshift(frequencyImage));
amplitudeImage3 = abs(filteredImage);
minValue = min(min(amplitudeImage3))
maxValue = max(max(amplitudeImage3))
subplot(2, 3, 6);
imshow(amplitudeImage3, [minValue maxValue]);
title('Filtered Image', 'FontSize', fontSize);

Accepted Answer

Image Analyst
Image Analyst on 30 Nov 2020
I would not do this in the Fourier domain since the lines are so perfect, sharp, and periodic in the spatial domain. How do you think you would do it? What are your ideas? How about you sum the image vertically to get a horizontal profile? By looking at each color channel in turn, you can determine if the striping is in just one color channel, or all of them. Then examine the sum in the brighter and darker areas and determine if the brighter ones are a multiplication factor brighter, or an additive factor brighter. Then adjust the stripes by adding or multiplying by the correct factor. So that should be a lot more precise than anything you do in the frequency domain. Give it a try and if you really can't figure it out, come back here to get rescued.

Sign in to comment.

More Answers (1)

sushanth govinahallisathyanarayana
You can filter it in the frequency domain with a suitable low pass filter. Your code seems to indicate that you know where the fourier transform is spiking.
  1 Comment
Zain ul abideen ahsan
Zain ul abideen ahsan on 30 Nov 2020
I am trying to convert it into Frequency domain and trying to filter the spikes, but Its of no result unfortunately

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!