image segmentation

9 visualizzazioni (ultimi 30 giorni)
Gaurav  Kaila
Gaurav Kaila il 7 Mar 2011
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

Risposta accettata

Sean de Wolski
Sean de Wolski il 7 Mar 2011
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)));

Più risposte (4)

Sean de Wolski
Sean de Wolski il 7 Mar 2011
doc imfill
doc poly2mask

Gaurav  Kaila
Gaurav Kaila il 7 Mar 2011
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 il 7 Mar 2011
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 il 7 Mar 2011
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