1 | initial version |
there's a couple of ways to do so:
imdecode(vectordata, IMREAD_COLOR);
cvtColor(mat,mat,COLOR_BGRA2BGR);
but those will just discard the alpha channel. to replace pixels, try like:
Mat channels[4];
split(mat, channels);
merge(channels,3,mat);
mat.setTo(Scalar::all(255), (channels[3]<255));
(though i doubt, that this will be faster, than your loop)
in general, try to avoid images with alpha, they were made to look good on a web-page, but are a bat fit for computer-vision