Git Product home page Git Product logo

tess-two_example's Introduction

Tess-two_example

tess-two usage example. This Android project uses Tesseract for performing OCR. apk in Google Play Market alt tag

##Usefull info #####What I need to start use Tesseract classes in my Android project: add to build.gradle:

dependencies {
    compile 'com.rmtheis:tess-two:5.4.1'
}

That's all!

#####Why this example working only with images, captured in landscape mode? And not working if captured image in portrait mode?

This code does not contain the setting correct orientation to Bitmap. Try to add:

try {
    ExifInterface exif = new ExifInterface(_path);
    int exifOrientation = exif.getAttributeInt(
            ExifInterface.TAG_ORIENTATION,
            ExifInterface.ORIENTATION_NORMAL);

    Log.v(TAG, "Orient: " + exifOrientation);

    int rotate = 0;

    switch (exifOrientation) {
        case ExifInterface.ORIENTATION_ROTATE_90:
            rotate = 90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            rotate = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_270:
            rotate = 270;
            break;
    }

    Log.v(TAG, "Rotation: " + rotate);

    if (rotate != 0) {

        // Getting width & height of the given image.
        int w = bitmap.getWidth();
        int h = bitmap.getHeight();

        // Setting pre rotate
        Matrix mtx = new Matrix();
        mtx.postRotate(rotate);

        // Rotating Bitmap
        bitmap = Bitmap.createBitmap(bitmap, 0, 0, w, h, mtx, false);
    }
}

#####Why I see black screen when OCR procesing? You need to do OCR in extra thread. Implementation of this is out off topic. Reed about AsyncTask in Android.

tess-two_example's People

Contributors

ashomokdev avatar

Watchers

James Cloos avatar Carlos Pradenas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.