1 | initial version |
Hi Bella,
as explained in details here by Andrey Kamaev, you can use Highgui.imdecode
function for conversion data in a JPEG format to Mat
. So full code snippet looks like this:
Mat jpegData = new Mat(1, data.length, CvType.CV_8UC1);
jpegData.put(0, 0, data);
Mat bgrMat = Highgui.imdecode(jpegData, Highgui.IMREAD_COLOR);
For the second issue, you can save image in a number ways:
FileOutputStream
on device's storage;Highgui.imwrite
to save a Mat
;byte[] data
into class member buffer.