Borrar filtros
Borrar filtros

Removing noise from the image

9 visualizaciones (últimos 30 días)
Kumar Arindam Singh
Kumar Arindam Singh el 8 de Abr. de 2017
Editada: Image Analyst el 8 de Abr. de 2017

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

Respuesta aceptada

dhwani contractor
dhwani contractor el 8 de Abr. de 2017
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 comentario
Kumar Arindam Singh
Kumar Arindam Singh el 8 de Abr. de 2017
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:-

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 8 de Abr. de 2017
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 comentarios
Kumar Arindam Singh
Kumar Arindam Singh el 8 de Abr. de 2017
the code is working... that's y i thought of accepting the answer...okay i will see the tutorial
Image Analyst
Image Analyst el 8 de Abr. de 2017
Editada: Image Analyst el 8 de Abr. de 2017
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);

Iniciar sesión para comentar.

Categorías

Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by