How to crop face section from an image with given corner points. MATLAB -
i want crop face section image face image not straight/vertically aligned. having 4 pixel points crop it.. problem that, if transform image first pixel points cannot used thereafter crop facial section out of it. or in other case not having exact bounding box crop image directly using imcrop facial sections tilted left or right. 4 pixel points @ forehead , chin , ears of face cropped.
you should @ poly2mask. function produces mask image given x , y coordinates:
bw = poly2mask(x,y,m,n); where x , y coordinates, , produced bw image m n. can use bw image mask original image i doing
i(~bw) = 0; if want crop, bounding box (either through regionprops function or code below):
x1 = round(min(x)); y1 = round(min(y)); x2 = round(max(x)); y2 = round(max(y)); and crop image after have used bw mask.
i2 = i(x1:x2,y1:y2); hope helps.
Comments
Post a Comment