roipoly函数选择感兴趣的多边形区域。
BW = roipoly(I, c, r)
c,r分别指每个顶点的列和行下标。选中的区域BW为1;反之,为0。
举例:
I = imread('eight.tif');
c = [222 272 300 270 221 194];
r = [21 21 75 121 121 75];
BW = roipoly(I,c,r);
figure, imshow(I), figure, imshow(BW)