image segmentation

9 次查看(过去 30 天)
Gaurav  Kaila
Gaurav Kaila 2011-3-7
Hey, Im trying to segment out a polygon region out of an image. I have already got the boundary pixels . Can you please help me in finding out the pixel values inside the boundary.
Thank You

采纳的回答

Sean de Wolski
Sean de Wolski 2011-3-7
Okay, use IMFILL or POLY2MASK to generate a logical mask and then multiply it by the image to preserve the content inside the mask. I.e.
For grayscale images:
Imasked = I.*cast(Mask,class(I));
or for RGB images:
Imasked = bsxfun(@times,I,cast(Mask,class(I)));

更多回答(4 个)

Sean de Wolski
Sean de Wolski 2011-3-7
doc imfill
doc poly2mask

Gaurav  Kaila
Gaurav Kaila 2011-3-7
Thanks For Replying, but i have already tried these functions. What i need is , that image part that i am segmenting out, is displayed as an image itself with its original data inside it.
Like when we crop an image, the original data of the cropped image remains in it.

Gaurav  Kaila
Gaurav Kaila 2011-3-7
Thanks a Lot, I am very new to MATLAB, can you please elaborate on this answer a little more.
Thanks Again.

Gaurav  Kaila
Gaurav Kaila 2011-3-7
I got it!
Thank You!

Community Treasure Hunt

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

Start Hunting!

Translated by