Compile tesseract for iOS SDK 6.0

來源:互聯網
上載者:User

http://lois.di-qual.net/blog/compile-tesseract-for-ios-sdk-6-0/點擊開啟連結


Update 10/25/12

Added instructions to integrate an armv7s slice in liblept.a and libtesseract_all.a.

Update 09/24/12

To make the iOS integration easier, I made a Github repo containing an Objective-C wrapper for Tesseract. It relies on an other repo containing tesseract & leptonica libs. Feel free to improve them !

  • Objective-C wrapper: https://github.com/ldiqual/tesseract-ios
  • Compiled libraries: https://github.com/ldiqual/tesseract-ios-lib

More informations about these repos on my next
article.

Introduction

I had troubles while following the compiling guide from this blog:http://tinsuke.wordpress.com/2011/11/01/how-to-compile-and-use-tesseract-3-01-on-ios-sdk-5/.
Some dependencies are missing on a fresh Mountain Lion with Xcode 4.5, and more importantly: the build_dependencies.sh won’t
work.

Here is why: Xcode 4.5 and iOS SDK 6.0 don’t support armv6 anymore.

So here are the steps to build tesseract-ocr for
iOS SDK 6.0.

Requirements

If you don’t have HomeBrew already, that’s a shame. Run to this
website and install it.

Then, install libtool and automake:

1
$ brew install libtool automake

You should have installed ‘Command Line Tools’ after the Homebrew installation, but if you forgot: Open Xcode’s preferences, and install them from the ‘Downloads’ tab.

The build process will need libtoolize.
Just make a symlink to glibtoolize:

1
$ ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize

We’re good to go.

Sources and compilation

The steps will more or less follow the tinsuke’s article, except for one thing: the build script.

Get the following sources:

  • tesseract: http://code.google.com/p/tesseract-ocr/downloads/detail?name=tesseract-3.01.tar.gz
  • leptonica: http://www.leptonica.com/source/leptonica-1.69.tar.gz
  • build_dependencies.sh: https://gist.github.com/3763217 (click
    on “raw” and save it to your computer)

Then, organize your folder with the following structure:

1

2

3

4

5
./build/

  dependencies/ 

  leptonica-1.69/

  tesseract-3.01/

  build_dependencies.sh

You might want to modify build_dependencies.sh to
make LEPTON_LIB and TESSERACT_LIB match
the proper folders.

Now, you can build the libraries:

1

2
$ chmod +x ./build_dependencies.sh

$ ./build_dependencies

In dependencies/lib/,
you’ll find liblept.a and libtesseract_all.a,
these are the only libraries you need so you can remove other ones. Both contain armv7 and i386 slices only, but many iOS 5 projects require an armv7s slice.

Just follow this Matt Galloway’s
blog post to generate and put an armv7s slice into the libs.

Now you just have to copy dependencies/ in
your Xcode Project, and follow my
next article on how to use tesseract.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.