我在tesseract方法中遇到问题。我使用下面的代码,我的应用程序直接停止.Below是我的jni.cpp
文件。
struct native_data_t {
native_data_t() : image_obj(NULL), image_buffer(NULL) {}
tesseract::TessBaseAPI api;
jbyteArray image_obj;
jbyte* image_buffer;
int width, height, bpp;
char bBWFilter; // 0=disable, 1=enable
char bHorizontalDisplay;
};
native_data_t *nat = get_native_data(env, thiz);
if (nat->api.Init("/sdcard/","eng")) {
LOGE("could not initialize tesseract!");
res = JNI_FALSE;
}
你可以帮助我吗?这个init方法中的数据路径是什么?提前谢谢。
我的LogCat如下。
09-03 11:52:53.186: VERBOSE/MLOG: AssetsManager.java:(2263): isAssetsInstalled(): Assets are already correctly installed
09-03 11:52:53.186: VERBOSE/MLOG: OCR.java:(2263): GetLanguage(): eng
09-03 11:52:53.206: VERBOSE/MLOG: OCR.java:(2263): setLanguage to eng
09-03 11:52:53.206: VERBOSE/MLOG: OCR.java:(2263): noLangs=1
09-03 11:52:53.206: VERBOSE/OcrLib(native)(2263): ocr_open
09-03 11:52:53.206: INFO/OcrLib(native)(2263): lang eng
09-03 11:52:53.246: ERROR/OcrLib(native)(2263): IN BASE CPP
09-03 11:52:53.246: ERROR/OcrLib(native)(2263): IN 2nd if BASE CPP
09-03 11:52:53.326: INFO/ActivityThread(2253): Publishing provider com.google.android.maps.SearchHistoryProvider: com.google.googlenav.provider.SearchHistoryProvider
09-03 11:52:54.076: INFO/ActivityManager(123): Start proc com.android.voicedialer for broadcast com.android.voicedialer/.VoiceDialerReceiver: pid=2274 uid=10016 gids={3002}
09-03 11:52:54.206: INFO/ActivityManager(123): Stopping service: com.android.vending/.util.WorkService
09-03 11:52:54.336: INFO/ActivityManager(123): Process com.temp.unique.ocr (pid 2263) has died.
09-03 11:52:54.366: DEBUG/Zygote(122): Process 2263 exited cleanly (1)
09-03 11:52:54.756: INFO/dalvikvm(2274): Debugger thread not active, ignoring DDM send (t=0x41504e4d l=38)
09-03 11:52:54.766: DEBUG/vending(261): [43] LocalAssetCache.updateOnePackage(): No local info for com.temp.unique.ocr
我的包裹是com.temp.unique.ocr
。我的申请程序直接死亡。