Android的进步的tesseract回调 [英] Android Tesseract progress callback

查看:104
本文介绍了Android的进步的tesseract回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

于是,我终于设法得到的Andr​​oid的tesseract工具编译。一切正常,但我不介意某种正在进行的呼叫回来。我看了看包装类和本机包装CPP code,但没有什么与进步处理。

So I finally managed to get the Android Tesseract Tools to compile. Everything works as expected, except I wouldn't mind some sort of progress call back. I looked in the wrapper class and the native wrapping cpp code, but there was nothing that dealt with progress.

有没有一种简单的方法来轮询的tesseract了某种进展?我见顶的的tesseract源$ C ​​$ C,但谁nativly讲Java的一个人,这让我害怕。

Is there an easy way to poll Tesseract for some sort of progress? I peaked at the Tesseract source code, but as a person who nativly speaks Java, it scares me.

考虑怎样的tesseract变量是在前进时间而言,似乎不好给用户一个微调和收工。如果是我,并没有反馈了30秒以上,我会重试或放弃。

Considering how variable Tesseract is in terms of progress time, it seems bad to give the user a spinner and call it a day. If it were me and it took over 30 seconds with no feedback, I'd retry or give up.

推荐答案

首先,因为OCR过程可以被视为在事物的宏伟sceme一个长期运行的任务,把它变成一个异步任务。世事如I / O,网络,或图像处理,应放入异步任务,因为你不希望在主UI线程上运行这个做。如果用户有一个真正的低规格的手机,这将需要一些时间,最终会导致应用程序无响应错误,如果你离开它的主UI线程上。

First off, since the OCR process can be deemed as a "long running task" in the grand sceme of things, put it into an async task. Things such as I/O, network, or image processing should be put into an async task, as you don't want this running on the main UI thread. If a user has a really low spec phone, it would take some time and eventually cause an application not responding error if you leave it on the main UI thread.

在关于进度条,你有几种选择。如果你有一定的时间限制,例如30秒,然后设置进度工作长达这一点,早点结束,如果OCR过程超过30秒更快。您也可以点击进入底层本地code,但它可能不值得...

In regards to progress bars, you have a few options. If you have a finite time limit such as 30 seconds then set the progress to work up to that and finish early if the OCR process is quicker than 30 seconds. You can also tap into the underlying native code, but its probably not worth the effort...

另外,在我看来的最佳方法,设置OCR过程的持续时间一个圆形的微调,因为图像可以是不同的,你真的没有一个想法,它需要多长时间。

Alternatively, and the optimal approach in my opinion, set a circular spinner for the duration of the OCR process, since the images could be different and you don't really have an idea how long it will take.

这篇关于Android的进步的tesseract回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