def fill(th, im_th):
# Copy the thresholded image.
im_floodfill = im_th.copy()
# Mask used to flood filling.
# Notice the size needs to be 2 pixels than the image.
h, w = im_th.shape[:2]
mask = np.zeros((h+2, w+2), np.uint8)
# Floodfill from point (0, 0)
cv2.floodFill(im_floodfill, mask, (0,0), 255);
# Invert floodfilled image
im_floodfill_inv = cv2.bitwise_not(im_floodfill);
# Combine the two images to get the foreground.
im_out = im_th | im_floodfill_inv
return im_out;
myFunctions.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录