removal the outer boundary of bw image?

Hi all
i wrote this code
y=imread('..........bmp');
bw=im2bw(y);
b=bwboundaries(bw);
boundry=b{1};
imshow(bw);
hold on;
plot(boundry(:,2),boundry(:,1),'g');
now i need to remove the outer boundary in green color without any effect on the details inside this boundary , is this possible in matlab ? if it is possible how can this be done?
regards

4 comentarios

Walter Roberson
Walter Roberson el 29 de En. de 2012
Just don't plot the green ??
mmm ssss
mmm ssss el 29 de En. de 2012
no , is it what you understood from my question?
i want to remove this green boundary from also original image not from only the plotted figure , i means how to get rid of this green figure , eithout any affect on the details inside it.
thanks
mmm ssss
mmm ssss el 29 de En. de 2012
*without any affect on the details inside it
Image Analyst
Image Analyst el 29 de En. de 2012
Walter, I tried but I have no idea what he wants. Apparently it's not what you or I suggested even though both suggestions were valid possible approaches according to how he unclearly worded his question.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 29 de En. de 2012
Use morphological erosion
bw = imerode(bw, true(3));

12 comentarios

mmm ssss
mmm ssss el 29 de En. de 2012
no , it is uncorrect because after morphological operation (skeletonization) , the outer boundary of the hand still exists.
i want to remove this green boundary from the original image also , not from the plotted one only.
Image Analyst
Image Analyst el 29 de En. de 2012
I did not say to do skeletonization. I said to do erosion. Erosion eats away at the outermost layer of white objects in a binary image. You could do the same thing by calling bwperim and subtracting that result from the original binary image- they're equivalent. I don't even know what you did because if you did either skeletonization or erosion, you would not have the outer layer of image remain.
mmm ssss
mmm ssss el 29 de En. de 2012
yes , but my target is to remove the green boundary now in order not to appear when i find the image skeleton , i means this green boundary must be removed without any effect on the inside detials , this will help in get good skeleton for the inside details without the green outer boundary
mmm ssss
mmm ssss el 29 de En. de 2012
http://www.2shared.com/photo/PZSrQfCA/analyat1.html
http://www.2shared.com/photo/qA7LujXu/Analyst1.html
http://www.2shared.com/photo/01vj7dQ-/analyst2.html
you can see the above images as an illustration to my question
Image Analyst
Image Analyst el 29 de En. de 2012
I guess I'm not sure what you want then. I told you how to find the outer layer of regions in a binary image (which is where you plotted the green pixels), but you say you don't want that. Therefore I fall back to what Walter says: Just don't plot the boundaries and you will have no green boundaries plotted in the overlay above your image.
mmm ssss
mmm ssss el 29 de En. de 2012
thanks , but this is not what i want
regards
mmm ssss
mmm ssss el 29 de En. de 2012
as we now that the hand has boundary and this must be removed not from only the plotted figure , but from original image also, for example if we said that we have a square and inside it there is 3 circle and one star , we want to remove only the square boundaries , without any affecting the boundaries of the star and boundaries of 3 circles.
Image Analyst
Image Analyst el 30 de En. de 2012
Yes, you can get the boundary coordinates from bwboundaries, from erosion, or from bwperim. Then just set those coordinates to zero in your original image and your binary image.
mmm ssss
mmm ssss el 30 de En. de 2012
how can i set them to zero , can you give me sample code please?
mmm ssss
mmm ssss el 30 de En. de 2012
mg=imread('E:\master_matlab\HandVein_DataSet\0010hv3.bmp');
level=graythresh(mg);
x=im2bw(mg,level);
figure,imshow(x);
BW2 = bwperim(~x);
figure,imshow(BW2);
now how can i remove the white border in BW2 image?
mmm ssss
mmm ssss el 30 de En. de 2012
and the obtain image mg without these border?
mmm ssss
mmm ssss el 30 de En. de 2012
*and the obtain image mg without these border?

Iniciar sesión para comentar.

Categorías

Más información sobre Convert Image Type en Centro de ayuda y File Exchange.

Preguntada:

el 29 de En. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by