在下面给出的程序中,我将alpha通道添加到3通道图像来控制其不透明度。但是,无论我给出的alpha通道的值如何,都不会影响图像!任何人都能解释我为什么?使用Python中的Opencv降低图像的不透明度
import numpy as np
import cv2
image = cv2.imread('image.jpg')
print image
b_channel,g_channel,r_channel = cv2.split(image)
a_channel = np.ones(b_channel.shape, dtype=b_channel.dtype)*10
image = cv2.merge((b_channel,g_channel,r_channel,a_channel))
print image
cv2.imshow('img',image)
cv2.waitKey(0)
cv2.destroyAllWindows()
我可以在我在节目改变它alpha通道,并将其值变更终端看到,但对图像本身的不透明度没有影响!
我是OpenCV的新手,所以我可能会错过简单的东西。感谢帮助!
感谢您的快速回答和详细解释!我试过你的代码,它工作得很好:) – Ank