0

I need to read a transparent image for further operations, but when I read the image, it seems like it filters out the #000000 color parts, that is the outline I'm willing to keep. How can I read in the image to keep the outline of it, I don't, want to change the color to a bit grayer, only if there is no other way.

I am reading the image like this: img2 = cv.imread('2.png')

before, after

1 Answers1

0

by default, imread() will return only the bgr part of your image. use:

img2 = cv.imread('2.png', cv.IMREAD_UCHANGED)

to retain the alpha channel

berak
  • 1,226
  • 2
  • 5
  • 7