Tesseract OCR integrated Android studio for OCR recognition

Source: Internet
Author: User
Tags tesseract ocr

Tesseract OCR integrated Android studio for OCR recognition introduction

Tesseract OCR Google Open source OCR recognition engine, supporting multi-country text including Simplified Chinese and traditional. The latest version is 3.x. Can be installed on the machine through the installation program and then run the program through the command line to identify the text in a variety of pictures, but also provides two development packages, support two times development including C, C + + language. It can also be ported to the Android platform to implement the OCR recognition app for mobile applications.

Download

Using Tesseract OCR on the Android platform first to download the TESS2 project, it was compiled specifically for the Android platform, as follows-Https://github.com/rmtheis/tess-two. After the download is uncompressed, you will see the following directory structure:

Then open Android Studio to create a new project app, select Import module and select Import Tess-two folder in red Circle, after import you will see the following:

The project must be in support of the NDK, so specify the path to the NDK in project structure. The reason is that Tess-two is an NDK project and cannot be compiled without NDK support.

You may also encounter errors that are not Android-maven, add the following script to the top of Build.gradle:

Buildscript {
repositories {
Jcenter ()
}
dependencies {
Classpath ' com.android.tools.build:gradle:2.1.2 '
Classpath ' org.codehaus.groovy:groovy-backports-compat23:2.3.5 '
Classpath ' com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0 '
Classpath ' com.github.dcendents:android-maven-gradle-plugin:1.5 '
}
}
If all goes well, you will finish importing and compiling, see the directory structure of the successful import, the second one shows. Here's how to add the initialization code to your activity as follows:
private void Inittessbasedata () {
mtess = new Tessbaseapi ();
String datapath = environment.getexternalstoragedirectory () + "/tesseract/";
String language = "num";
String language = "eng";
File dir = new file (datapath + "tessdata/");
if (!dir.exists ())
Dir.mkdirs ();
Mtess.init (DataPath, language);
}
Then the Click event Response recognition action by listening for the "identify" button is as follows:
    












Https://github.com/tesseract-ocr/tessdata

Also, don't forget to add Tess-two as a dependency to the app.

Tesseract OCR integrated Android studio for OCR recognition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.