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

后端 未结 5 2206
梦谈多话
梦谈多话 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:11

    You have to specify width and height of the image/Mat and channels depth.

    Mat mat = new Mat(width, height, CvType.CV_8UC3);
    mat.put(0, 0, data);
    

    Make sure you are using correct type of Mat. Maybe your data is not in 3 bytes RGB format and you should use another type e.g. CvType.CV_8UC1.
    Good luck!

提交回复
热议问题