Active contours image segmentation
Show older comments
using active contours i segmented a area in an image shown below

now how to extract the segmented area??
Answers (1)
Image Analyst
on 30 Apr 2014
0 votes
activecontour() returns a binary image that is the segmentation. Now describe very exactly what you mean by "extract". Does that mean measure with regionprops()? Does that mean cropping to a new, smaller image with imcrop()? "Extract" is not a very specific term. What does it mean to you?
4 Comments
scorpio 09
on 1 May 2014
Image Analyst
on 1 May 2014
Again, "activecontour() returns a binary image" so I don't understand why you're asking. It gives it to you!
Image Analyst
on 2 Feb 2021
If you want to mask the original image, no matter whether gray scale or RGB, you can use this code:
% Mask the image using bsxfun() function to multiply the mask by each channel individually.
% Works for gray scale as well as RGB Color images.
maskedImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));
If you have a gray scale image, you can also multiply:
maskedImage = grayImage .* uint8(mask); % or uint16
or you can erase using logical coordinates:
maskedImage = grayImage; % Initialize
maskedImage(~mask) = 0; % Erase outside the mask.
Categories
Find more on Image Segmentation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

