一个典型的操作,我们可能想要应用的是采取我们的蒙版和按位添加到输入图像,只保留蒙面部分区域:
mask = thresh.copy()
output = cv2.bitwise_and(image, image, mask=mask)
cv2.imshow("Output", output)
cv2.waitKey(0)
与我们的原始图像相比,当使用阈值图像作为蒙版时,彩色区域会重新出现,因为其余图像被“蒙版”了。
一个典型的操作,我们可能想要应用的是采取我们的蒙版和按位添加到输入图像,只保留蒙面部分区域:
mask = thresh.copy()
output = cv2.bitwise_and(image, image, mask=mask)
cv2.imshow("Output", output)
cv2.waitKey(0)
与我们的原始图像相比,当使用阈值图像作为蒙版时,彩色区域会重新出现,因为其余图像被“蒙版”了。