How to get the Mat object from the Byte[] in openCV android?

后端 未结 5 2178
梦谈多话
梦谈多话 2020-12-29 10:46

I am working with OpenCV library in Android. I have a class which implements PictureCallBack.

The override method onPictureTaken() is as g

5条回答
  •  甜味超标
    2020-12-29 11:07

    The best and easiest way is like this:

    byte[] bytes = FileUtils.readFileToByteArray(new File("aaa.jpg"));
    Mat mat = Imgcodecs.imdecode(new MatOfByte(bytes), Imgcodecs.CV_LOAD_IMAGE_UNCHANGED);
    

提交回复
热议问题