def create_mask(self, shape, pts):
"""
Create a mask image to prevent feature extraction around regions
that already have features detected. i.e prevent feature crowding
"""
mask = np.ones(shape=shape, dtype=np.uint8) * 255
all_pts = np.vstack([self.aug_pts_, pts]) if hasattr(self, 'aug_pts_') \
else pts
try:
for pt in all_pts:
cv2.circle(mask, tuple(map(int, pt)), self.mask_size_, 0, -1, lineType=cv2.CV_AA)
except:
pass
return mask
评论列表
文章目录