Tesseract OCR TUTORIAL__OCR Character recognition

Source: Internet
Author: User
Tags tesseract ocr
From:https://www.raywenderlich.com/93276/implementing-tesseract-ocr-ios tesseract OCR TutorialLyndsey Scott on February 13, 2015

Code your way into his/her heart this Valentine ' s day!

Update 01/26/2016:updated for Xcode 7.2 and Swift 2.1.

Though I originally wrote this tutorial for Valentine ' s Day, the OCR can bring you love year-round. ;]

You ' ve undoubtedly seen it before ... It ' s widely used to process everything from scanned documents, to the handwritten scribbles on your tablet PC, to the Word Lens Technology Google recently added to their app. And today you'll learn to use it in your very own IPhone app! Pretty neat, huh?

So ... what is it? What is OCR?

Optical Character recognition, or OCR, is the process of electronically extracting text from images and reusing it in a VA Riety of ways such as document editing, Free-text searches, or compression.

In this tutorial, you'll learn how to use tesseract, a open source OCR engine maintained by Google. Introducing Tesseract

Tesseract OCR is quite powerful, but does have the following limitations:unlike-some OCR engines (like those used by the U.S. Postal Service to sort mail), Tesseract are unable to recognize handwriting and are limited to about $ fonts in total. Tesseract requires a bit of preprocessing to improve the OCR results; Images need to is scaled appropriately, have as much image contrast as possible, and have text. Finally, Tesseract OCR on Linux, Windows, and Mac OS X.

Uh, oh...how are you going to use this in IOS? Luckily, there ' a objective-c wrapper for Tesseract OCR, which can also is used in Swift and IOS. Don ' t worry, this swift-compatible version are the one included in the starter package!

phew! :] The app:love in A Snap

You didn ' t-do-you-you-here-at-Ray Wenderlich would let-you-upcoming Valentine ' s Day, did you? Of course not! We ' ve got your back. We ' ve managed to figure out of the sure-fire way to impress your true heart ' s desire. And you are about to build the app to make it happen.

U + OCR = LUV

In this tutorial, you'll learn how to use tesseract, a open source OCR engine maintained by Google. You'll work on the love in a Snap app, which lets for you take A-love poem and "Make It your Own" by replacing th e Name of the original poet ' s muse with the name of the object of your own affection. brilliant! Get ready to impress. Getting Started

Download The starter project package and extract it to a convenient location.

The archive contains the following Folders:LoveInASnap:The Xcode Starter project for this tutorial. Tesseract resources:the tesseract Framework and language data. Image resources:sample images containing text ' ll use later.

Looking at your-loveinasnap.xcodeproj, you'll notice that Viewcontroller.swift has been with a pre-populated @ Iboutlets and empty @IBAction methods which link the view controller to its pre-made main.storyboard.

Following those empty methods, you'll have to two the pre-coded functions which the handle showing and removing the view ' s activity in Dicator:

Func Addactivityindicator () {
  activityindicator = Uiactivityindicatorview (frame:view.bounds)
  Activityindicator.activityindicatorviewstyle =. Whitelarge
  activityindicator.backgroundcolor = Uicolor (white:0, alpha:0.25)
  Activityindicator.startanimating ()
  View.addsubview (activityindicator)
}
func Removeactivityindicator () {
  activityindicator.removefromsuperview ()
  activityindicator = Nil
}

Next There are several more methods which move the elements of the ' view in ' to prevent the keyboard from blocking Act Ive text fields:

Func moveviewup () {
  if topmarginconstraint.constant!= originaltopmargin {
    return
  }
  Topmarginconstraint.constant-= 135
  

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.