I'm trying to use opencv & tesseract to detect characters in real-time. The problem I'm having is that when I run the method getUTF8Text() my app crashes also, it seems that if I don't have to much info in the picture (i.e. having my hand over the lens) it runs smoothly.

The code segment that fails looks like this:

public void onCreate(...){
//...
baseApi = new TessBaseAPI();
baseApi.init(DATA_PATH, "leu");    
//...
}

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
//...
Mat mRgba = inputFrame.rgba();
Bitmap bm = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(mRgba, bm , true);
baseApi.setImage(bm );
String reconText = baseApi.getUTF8Text();
baseApi.clear();
//...
}

It generates no error in logcat :(

Any idéas what could be wrong? Shout if you need more info!

Thanks a lot!

有帮助吗?

解决方案

Sorry! Problem is resolved, was caused by the traineddata file I used. Apparently it wasn't compatible with my version of tesseract.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top