how can I remove noise by using frequency domain technique??

25 views (last 30 days)
anybody help me how to remove noise from a picture? Consider the image which simulates the effect of mains signal interference in the amplifying electronics of the image sensor? http://imageshack.us/photo/my-images/152/bbbbj.png/

Accepted Answer

Image Analyst
Image Analyst on 16 Jan 2013
Is this your homework exercise? It sounds like a typical homework problem.
You can easily just fft2() your image, display it and find the spike, then zero out or reduce that spike, and finally inverse transform. If you're taking a class they should have gone over that. It's pretty straightforward.
  3 Comments
Image Analyst
Image Analyst on 17 Jan 2013
Here's one of my demos. It doesn't do the whole job for you. You still need to locate the spikes and move the filter to zero them out but it should help.
% Demo macro to filter an image in the Foureir domain.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
% Read in demo image.
folder = 'D:\Temporary stuff';
% folder = fullfile(matlabroot, '\toolbox\images\imdemos');
baseFileName = 'bbbbj.png';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage = imread(fullFileName);
[rows columns numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
grayImage = rgb2gray(grayImage);
end
subplot(2,2, 1);
imshow(grayImage, [0 255]);
set(gcf, 'Name', ['Results for ' fullFileName]);
title('Original Image', 'FontSize', fontSize);
set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure.
grayImage = double(grayImage);
frequencyImage = fftshift(fft2(grayImage));
subplot(2,2, 2);
amplitudeImage = log(abs(frequencyImage));
minValue = min(min(amplitudeImage))
maxValue = max(max(amplitudeImage))
imshow(amplitudeImage, []);
title('Notice the two spikes perpendicular to periodic frequencies', 'FontSize', fontSize);
% zoom(10)
[midpointX, midpointY] = find(amplitudeImage == maxValue)
filterWindowHalfWidth = 1;
for row = midpointY-filterWindowHalfWidth:midpointY+filterWindowHalfWidth
for column = midpointX-filterWindowHalfWidth:midpointX+filterWindowHalfWidth
frequencyImage(row-4, column+7) = 0;
frequencyImage(row+4, column-7) = 0;
end
end
amplitudeImage2 = log(abs(frequencyImage));
minValue = min(min(amplitudeImage2))
maxValue = max(max(amplitudeImage2))
subplot(2,2, 3);
imshow(amplitudeImage2, [minValue maxValue]);
title('Two dots zeroed out', 'FontSize', fontSize);
% zoom(10)
filteredImage = ifft2(fftshift(frequencyImage));
amplitudeImage3 = abs(filteredImage);
minValue = min(min(amplitudeImage3))
maxValue = max(max(amplitudeImage3))
subplot(2,2, 4);
imshow(amplitudeImage3, [minValue maxValue]);
title('Filtered Image', 'FontSize', fontSize);
% set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure.
% %
Long Bunly
Long Bunly on 17 Jan 2013
Thanks, with your code I have an idea, I should use arithmetic, also teacher require us to use frequency domain technique, I try it again so :), Thank you again.

Sign in to comment.

More Answers (1)

Shashank Prasanna
Shashank Prasanna on 16 Jan 2013
What find of filters are you looking for specifically?
Here are some examples of deblurring filters in the image processing toolbox
  3 Comments
Shashank Prasanna
Shashank Prasanna on 16 Jan 2013
The link doesn't work. You have to be specific with your question, since its your application you have to know what kind of filtering you want. Here is a link that may help you:
Go through the documentation to see if something is appilcable to you.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!