How to load png images with 4 channels?

后端 未结 5 1241
暗喜
暗喜 2020-12-03 00:45

I have been trying to load .png files with transparency channel (RGB and Alph) with no luck. It appears that openCV strips the 4th channel out of the image. Is there any met

5条回答
  •  忘掉有多难
    2020-12-03 01:15

    According to the documentation, OpenCV supports alpha channel on PNGs.

    Just call the imread function using CV_LOAD_IMAGE_UNCHANGED as flags like this:

    cvLoadImage("file.png", CV_LOAD_IMAGE_UNCHANGED)
    

提交回复
热议问题