Removing noise from the image

9 次查看(过去 30 天)

I guess i have posted this earlier.

I have number of images in a folder. I have to crop those images(without using manual cropping). Now I have changed the images to binary images so that I can perform automatic cropping. Now, when I converted the images to their binary form, I am getting some noise which is preventing me from performing the cropping step. How can I remove the noise from each images? Please Help.

Example:-

I have this original image:-

I have converted the above image image to its binary form for cropping.

Now I found that there is a noise present at the bottom left corner of the binary image. How can I remove the noise such that the black colour of noise becomes white in colour.Please help.!

Also, since I have different images in my folder, the shape of the noise portion is also different in different images.How can I remove such noises from those images as well.??? Thanx in advance

采纳的回答

dhwani contractor
I am getting this result by following code...Hope this helps
I=rgb2hsv(RGBimg);
I1=I(:,:,2); % change to hsv and select the channel with most clear contrast between object and shadow
thresholded = I1 < 0.35;
SE = strel('disk',9);
IM2 = imerode(thresholded,SE);
imshow(IM2);
  1 个评论
Kumar Arindam Singh
thanx a lot.... can u plzz help me ....i wanted to crop these images..... say for example i wanted to crop the original image and the output would be:-

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
Image Analyst 2017-4-8
Not sure why you accepted it if it's not working for you. You shouldn't use imerode(). You should use bwareafilt() instead. Then you can call regionprops() to get the bounding box, or use all() and indexing. Then use imcrop(). See my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
  2 个评论
Kumar Arindam Singh
the code is working... that's y i thought of accepting the answer...okay i will see the tutorial
Image Analyst
Image Analyst 2017-4-8
编辑:Image Analyst 2017-4-8
Well it's not doing the cropping like you wanted and the erosion will change the shape of the mask. Basically (untested)
hsvImage = rgb2hsv(rgbImage);
saturationImage = hsvImage(:,:,2);
leafMask = saturationImage > 0.35;
leafMask = bwareafilt(leafMask, 1);
leafMask = imfill(leafMask, 'holes');
labeledImage = bwlabel(leafMask);
props = regionprops(labeledImage, 'BoundingBox');
boundingBox = props.BoundingBox;
croppedImage = imcrop(rgbImage, boundingBox);

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by