LoginSignup
2
3

More than 5 years have passed since last update.

Tesseract.jsを触ってみた

Last updated at Posted at 2016-10-29

Tesseract.jsとは

http://tesseract.projectnaptha.com/
Tesseract.js is a pure Javascript port of the popular Tesseract OCR engine.
って書いてるのでJavaScriptでかかれたOCRエンジンです。

HTMLのなかで

<img  src="./images/cosmic.png" class="img"></img>

って言う風にimgタグでイメージ表示させて

JavaScriptで

var image = document.getElementsByClassName("img");

でimage取得して

Tesseract.recognize(image[0])
.progress(message => console.log(message))
.catch(err => console.error(err))
.then(result => console.log(result))
.finally(resultOrError => console.log(resultOrError));

で処理してあげるとresultにOCR結果が返ってくる素敵なものになってます。

にサンプルとして作ったのあげてます(環境はnodejsでパッケージ管理&http-server立ち上げ)

image

2
3
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
2
3