When drawpolygon(), how to programtically delete a series of vertices?
5 views (last 30 days)
I want to refine the automatically generated mask (denoted as init_mask below). I set corresponding points in drawpolygon().
xys = cell2mat(bwboundaries(init_mask));
x1 = xys(:,2);
y1 = xys(:,1);
ROI_vertices = [x1,y1];
h = drawpolygon(gca,'Position',ROI_vertices);
I want to delete all the points between point 1 and point2, i.e. delete those points around head. For now, I just right click on every point and then delete it. I was wondering if there is any way I can do this programtically?
At first, I tried to use contextMenu property of polygon ROI to retrieve the coordinates of the point I am right clicking on. However, this contextMenu property belongs to the whole ROI object and does not have information about the point I am clicking on. Do you have any thoughts?