Pregunta

He desarrollado una aplicación para OCR usando la biblioteca Tesseract,

La aplicación obtuvo la salida durante la ejecución del siguiente código:

/*...
... Other Code stuff
...*/
    protected Boolean doInBackground(String... arg0) {

    /*...
    ... Other Code stuff
    ...*/
    Pix pix = getPixFromBitmap(bitmap);
    pix = preprocess(pix);
    Pixa pixa = slice(pix); // Code Updated

    try {
        baseApi.setPageSegMode(TessBaseAPI.PSM_SINGLE_LINE);

        int num = pixa.size();

        for (int i = 0; i < num; i++) {
            Pix pixi = pixa.getPix(i);

            /*...
            ... Other Code stuff
            ...*/
        }
        pixa.recycle();
        baseApi.end();

    } catch (RuntimeException e) {
Log.e("OcrRecognizeAsyncTask","Caught RuntimeException in request to Tesseract. Setting state to CONTINUOUS_STOPPED.");
        e.printStackTrace();
        try {
            // baseApi.clear();
            activity.stopHandler();
        } catch (NullPointerException e1) {
            // Continue
        }
        return false;
    }

    private Pixa slice(Pix pix) {
    HydrogenTextDetector htd = new HydrogenTextDetector();
    HydrogenTextDetector.Parameters hydrogenParams = htd.getParameters();
    hydrogenParams.debug = false;
    hydrogenParams.skew_enabled = true;
    htd.setParameters(hydrogenParams);

    htd.setSourceImage(pix);
    pix.recycle();
    htd.detectText();
    Pixa unsorted = htd.getTextAreas();
    Pixa pixa = unsorted.sort(Constants.L_SORT_BY_X, Constants.L_SORT_DECREASING);
    unsorted.recycle();
    htd.clear();
    return pixa;
}

Detalles de LogCat de la siguiente manera:

02-23 13:37:09.986: I/WindowManager(102): Setting rotation to 0, animFlags=1
02-23 13:37:10.006: I/ActivityManager(102): Config changed: { scale=1.0 imsi=405/30 loc=en_IN touch=3 keys=1/1/2 nav=3/1 orien=1 layout=17 uiMode=17 seq=33}
02-23 13:37:10.116: I/UsageStats(102): Unexpected resume of com.htc.launcher while  already resumed in edu.sfsu.cs.orange.ocr
02-23 13:37:10.816: W/InputManagerService(102): Got RemoteException sending setActive(false) notification to pid 4880 uid 10062

Estoy convirtiendo mapa de bits en el objeto Leptonica PIX que PIX a Leptonica Pixa Object y que hacer reorganización de OCR.

Durante el procesamiento, en algún momento la reorganización de OCR realizada con éxito y en algún momento la pantalla de inicio de Android viene automáticamente.

No sé cuál es el problema detrás de eso y por qué RemoteException ¿Venga la advertencia?

Por favor, ayúdame a resolver este problema.

Gracias,

No hay solución correcta

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top