android - 如何跟踪致命信号 11 (SIGSEGV)

标签 android tesseract segmentation-fault

我正在开发一个 Android 应用程序,其中包含用于 OCR 的 opencv 和 tesseract。我使用了来自 guat.am 的基本 OCR 的一些代码,

Bitmap bmp = Bitmap.createBitmap(ima.cols(), ima.rows(), Bitmap.Config.ARGB_8888);
        Utils.matToBitmap(imagethre, bmp,true);

        TessBaseAPI baseApi = new TessBaseAPI();
        baseApi.setDebug(true);
        baseApi.init(DATA_PATH, lang);
        baseApi.setImage(bmp);
        String recognizedText = baseApi.getUTF8Text();

这不是路径或语言或类似问题的问题,因为它可以工作,但有时,对于某些图片它可以工作,但对于其他图片则不能...

我如何跟踪该错误以了解发生了什么?

我发布的最后一行代码中的应用程序崩溃

调试我现在看到应用程序在调用 TessBaseApi.class 时崩溃,特别是这一行:

String text = nativeGetUTF8Text();

有什么想法吗?

最佳答案

好吧,我找不到确切的方法,但我所做的只是在每一行之后打印 Log 语句,如果它有时失败,则记录直到打印该点。因此,让您知道导致错误的是后面没有日志的那一行。

关于android - 如何跟踪致命信号 11 (SIGSEGV),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13001982/

相关文章:

android - 构建 android tesseract-android-tools 库而不获取 tesslib 和 leptonlib

python - Tesseract OCR 无法检测数字

C++ 二维 vector SIGSEGV 错误

android - 声音不适用于 Android 设备。在模拟器上运行良好

java - 当应用程序进入后台时,Android 绑定(bind)程序事务失败

c# - 用蓝牙连接PC和安卓手机(c#)

c - fscanf 段错误

android - 添加 com.google.firebase :firebase-firestore:11. 4.2 后出现 DexOverflowException

android - Android Studio 中 Tesseract 的使用

c - strcmp 的段错误,但字符串使用 printf 打印