如何在原图上增强遮罩部分
How to enhance the mask part on the original image
原图:
检测到蒙面:
如何只增强蒙版中的白色部分而不是原始图像?
enhance= cv2.convertScaleAbs(image, alpha=1.5, beta=1)
给出
mask = ...
enhanced = ...
你可以做任何一个
# copy those pixels from source back over that aren't in the mask
enhanced[mask == 0] = image[mask == 0]
或
# overwrite source with enhanced pixels, if they are in the mask
image[mask > 0] = enhanced[mask > 0]
这是 numpy 对布尔数组的索引(mask == 0
结果是一个布尔数组)。
原图:
检测到蒙面:
如何只增强蒙版中的白色部分而不是原始图像?
enhance= cv2.convertScaleAbs(image, alpha=1.5, beta=1)
给出
mask = ...
enhanced = ...
你可以做任何一个
# copy those pixels from source back over that aren't in the mask
enhanced[mask == 0] = image[mask == 0]
或
# overwrite source with enhanced pixels, if they are in the mask
image[mask > 0] = enhanced[mask > 0]
这是 numpy 对布尔数组的索引(mask == 0
结果是一个布尔数组)。