MATLAB: How to set region inside roi (polygon) to 1.

imageimage analysisImage Processing Toolboximage segmentationmatrix manipulation

I have a polygon drawn on an image using impoly. I want to set the region inside the polygon to 1. Can it be done. Please help me. Nithya

Best Answer

If you have the Image Processing Toolbox, you can use the poly2mask() function to do that
[rows, columns, numberOfColorChannels] = size(yourImage);
binaryMask = poly2mask(x, y, rows, columns);
Related Question