0
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SwiftでTesseract-OCR-iOSを使ってみる

Last updated at Posted at 2019-05-02

画像認識のアプリを作成しようと思い、Tesseractを使ってわかったことをまとめておきたいと思います。

開発環境

iOS 12
Swift 5
Xcode 10.2.1
TesseractOCRiOS 5.0.0

Tesseractの導入で参考になったサイト

この人の記事がよくまとまっているので、参考にさせてもらいました。
【Swift】文字認識ライブラリ、TesseractOCR for iOSを試してみた

ただ、こちらの記事は2015年の記事なので少し古く「4.BridgingHeaderを用意する」のHeaderの作成は必要内容です。

チュートリアル

海外のチュートリアルでアプリのベースも無料で配布されています。
Tesseract OCR Tutorial for iOS

このチュートリアルでTesseractの制限が書いてあります。

  • Unlike some OCR engines (like those used by the U.S. Postal Service to sort mail), Tesseract is unable to recognize handwriting. In fact, it’s limited to about 64 fonts in total.
  • Tesseract’s performance can improve with image pre-processing. You may need to scale images, increase color contrast, and horizontally-align the text for optimal results.
  • Finally, Tesseract OCR only works on Linux, Windows, and Mac OS X.

この方法でやられている方がこちら
Tesseract-OCR を iPhone で使ってみる

こちらの方の内容も結構充実しています。
Xcode 7.0 + Swift2 でTesseract-OCR-iOSを使う(追記あり)

この人の動画がわかりやすいです。
https://www.youtube.com/watch?v=DTQ1z_8KXZo

文字データのバージョンがポイント

文字の解析に使う文字情報のバージョンによってエラーが発生してしまい、なかなかうまくいかない様です。

こちらのデータリストからダウンロードしたものは使えました。
https://github.com/tesseract-ocr/tessdata.

まとめ

単純にカメラで撮影した画像を認識させようと思うと文字が化けるので、画像の加工が必要になるっぽい。ただ、どの様にTesseractが認識しているのかを調べる必要があるかもしれない。
Tesseract OCR iOSで認識させた文字の情報を取得する

補足

TesseractとKrakenのレビュー(英語)

日本語の文字認識の精度があまりよろしくないので、他のOCRも試してみたいと思う。
https://www.isoroot.jp/blog/1025/

0
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?