Extract ROI using a mask

  • Follow


hi
i'm working on a project, where i detect deficiencies in a plastic bottle
i managed to trace the boundaries of the bottle,

how can i extract the region that i traced to calculate its mean (which is the used feature of deficiency)
 
i would appreciate any ideas 

K.Dawod
0
Reply khalel 4/11/2010 12:16:03 PM

K.Dawod
Use poly2mask to turn your boundary coordinates into a logical
(binary) image.  After that one way to do it is to label it and use
regionprops.

It's well covered in my demo on image processing:
http://www.mathworks.com/matlabcentral/fileexchange/25157

Alternatively you can do it this way:

% Generate some sample data.
a=magic(8)

% Get some pixels that we want to take the mean of.
binaryImage = a > 40

% Now that you have the binary image, take the mean.
a_mean = mean(a(binaryImage))


0
Reply ImageAnalyst 4/11/2010 2:12:11 PM


1 Replies
661 Views

(page loaded in 0.022 seconds)

Similiar Articles:













7/24/2012 9:55:15 PM


Reply: