Multi-font combination using OCR

Source: Internet
Author: User

Before the online to see a lot of information about the OCR, their training library material is also a lot, but about the training of the font after the multi-font use of data is less, in fact, after the OCR3.02 has been supported by multi-font joint use, so record down, I hope to be helpful to everyone!

1. First download the latest item tess-two on GitHub., the address is:https://github.com/rmtheis/tess-two;

2. If your computer does not have the NDK installed, you also need to download the NDK, because Tess-two is compiled by the NDK address: https://dl.google.com/android/ndk/android-ndk-r8e-windows-x86.zip

After installing the NDK, execute the command:

[plain] view plaincopy
  1. CD Tess-two
  2. Ndk-build
  3. Android Update Project-t 1--path.
  4. Ant Release
  5. Cd..
  6. CD Eyes-two
  7. Ndk-build
  8. Android Update Project-t 1--path.
  9. Ant Release
3. Call Tesseract to identify the imageEclipse Imports compiled Android project, a total of three projects, Tess-two, Tess-two-test and eyes-two. Among them, Tess-two and Eyes-two are Android Lib projects that are referenced by other projects. Tess-two encapsulates the Android API of Tesseract's Android Api,eyes-two package Leptonica. Tess-two-test for OCR testing, read the Tessbaseapitest.java code first, and understand how the API is used. [Java] view Plaincopy
  1.        Private Static FinalString Tessbase_path ="/mnt/sdcard/tesseract/";
  2. private   static   final  string default_language =  " Eng " ;  
  3. Private Static FinalString chinese_language ="Chi_sim";
  4. Private Static FinalString Chinese_custom ="Custom";//Custom Font
  5.   
  6. tessbaseapi baseapi = new  tessbaseapi ();   
  7. baseapi.init (tessbase_path, chinese_language);  //Single font use
  8. baseapi.init (Tessbase_path, chinese_language+chinese_language ); Multi-font use
  9. baseapi.setpagesegmode (TessBaseAPI.PageSegMode.PSM_AUTO );   
  10. baseapi.setimage (Params[0
  11.   
  12. // ensure that the result is correct.   
  13. final  string outputtext = baseapi.getutf8text ();   
  14. Baseapi.end ();
Finally, you can add an activity test to your tess-two-test project.

Note: 1. Multi-font joint use must be in the ocr3.02 version above to achieve, 3.01 is supported, followed by the test when the data is placed in the root directory of the phone tessdata.

2. Code: http://download.csdn.net/detail/u010897392/8649197;

3. custom font Please see another article: http://blog.csdn.net/u010897392/article/details/45339301

4. If there is a problem, can leave a message to discuss, everybody progress together!

Multi-font combination using OCR

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.