2.几何变换_遮挡

#导入工具包并读入图片

from imutils import *
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 @ 2019-09-04 16:18  刘文华  阅读(239)  评论(0编辑  收藏  举报