0

I have a RGB image which as a given shape like (200, 200, 3) as an np.array with values between 0 and 255.

I also have a boolean np.array of shape (200, 200), which I'll call mask.

What I want is to reduce the opacity of the image in the mask while leaving the rest unchanged, by a given amount.

I know I can convert the RGB image to RGBA with cv2.cvtColor(img, cv2.COLOR_RGB2RGBA)

Edit: So I could fix the problem of changing the image at the mask but then I get a RGBA image, but I need it to be RGB. By using cv2.cvtColor(img_rgba, cv2.COLOR_RGBA2RGB) it just looses the A channel and I get back the original image. Any ideas on how to convert RGBA to RGB without losing the A channel?

4

0 回答 0