android opencv imdecode returns empty Mat!
Code:
public void processPicture( Mat picture ) {
Mat img = Imgcodecs.imdecode(picture, Imgcodecs.CV_LOAD_IMAGE_UNCHANGED);
}
//picture contains data, when we decode to Mat img returns empty!
Please help with this issue, Thanks in advance.
how do you obtain
picture
? what is it ? and what do you expect to be there ?i will got the ImageReader from camera2 and convert it into mat object and forward to processPicture method.
why do you think, you have to imencode() it at all, then ? (it expects an image "as on disc", headers, compressed pixels, etc. probably not what you have there)
please check
picture.size()
andpicture.type()
(and tell us !)Thank you for reply, picture.size():4032x3024 and picture.type():0
picture.size():4032x3024 and picture.type():0 img.size():0x0 and img.type():0
i'm quite sure, you can just skip the imdecode(), here (as you already have a "ready-to-use" image in the Mat).
Thank you for giving reply.