遮挡mask

image = imread('test.jpg')
show(image)
image.shape
# 创建遮挡
mask = np.zeros(image.shape,dtype='uint8')
white = (255,255,255)
cv2.rectangle(mask, (50,50), (250,350), white, -1)
show(mask)
# 对图像遮挡
masked = cv2.bitwise_and(image, mask)
show(masked)

# 创建遮挡
mask = np.zeros(image.shape,dtype='uint8')
white = (255,255,255)
cv2.circle(mask, (150,100), 80, white, -1)
show(mask)

# 对图像遮挡
masked = cv2.bitwise_and(image, mask)
show(masked)

 

posted @ 2020-08-30 09:56  yunshangyue  阅读(128)  评论(0编辑  收藏  举报