How to reduce such noise?

2 次查看(过去 30 天)
AnG
AnG 2013-10-12
评论: AnG 2013-10-13
I have a code that simply estimates the boundaries of objects in an image for further processing
f = imread(ImageFile);
i = rgb2gray(f);
threshold = graythresh(i);
bw = im2bw(i, threshold);
imshow(bw)
se = strel('disk',3);
bw = imclose(bw,se);
bw = bwareaopen(bw, 30);
[B,L] = bwboundaries(bw,'noholes');
imshow(label2rgb(L, @jet, [.5 .5 .5]))
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2)
end
It works well with this image.
However when I tried it with this one (and a few similar ones) the results were not even close to being perfect. I tried using Wiener filter, it smoothed out left part of the image but the right part still has a lot of noise. Median filter makes it worse.
What would be the most effective way to reduce such noise? Also I am looking for a generalized solution so that when I use it with images with similar background it still works.

回答(1 个)

Image Analyst
Image Analyst 2013-10-12
The problem is that im2bw is notoriously bad at finding thresholds unless you have high contrast objects on a uniform background, and the objects must have enough area compared to the whole image. You need to do a background correction - try adapthisteq() to do a locally adaptive CLAHE background correction. Or follow this demo: http://www.mathworks.com/help/images/examples/correcting-nonuniform-illumination.html. Then try im2bw() again, or use a better thresholding algorithm, like triangle or something.
  1 个评论
AnG
AnG 2013-10-13
I did it by subtracting the background from images which I captured as a reference. It works 90% of the time and the only problem is with shadows but that can be corrected with proper lighting. Thank you for the link, I will try this method too.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by