Kodeco Forums

Tesseract OCR Tutorial for iOS

In this tutorial you'll learn how to read and manipulate text extracted from images using OCR by Tesseract.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/306-tesseract-ocr-tutorial-for-ios

Thanks for updating the app, although I cannot build the app and it gives me an error:
'No such module ‘TesseractOCR’

Make sure that you have set “Enable Bitcode” to ‘No’ in all these places:

And also here:

Do you know any helpful libraries/frameworks/pods for image pre-processing?
I really need to horizontally-align the text (deskewing).

Would be great if you could help me with that.

Thanks in advance!

@lyndsey Do you have any feedback regarding this? Thank you - much appreciated! :]

I did that, still the same Error.

Tesseract doesn’t work with Iphone X right?

To find TesseractOCR, if you get the 'No such module ‘TesseractOCR’, you need to install it via CocoaPods. Follow the instructions in the tutorial above.

If you are installing the final completed project, you need to install cocoapods: e.g.

gem install --install-user cocoapods

You may then need to add the relevant directory to your PATH - look out for the message in the output of running that command. If the next command can’t find pod/cocoapods, you will need to add it to your PATH in your ~/.profile, .zshrc, or ~/.bash_profile depending on the shell you use.

Then in the base of the directory where you unzipped the project:

pod init

Replace the contents of the generated Podfile with the code from the tutorial:

use_frameworks!
platform :ios, '11.0'
  
target 'LoveInASnap' do
  use_frameworks!
  pod 'TesseractOCRiOS'
end

Then run:

pod install

Now open the downloaded completed project in XCode, choosing to open the .xcworkspace file to open the project (not the proj file). It should now build fine.

Truly an awesome tutorial!!! I’m currently stuck using Xcode 7 for my Tesseract project; is there any way to view the original version of the article?

I am trying to use tesseract in a similar fashion. I have used swift’s vision api to identify text rectangles and passed the bounding box as images to tesseract for text detection. So far it reads the texts as complete garbage. I am capturing images which are plain texts on a white background. What can I do to improve the output?

1 Like

@lyndsey Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hello, did you manage to get this done. I am facing similar problem. If yes, Please help.

I keep getting an error on import TesseractOCR - No such module ‘TesseractOCR’

What is the fix for this.

hello , did you manage for arabic because of tesseract.writingDirection not working in swift i want to start the writing from right for arabic how can we manage it

How can we fix it

@lyndsey Can you please help with this when you get a chance? Thank you - much appreciated! :]

1 Like

This Complete Project Doesn’t work.
LoveInASnap[44754:10612821] [discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 “query cancelled” UserInfo={NSLocalizedDescription=query cancelled}

@lyndsey Can you please help with this when you get a chance? Thank you - much appreciated! :]

1 Like

With the latest version of Tesseract, the following is deprecate g8_blackAndWhite()

  • (UIImage *)g8_blackAndWhite attribute((deprecated(“This method is no longer supported as a part of Tesseract-OCR-iOS”)));

Any workarounds?

@lyndsey Do you have any feedback regarding this? Thank you - much appreciated! :]

1 Like