21
15

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.

Tesseract.jsを試す

Last updated at Posted at 2016-10-13

Tesseract.jsはPure JavascriptなORCするライブラリのようです。
書いた時点では62言語に対応してます。もちろん日本語も含まれています。
#試す
ブラウザで見ます。
画像はこれです
test.png
test2.png

index.html
<!DOCTYPE html>
<html>
<head>
	<title>test</title>
</head>
<body>
	<div id="test"></div>
	<img src="test.png">
	<div id="test2"></div>
	<img src="test2.png">
	<script src='https://cdn.rawgit.com/naptha/tesseract.js/0.2.0/dist/tesseract.js'></script>
	<script type="text/javascript" src="index.js"></script>
</body>
</html>
index.js
Tesseract.recognize("./test.png",{lang:"jpn"}).then(function(result){
    const a = document.querySelector("#test");
    a.innerHTML = result.html;
})
Tesseract.recognize("./test2.png").then(function(result){
    const a = document.querySelector("#test2");
    a.innerHTML = result.html;
})

ちょっと待つと文字を認識した結果が出てきます。

##結果
日本語: 二れはサンプル テキス 卜て"す
英語: Sample TexT Sample Text Tes’r Tes’r

ある程度は認識してくれていますね。

21
15
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
21
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?