% code
h = impoly(gca,[188,30; 189,142; 93,141; 13,41]); api = iptgetapi(h); fcn = makeConstrainToRectFcn('impoly',get(gca,'XLim'),get(gca,'YLim')); api.setPositionConstraintFcn(fcn); position = wait(h); a=imcrop(I,[250 91;251 203;155 202;75 102]]); imshow(I);endI am working on medical image processing.I need to crop eye only from face & position is not constant for all images.so i use polygonal ROI.but it shows error.
MATLAB: How to crop required ROI from an image
roi
Best Answer