Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

it's one of those png's where a silly webdev put ALL of the information into the alpha channel ONLY. the bgr channels are all black, indeed.

what you have to do is:

  • read the image with alpha channel
  • extract alpha (and throw anything else away...)

Mat m = imread("badalpha.png", IMREAD_UNCHANGED);
Mat bw;
cout << m.type() << " " << m.channels() << endl;
extractChannel(m, bw, 3);
imshow("good", bw);


but, just saying, if you have images like that in your dataset, you have a problem ...