how to remove the noise

2 views (last 30 days)
kash
kash on 27 Mar 2013
I have a code below and have a image ,i want to remove noises from it , i tried wiener,median filters but noise is not removed completely ,so kindly help
clc
clear all
I=imread('leaf3.png');
imshow(I)
I=rgb2gray(I);
a=I;[H L]=size(a);
gauss = fspecial ('gaussian' , [ 5 5 ] ) ;
I1= imfilter(I,gauss ) ;
wSize=3;Q=1;
bwim1=adaptivethreshold(I1,11,0.03);
figure,imshow(bwim1);
where adaptive threshlod is another function
function [bw]=adaptivethreshold(IM,ws,C)
if (nargin<3)
error('You must provide the image IM, the window size ws, and C.');
elseif (nargin==3)
tm=0;
elseif (tm~=0 && tm~=1)
error('tm must be 0 or 1.');
end
IM=mat2gray(IM);
if tm==0
mIM=imfilter(IM,fspecial('average',ws),'replicate');
else
mIM=medfilt2(IM,[ws ws]);
end
sIM=mIM-IM-C;
bw=im2bw(sIM,0);

Answers (1)

Image Analyst
Image Analyst on 27 Mar 2013
If you could completely remove the noise in a signal, I'm sure you would win the Nobel Prize.
Since no one has won the Nobel Prize for noise removal yet, you're stuck with imperfect noise removal methods. There are thousands of them with new ones coming out every month. You have simple ones like box filter averaging, and median filter, to more complicated ones like bilateral filter, sigma filters, mean shift filter, etc., to more complicated and more effective methods like BM3D, non-local means, K-LLD, K-SVD, UINTA, etc. etc.
The bottom line is how effective does your noise removal method need to be to measure the object you want to measure to the accuracy that you require? Maybe the denoising method is not great and you can measure something to within 1% of the true number, but maybe that's fine because if you're within +/- 5% you're able to tell if this part you're inspecting passed or failed.

Community Treasure Hunt

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

Start Hunting!