about poly2mask function

3 views (last 30 days)
Reema Alhassan
Reema Alhassan on 4 Jul 2018
Edited: Reema Alhassan on 4 Jul 2018
Could anyone please explain me this : I'm using poly2mask function to creat a mask of a polygon with an image the documentation of this image says "the function sets pixels that are inside the polygon to 1 and sets pixels outside the polygon to 0" if you could see here : https://ww2.mathworks.cn/help/images/ref/poly2mask.html#f6-465457 but here when I use it to create a mask of a polygon with my image
rx = [shape(i).X];
ry = [shape(i).Y];
cond1 = isnan(rx) | isnan(ry);
[X,Y] = meshgrid(x,y);
I did this to to test how many ones that I have sum(mask(:)) and the result is very small =9 which means that only 9 points inside the polygon which is impossible because row=1069 col=1363 X is 1069x1363 Y is 1069x1363 rx is 1x42708 ry is 1x42708

Answers (0)

Community Treasure Hunt

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

Start Hunting!