Ask Your Question

Quill Hon's profile - activity

2016-11-29 01:12:30 -0500 received badge  Famous Question (source)
2015-02-26 07:49:32 -0500 received badge  Notable Question (source)
2014-03-22 12:19:36 -0500 received badge  Popular Question (source)
2012-10-05 22:16:44 -0500 commented question Convert Mat to MatOfByte in Android

I want to pass the Image to Tesseract-OCR api with byte data array. Because I don't want to convert it to bitmap.

http://fossies.org/dox/tesseract-3.01/group__AdvancedAPI.html#gaa463622111f3b11d8fca5863709cc699

2012-10-04 01:02:12 -0500 received badge  Student (source)
2012-10-03 23:54:05 -0500 asked a question Convert Mat to MatOfByte in Android

I got a Mat from OpenCV's camera. And I want to convert it to a MatOfByte or a byte[]. But I got runtime error in my code:

Mat mGray = new Mat();    
capture.retrieve(mGray, Highgui.CV_CAP_ANDROID_GREY_FRAME);
MatOfByte mGrayByte = new MatOfByte(mGray);

I got the error:

10-04 12:50:35.470: E/AndroidRuntime(25086): java.lang.IllegalArgumentException: Incomatible Mat 10-04 12:50:35.470: E/AndroidRuntime(25086): at org.opencv.core.MatOfByte.<init>(MatOfByte.java:29)

The error line is:

MatOfByte mGrayByte = new MatOfByte(mGray);