Clear Filters
Clear Filters

how to save the filled region to as an image

3 views (last 30 days)
structBoundaries = bwboundaries(binaryImage);
xy = structBoundaries{i};
fill(xy(:,2),xy(:,1),'w');
how to save the filled region to as an image? when i do
im = fill(xy(:,2),xy(:,1),'w');
% im is a patch object
i want "im" as a double datatype or image datatype
i even used poly2mask, but only one region comes at a time, i need 2 regions out of 5 regions from structBoundaries to come in the mask

Accepted Answer

Rik
Rik on 2 Feb 2018
Edited: Rik on 2 Feb 2018
You can create a binary mask in your desired resolution with this FEX submission. You can then use that mask to set the pixels in any color you like.
Edit:
If you have binary masks for one region at a time with poly2mask, you can just use the binary OR ('|') to merge multiple masks.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!