MATLAB Answers


Remove noise from an image

Asked by Alessandro on 12 May 2011

Hi everybody, I am a student and I am at the beginning in a course of Machine Vision. It is one week that I try to solve this problem but without success so maybe someone can help me. I have to remove the noise and improve the quality of this image

Can you explain me how it is possible a show some code?




Log in to comment.

3 Answers

Answer by Sean de Wolski
on 12 May 2011

I2 = bwareaopen(I,3);


It doesn't work! I got a completely withe image.

It was a shot in the dark. I didn't download your image (I don't trust the site). I also don't want to do your homework for you. If you posted your image to a site that's trustworthy (i.e. no download; e.g. and showed us, in code, what you've tried so far, we'll be able to give you non-useless answers.

Log in to comment.

Answer by Alessandro on 12 May 2011

This is the image:

This is my code so far:

I = rgb2gray(imread('L3S1T2.jpg'));
imshow(I); title('Original');
B = wiener2(I);

I thought that the noise could be a Gaussian Noise so I applied a wiener filter but the result is not so good. Then looking in the histogram I saw some spikes and I thought that maybe the spikes are related to the noise, so I am looking for a way to "remove" the spikes.


Log in to comment.

Answer by Sean de Wolski
on 12 May 2011

X = imread(your_image);
Q = uint8(imclearborder(imfill(conv2(double(X(:,:,1)),ones(3),'same')<1400,'holes'))).*X(:,:,1); %quarters


This doesn't look like a real improvement.
And I don't want only the solution, if it is possible I would also understand and learn something.

That was the point. I have you six things to look into that you may find useful: convolution, hole filling, extraction of one slice, threshold, border clearing, map application. You can play with the parameters and or look at other functions such as imdilate, imerode, bwdist...

Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!