def create_rectangle_mask( image, xcorners, ycorners ):
'''
Give image and x/y coners to create a rectangle mask
image: 2d array
xcorners, list, points of x coners
ycorners, list, points of y coners
Return:
the polygon mask: 2d array, the polygon pixels with values 1 and others with 0
Example:
'''
from skimage.draw import line_aa, line, polygon, circle
imy, imx = image.shape
bst_mask = np.zeros_like( image , dtype = bool)
rr, cc = polygon( ycorners,xcorners)
bst_mask[rr,cc] =1
#full_mask= ~bst_mask
return bst_mask
评论列表
文章目录