OCR代码流或我的代码没有意义 [英] OCR Code Flow or My code doesn't make sense

查看:92
本文介绍了OCR代码流或我的代码没有意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在创建一个应用程序,该应用程序将使用Android上的camera API捕获和存储图像.在该过程之后,我想扫描图像中的文本并使用TextToSpeech将其输出为音频. 贝娄是我的MainActivity代码,我不知道为什么TextRecognizer无法正常工作.任何帮助或提示将不胜感激.

Currently I'm creating an application that would capture and store image using the camera api on android. after that process i would like to scan the image for texts and output that as audio using TextToSpeech. Bellow is my code for the MainActivity and I can't figure out why TextRecognizer is not working. Any help or hint will be greatly appreciated.

package com.telbound.chard1988.ncstocr;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.hardware.Camera;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.Toast;

import com.google.android.gms.vision.Detector;
import com.google.android.gms.vision.Frame;
import com.google.android.gms.vision.text.TextBlock;
import com.google.android.gms.vision.text.TextRecognizer;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class MainActivity extends AppCompatActivity {

private String detectedText = "";
private Camera mCamera = null;
Frame imageFrame;
TextRecognizer textRecognizer;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    /**
     * Open camera api
     */
    try{
        mCamera = Camera.open();
    } catch (Exception e){
        Log.d("ERROR", "Failed to get camera: " + e.getMessage());
    }

    /**
     * Check if camera is available
     */
    if(mCamera != null) {
        CameraView mCameraView = new CameraView(this, mCamera);
        FrameLayout camera_view = findViewById(R.id.camera_view);
        camera_view.addView(mCameraView);
    }

    /**
     * Button to close camera
     */
    ImageButton imgClose = findViewById(R.id.imgClose);
    imgClose.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            System.exit(0);
        }
    });

    /**
     * Capture image on screen tap
     */
    FrameLayout camera_view = findViewById(R.id.camera_view);
    camera_view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mCamera.takePicture(null, null, mPicture);

            /**
             * Read text on image here
             */
            File mediaStorageDir = new File(
                    Environment.getExternalStoragePublicDirectory(
                            Environment.DIRECTORY_PICTURES), "NCSTOCR"
            );
            String mFileName = mediaStorageDir.getPath() + File.separator + "IMG_CAPTURED.jpg";
            File mCapturedFile = new File(mFileName);
            if (! mCapturedFile.exists()) {
                Toast.makeText(getApplicationContext(), "No file for scanning has been located", Toast.LENGTH_LONG).show();
            }

            Bitmap bitmap = null;
            try {
                bitmap = decodeBitmapUri(MainActivity.this, Uri.fromFile(mCapturedFile));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }

            imageFrame = new Frame.Builder().setBitmap(bitmap).build();
            textRecognizer = new TextRecognizer.Builder(getApplicationContext()).build();
            if (! textRecognizer.isOperational()) {
                Toast.makeText(MainActivity.this, "TextRecognizer not available!", Toast.LENGTH_LONG).show();
            }

            textRecognizer.setProcessor(new Detector.Processor<TextBlock>() {
                @Override
                public void release() {

                }

                @Override
                public void receiveDetections(Detector.Detections<TextBlock> detections) {
                    final SparseArray<TextBlock> items = textRecognizer.detect(imageFrame);

                    if (items.size() != 0) {
                        for (int i = 0; i < items.size(); i++) {
                            TextBlock textBlock = items.get(items.keyAt(i));
                            detectedText = textBlock.getValue();
                            Log.d("Done", detectedText);
                        }
                    }

                    Toast.makeText(getApplicationContext(),
                            detectedText,
                            Toast.LENGTH_LONG)
                            .show();
                }
            });
        }
    });
}

Camera.PictureCallback mPicture = new Camera.PictureCallback() {
    @Override
    public void onPictureTaken(byte[] data, Camera camera) {
        File mPictureFile = getOutputMediaFile();

        if (mPictureFile == null) {
            return;
        }

        try {
            FileOutputStream fos = new FileOutputStream(mPictureFile);
            Bitmap realImage = BitmapFactory.decodeByteArray(data, 0, data.length);

            ExifInterface exif = new ExifInterface(mPictureFile.toString());

            Log.d("EXIF value", exif.getAttribute(ExifInterface.TAG_ORIENTATION));
            if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("6")){
                realImage = rotate(realImage, 90);
            } else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("8")){
                realImage = rotate(realImage, 270);
            } else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("3")){
                realImage = rotate(realImage, 180);
            } else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("0")){
                realImage = rotate(realImage, 90);
            }

            boolean bo = realImage.compress(Bitmap.CompressFormat.JPEG, 100, fos);

            Log.d("Info", bo + "");

            fos.write(data);
            fos.close();

            Log.d("Done", "File created at " + mPictureFile);
        } catch (FileNotFoundException e) {
            Log.d("ERROR", "Error file not found on PictureCallbak " + e.getMessage());
        } catch (IOException e) {
            Log.d("ERROR", "Error creating file on PictureCallbak " + e.getMessage());
        }
    }
};

