如何使用 opencv 创建透明蒙版而不是白色
how to create a transparent mask instead of white color using opencv
我正在使用以下代码创建白色遮罩。但是当我提取它时,我希望它是透明的。我该怎么做?
mask = cv2.ellipse(mask, center=(cX, cY), axes=(axesX, axesY), angle=0, startAngle=0, endAngle=360,
color=(255, 255, 255), thickness=-1)
inside = np.bitwise_and(image, mask)
outside = np.bitwise_and(image, ~mask)
我已经通过使用以下透明+遮罩代码修复了它
Using PIL to make all white pixels transparent?
我正在使用以下代码创建白色遮罩。但是当我提取它时,我希望它是透明的。我该怎么做?
mask = cv2.ellipse(mask, center=(cX, cY), axes=(axesX, axesY), angle=0, startAngle=0, endAngle=360,
color=(255, 255, 255), thickness=-1)
inside = np.bitwise_and(image, mask)
outside = np.bitwise_and(image, ~mask)
我已经通过使用以下透明+遮罩代码修复了它
Using PIL to make all white pixels transparent?