Writing JPG with alpha channel
Hi all,
It seems that OpenCV cannot write JPEG images with alpha channel. For example, the code
Mat readMat = imread("water.png", IMREAD_UNCHANGED);
imwrite(string("water.jpg"), readMat);
using water.png, a 4-channel image downloaded from here with white background, produces a jpg image with 3 channels and black background. Is this a bug in OpenCV, or expected behavior?
Thanks.
jpg does not have any alpha channel, try "png" instead.
(and then, just saying, alpha has no relevance in computer-vision.)
I also tried to save in JPEG 2000 format using imwrite(string("water.jp2"), readMat), and got a blank file as result. JPEG 2000 is supposed to support alpha channel, correct?
idk.
again alpha is of no relevancy at all to opencv, and you're better off, avoiding images, that have it in the src file (if you want to do like dtp-image-processing, you picked the wrong lib)