private static File getOutputMediaFile() {
    File mediaStorageDir = new File(
            Environment.getExternalStoragePublicDirectory(
                    Environment.DIRECTORY_PICTURES), "NCSTOCR"
    );

    if (!mediaStorageDir.exists()) {
        if (!mediaStorageDir.mkdirs()) {
            Log.d("Error MainActivity", "Failed to create directory.");

            return null;
        }
    }

    String mFileName = mediaStorageDir.getPath() + File.separator + "IMG_CAPTURED.jpg";

    File mCapturedFile = new File(mFileName);
    if (mCapturedFile.exists()) {
        mCapturedFile.delete();
    }

    File mediaFile = new File(mFileName);

    return mediaFile;
}

public static Bitmap rotate(Bitmap bitmap, int degree) {
    int w = bitmap.getWidth();
    int h = bitmap.getHeight();

    Matrix mtx = new Matrix();
    //       mtx.postRotate(degree);
    mtx.setRotate(degree);

    return Bitmap.createBitmap(bitmap, 0, 0, w, h, mtx, true);
}

private Bitmap decodeBitmapUri(Context ctx, Uri uri) throws FileNotFoundException {
    int targetW = 600;
    int targetH = 600;
    BitmapFactory.Options bmOptions = new BitmapFactory.Options();
    bmOptions.inJustDecodeBounds = true;
    BitmapFactory.decodeStream(ctx.getContentResolver().openInputStream(uri), null, bmOptions);
    int photoW = bmOptions.outWidth;
    int photoH = bmOptions.outHeight;

    int scaleFactor = Math.min(photoW / targetW, photoH / targetH);
    bmOptions.inJustDecodeBounds = false;
    bmOptions.inSampleSize = scaleFactor;

    return BitmapFactory.decodeStream(ctx.getContentResolver()
            .openInputStream(uri), null, bmOptions);
}
}

这是完整的日志

