java - android tess-two OCR加速和错误

标签 java android ocr tess-two

我的应用程序中的 OCR 非常慢

我怎样才能加快我的申请

代码执行时出现错误

这是我的OCR代码

public class ProcessImage extends AsyncTask<String,String, String> {
    String OCRresult = null;

    @Override
    protected String doInBackground(String... args) {


        try {

            mTess.setImage(OCR.image);
            OCRresult = mTess.getUTF8Text();
            mTess.end();
            mTess.clear();

        } catch (RuntimeException e) {
            Log.e("OcrRecognizeAsyncTask",
                    "Caught RuntimeException in request to Tesseract. Setting state to CONTINUOUS_STOPPED.",
                    e);

            try {

            } catch (NullPointerException e1) {
                // Continue
            }
            return null;
        }

        return "Executed";
    }

    @Override
    protected void onPostExecute(String result) {
        TextView txt = (TextView) findViewById(OCRTextView);
        txt.setText("請按返回"); // txt.setText(result);
        if(OCRresult!=null) {
            txt.setText(OCRresult);
        }
        // might want to change "executed" for the returned string passed
        // into onPostExecute() but that is upto you
    }

    @Override
    protected void onPreExecute() {}



}

这是代码执行时的错误

This the error when code executes

最佳答案

您不能在 end() 之后调用 clear()。如果您想加快检测速度,请检查图像大小并使用检测器参数和检测模式。

祝你好运。

关于java - android tess-two OCR加速和错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46502159/

相关文章:

java - 如何使库在 Debug模式下充当无操作?

java - 从 imageview 触摸点,您可以调整 MAT 的大小以获得该点的颜色吗?

linux - ssocr @my_libs@ : No such file or directory

ios - 扫描名片 Tesseract 和 Leptonica iOS

java - Android Studio mailto Intent 不显示主题和邮件正文

java - jmockit 捕获模拟方法参数

java - 创建一个新对象以避免空指针异常是否正确?

java - 在广播接收器中显示对话框

iOS + Tesseract Ocr + OpenCV

java - Pivotal TC Server 启动,但使用 Spring 构建的网站未加载(之前是)