Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Read a gray scale or monochrome image with alpha channel

Repeating a question from stackoverflow.

How can I read a gray scale image in OpenCV with alpha channel? For example, if I try to read the following image, all I get is 2d array of all zeros.

C:\fakepath\1.png

image = cv2.imread('1.png', cv2.IMREAD_UNCHANGED)
image.shape

(480, 960)
click to hide/show revision 2
No.2 Revision

updated 2016-09-15 00:59:10 -0600

berak gravatar image

Read a gray scale or monochrome image with alpha channel

Repeating a question from stackoverflow.

How can I read a gray scale image in OpenCV with alpha channel? For example, if I try to read the following image, all I get is 2d array of all zeros.

C:\fakepath\1.pngC:\fakepath\1.png

image = cv2.imread('1.png', cv2.IMREAD_UNCHANGED)
image.shape

(480, 960)