02-14 12:06:03.039 27239-27239/com.telbound.chard1988.ncstocr E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
02-14 12:06:03.039 27239-27239/com.telbound.chard1988.ncstocr W/dalvikvm: VFY: unable to resolve instanceof 212 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
02-14 12:06:03.039 27239-27239/com.telbound.chard1988.ncstocr D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
02-14 12:06:03.512 27239-27239/com.telbound.chard1988.ncstocr D/Camera-JNI: (tid:27239)[MtkJNICameraContext] this:0x5cdc9768 camera->getStrongCount(3) 
02-14 12:06:03.515 27239-27239/com.telbound.chard1988.ncstocr D/SurfaceView: checkGLSurfaceViewlLogProperty get invalid command
02-14 12:06:03.519 27239-27239/com.telbound.chard1988.ncstocr D/ActivityThread: ACT-AM_ON_RESUME_CALLED ActivityRecord{42014e88 token=android.os.BinderProxy@420145a0 {com.telbound.chard1988.ncstocr/com.telbound.chard1988.ncstocr.MainActivity}}
02-14 12:06:03.519 27239-27239/com.telbound.chard1988.ncstocr V/PhoneWindow: DecorView setVisiblity: visibility = 4 ,Parent =null, this =com.android.internal.policy.impl.PhoneWindow$DecorView{42038b30 I.E..... R.....ID 0,0-0,0}
02-14 12:06:03.539 27239-27239/com.telbound.chard1988.ncstocr V/PhoneWindow: DecorView setVisiblity: visibility = 0 ,Parent =ViewRoot{42052348 com.telbound.chard1988.ncstocr/com.telbound.chard1988.ncstocr.MainActivity,ident = 0}, this =com.android.internal.policy.impl.PhoneWindow$DecorView{42038b30 V.E..... R.....ID 0,0-0,0}
02-14 12:06:03.539 27239-27239/com.telbound.chard1988.ncstocr D/ActivityThread: ACT-LAUNCH_ACTIVITY handled : 0 / ActivityRecord{42014e88 token=android.os.BinderProxy@420145a0 {com.telbound.chard1988.ncstocr/com.telbound.chard1988.ncstocr.MainActivity}}
02-14 12:06:03.541 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: updateWindow -- onWindowVisibilityChanged, visibility = 0
02-14 12:06:03.563 27239-27239/com.telbound.chard1988.ncstocr D/GraphicBuffer: create handle(0x610422f0) (w:544, h:960, f:1)
02-14 12:06:03.564 27239-27239/com.telbound.chard1988.ncstocr I/MaliEGL: [Mali]window_type=1, is_framebuffer=0, errnum = 0
02-14 12:06:03.564 27239-27239/com.telbound.chard1988.ncstocr I/MaliEGL: [Mali]surface->num_buffers=4, surface->num_frames=3, win_min_undequeued=1
02-14 12:06:03.564 27239-27239/com.telbound.chard1988.ncstocr I/MaliEGL: [Mali]max_allowed_dequeued_buffers=3
02-14 12:06:03.564 27239-27239/com.telbound.chard1988.ncstocr D/GraphicBuffer: close handle(0x610422f0) (w:544 h:960 f:1)
02-14 12:06:03.566 27239-27239/com.telbound.chard1988.ncstocr D/GraphicBuffer: create handle(0x610430f0) (w:544, h:960, f:1)
02-14 12:06:03.568 27239-27239/com.telbound.chard1988.ncstocr D/OpenGLRenderer: Enabling debug mode 0
02-14 12:06:03.570 27239-27239/com.telbound.chard1988.ncstocr D/GraphicBuffer: create handle(0x61045980) (w:1088, h:768, f:1)
02-14 12:06:03.576 27239-27239/com.telbound.chard1988.ncstocr D/OpenGLRenderer: setViewport 540x960 <0x61043678>
02-14 12:06:03.577 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: updateWindow -- setFrame
02-14 12:06:03.578 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: updateWindow -- OnPreDrawListener, mHaveFrame = true
02-14 12:06:03.578 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: Changes: creating=true format=true size=true visible=true left=true top=true mUpdateWindowNeeded=false mReportDrawNeeded=false redrawNeeded=false forceSizeChanged=true mVisible=false mRequestedVisible=true
02-14 12:06:03.580 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: Cur surface: Surface(name=null)/@0x4204e230
02-14 12:06:03.583 27239-27257/com.telbound.chard1988.ncstocr V/SurfaceView: com.telbound.chard1988.ncstocr.CameraView{4204df88 V.E..... ......ID 0,0-540,922} got resized: w=540 h=922, cur w=-1 h=-1
02-14 12:06:03.584 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: New surface: Surface(name=null)/@0x4204e300, vis=true, frame=Rect(0, 38 - 540, 960)
02-14 12:06:03.584 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: Callback --> surfaceCreated
02-14 12:06:03.584 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: surfaceCreated callback +
02-14 12:06:03.785 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: surfaceCreated callback -
02-14 12:06:03.785 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: surfaceChanged -- format=4 w=540 h=922
02-14 12:06:03.785 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: surfaceChanged callback +
02-14 12:06:04.532 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: surfaceChanged callback -
02-14 12:06:04.532 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: surfaceRedrawNeeded
02-14 12:06:04.532 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: finishedDrawing
02-14 12:06:04.533 27239-27239/com.telbound.chard1988.ncstocr V/SurfaceView: Layout: x=0 y=38 w=540 h=922, frame=Rect(0, 0 - 540, 922)
02-14 12:06:04.534 27239-27239/com.telbound.chard1988.ncstocr I/Choreographer: Skipped 52 frames!  The application may be doing too much work on its main thread.
02-14 12:06:04.538 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: updateWindow -- OnPreDrawListener, mHaveFrame = true
02-14 12:06:04.538 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: Changes: creating=false format=false size=false visible=false left=false top=false mUpdateWindowNeeded=true mReportDrawNeeded=true redrawNeeded=false forceSizeChanged=false mVisible=true mRequestedVisible=true
02-14 12:06:04.538 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: Cur surface: Surface(name=null)/@0x4204e230
02-14 12:06:04.541 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: New surface: Surface(name=null)/@0x4204e300, vis=true, frame=Rect(0, 38 - 540, 960)
02-14 12:06:04.541 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: surfaceRedrawNeeded
02-14 12:06:04.541 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: finishedDrawing
02-14 12:06:04.542 27239-27239/com.telbound.chard1988.ncstocr V/SurfaceView: Layout: x=0 y=38 w=540 h=922, frame=Rect(0, 0 - 540, 922)
02-14 12:06:04.544 27239-27239/com.telbound.chard1988.ncstocr D/OpenGLRenderer: prepareDirty (0.00, 0.00, 540.00, 960.00) opaque 1 <0x61043678>
02-14 12:06:04.546 27239-27239/com.telbound.chard1988.ncstocr D/OpenGLRenderer: finish <0x61043678>
02-14 12:06:04.549 27239-27239/com.telbound.chard1988.ncstocr V/InputMethodManager: onWindowFocus: null softInputMode=288 first=true flags=#1810100
02-14 12:06:04.550 27239-27239/com.telbound.chard1988.ncstocr V/InputMethodManager: START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView{42038b30 V.E..... R.....I. 0,0-540,960} ic=null tba=android.view.inputmethod.EditorInfo@4205ecd8 controlFlags=#104
02-14 12:06:04.558 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: updateWindow -- UPDATE_WINDOW_MSG
02-14 12:06:04.559 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: updateWindow -- setFrame
02-14 12:06:04.560 27239-27239/com.telbound.chard1988.ncstocr I/SurfaceView: updateWindow -- OnPreDrawListener, mHaveFrame = true
02-14 12:06:04.564 27239-27239/com.telbound.chard1988.ncstocr D/GraphicBuffer: create handle(0x61af7308) (w:544, h:960, f:1)
02-14 12:06:04.566 27239-27239/com.telbound.chard1988.ncstocr D/OpenGLRenderer: prepareDirty (0.00, 0.00, 540.00, 960.00) opaque 1 <0x61043678>
02-14 12:06:04.567 27239-27239/com.telbound.chard1988.ncstocr D/OpenGLRenderer: finish <0x61043678>
02-14 12:06:13.368 27239-27239/com.telbound.chard1988.ncstocr I/View: Touch down dispatch to com.telbound.chard1988.ncstocr.CameraView{4204df88 V.E..... ........ 0,0-540,922}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=306.43256, y[0]=561.3757, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=34232213, downTime=34232213, deviceId=2, source=0x1002 }
02-14 12:06:13.373 27239-27239/com.telbound.chard1988.ncstocr I/View: Touch down dispatch to android.widget.FrameLayout{42045a78 V.E...C. ........ 0,0-540,922 #7f070027 app:id/camera_view}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=306.43256, y[0]=561.3757, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=34232213, downTime=34232213, deviceId=2, source=0x1002 }
02-14 12:06:13.504 27239-27239/com.telbound.chard1988.ncstocr I/View: Touch up dispatch to android.widget.FrameLayout{42045a78 V.E...C. ...P.... 0,0-540,922 #7f070027 app:id/camera_view}, event = MotionEvent { action=ACTION_UP, id[0]=0, x[0]=306.43256, y[0]=561.3757, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=34232348, downTime=34232213, deviceId=2, source=0x1002 }
02-14 12:06:13.506 27239-27239/com.telbound.chard1988.ncstocr V/Provider/Settings: from db cache, name = sound_effects_enabled , value = 0
02-14 12:06:14.096 27239-27256/com.telbound.chard1988.ncstocr D/Camera-JNI: Allocating callback buffer
02-14 12:06:14.108 27239-27239/com.telbound.chard1988.ncstocr I/CameraFramework: handleMessage: 256
02-14 12:06:14.152 27239-27239/com.telbound.chard1988.ncstocr D/skia: jpeg_decoder mode 1, config 6, w 2560, h 1920, sample 1, bsLength 9dcc1!!
02-14 12:06:14.152 27239-27239/com.telbound.chard1988.ncstocr D/dalvikvm: Alloc : 19660816
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:   | group="main" sCount=0 dsCount=0 obj=0x419d1df8 self=0x418e6860
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:   | sysTid=27239 nice=0 sched=0/0 cgrp=apps handle=1074459012
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:   | state=R schedstat=( 178225237 146852221 418 ) utm=10 stm=7 core=1
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:522)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:545)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at com.telbound.chard1988.ncstocr.MainActivity$4.onPictureTaken(MainActivity.java:149)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1040)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.os.Handler.dispatchMessage(Handler.java:110)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.os.Looper.loop(Looper.java:193)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.app.ActivityThread.main(ActivityThread.java:5329)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at java.lang.reflect.Method.invokeNative(Native Method)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at java.lang.reflect.Method.invoke(Method.java:515)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at dalvik.system.NativeStart.main(Native Method)
02-14 12:06:14.153 27239-27239/com.telbound.chard1988.ncstocr D/dalvikvm: between the previous GC alloc  1019K
02-14 12:06:14.171 27239-27239/com.telbound.chard1988.ncstocr D/dalvikvm: GC_FOR_ALLOC freed 243K (3433), 38% free 6611K/10500K, paused 17ms, total 17ms
02-14 12:06:14.199 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm-heap: Grow heap (frag case) to 28.771MB for 19660816-byte allocation
02-14 12:06:14.408 27239-27239/com.telbound.chard1988.ncstocr D/skia: jpeg_decoder finish successfully, L:1879!!!
02-14 12:06:14.410 27239-27239/com.telbound.chard1988.ncstocr D/EXIF value: 0
02-14 12:06:14.411 27239-27239/com.telbound.chard1988.ncstocr D/dalvikvm: Alloc : 19660816
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:   | group="main" sCount=0 dsCount=0 obj=0x419d1df8 self=0x418e6860
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:   | sysTid=27239 nice=0 sched=0/0 cgrp=apps handle=1074459012
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:   | state=R schedstat=( 428819394 155407296 506 ) utm=36 stm=7 core=0
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.graphics.Bitmap.nativeCreate(Native Method)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.graphics.Bitmap.createBitmap(Bitmap.java:819)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.graphics.Bitmap.createBitmap(Bitmap.java:794)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.graphics.Bitmap.createBitmap(Bitmap.java:726)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at com.telbound.chard1988.ncstocr.MainActivity.rotate(MainActivity.java:214)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at com.telbound.chard1988.ncstocr.MainActivity$4.onPictureTaken(MainActivity.java:161)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1040)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.os.Handler.dispatchMessage(Handler.java:110)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.os.Looper.loop(Looper.java:193)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at android.app.ActivityThread.main(ActivityThread.java:5329)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at java.lang.reflect.Method.invokeNative(Native Method)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at java.lang.reflect.Method.invoke(Method.java:515)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm:     at dalvik.system.NativeStart.main(Native Method)
02-14 12:06:14.412 27239-27239/com.telbound.chard1988.ncstocr D/dalvikvm: between the previous GC alloc  19202K
02-14 12:06:14.426 27239-27239/com.telbound.chard1988.ncstocr D/dalvikvm: GC_FOR_ALLOC freed 3K (90), 14% free 25810K/29704K, paused 13ms, total 13ms
02-14 12:06:14.455 27239-27239/com.telbound.chard1988.ncstocr I/dalvikvm-heap: Grow heap (frag case) to 47.520MB for 19660816-byte allocation
02-14 12:06:16.742 27239-27239/com.telbound.chard1988.ncstocr D/Info: true
02-14 12:06:16.753 27239-27239/com.telbound.chard1988.ncstocr D/Done: File created at /storage/sdcard0/Pictures/NCSTOCR/IMG_CAPTURED.jpg
02-14 12:06:19.175 27239-27239/com.telbound.chard1988.ncstocr I/View: Touch down dispatch to android.support.v7.widget.AppCompatImageButton{4204a548 VFED..C. ........ 480,0-540,60 #7f070041 app:id/imgClose}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=39.03882, y[0]=36.92196, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=34238017, downTime=34238017, deviceId=2, source=0x1002 }
02-14 12:06:19.265 27239-27239/com.telbound.chard1988.ncstocr I/View: Touch up dispatch to android.support.v7.widget.AppCompatImageButton{4204a548 VFED..C. ...P.... 480,0-540,60 #7f070041 app:id/imgClose}, event = MotionEvent { action=ACTION_UP, id[0]=0, x[0]=39.03882, y[0]=36.92196, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=34238111, downTime=34238017, deviceId=2, source=0x1002 }
02-14 12:06:19.268 27239-27239/com.telbound.chard1988.ncstocr V/Provider/Settings:  from settings cache , name = sound_effects_enabled , value = 0
02-14 12:06:19.268 27239-27239/com.telbound.chard1988.ncstocr D/dalvikvm: create interp thread : stack size=128KB
02-14 12:06:19.268 27239-27239/com.telbound.chard1988.ncstocr D/dalvikvm: create new thread

推荐答案

您可以尝试下面的链接浏览要实现的代码 https://stackoverflow.com/a/39552604/9287163

You can try the below link to go through the code for which you are implementing https://stackoverflow.com/a/39552604/9287163

已更新:: 您的目标是从所有文本中提取单词.

Updated:: You Goal is to fetch words from all the text right.

注意:您可以使用文本识别器获取块,行和单词

下面是一个很好的例子 https://stackoverflow.com/a/46221503/9287163

below is a perfect example https://stackoverflow.com/a/46221503/9287163

这篇关于OCR代码流或我的代码没有意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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