モバイルアプリやコンピュータ制御に関する雑多なアーカイブ、開発コラム

Sunday 21 March 2010

NHocrを使った日本語光学文字認識 #インストール編

日本語の光学文字認識についてトライしました。

nhocrというオープンソースの日本語光学認識プログラムがあります
今回はこのインストールにチャレンジしてみました

依存性の関係上、下記2つのプログラムのインストールが必要です

FreeType
The FreeType project develops free, portable and high-quality software solutions for digital typography. We focus on bringing small, efficient and ubiquitous products.
O2-tools
In this project, named "project-O2", my colleague and I implement the methods which we have developed for document analysis and recognition, and release the programs positively, if possible, with source code. The released software is mainly for layout analysis.

1. freetype-2.3.12とO2-tools-2.00をダウンロードし、解凍したディレクトリの中でconfigure、make、make install。

2.nhocr-0.20をダウンロードし、解凍したディレクトリの中でconfigure、make、make install。

これでインストールできました。

試しに/nhocr-0.20/test/run-testを実行すると、下記のようにhello.pgm,fs.pgmというPGMファイルを認識した結果が表示されます。



--> fs.pgm

--> hello.pgm


# ./run-test 
fs.pgm: ファイルシステム
hello.pgm: ニんにちは、
tohoku3.pgm: 
# Character candidates table
#   produced by: NHocr - Japanese OCR  v0.20 
IMG 0
R 1 0 0 2.4283356e+00
R 2 0 0 2.5794504e+00
R 3 0 0 2.7960027e+00
R 4 0 0 2.8455623e+00
R 5 0 0 2.8773998e+00
IMG 1
R 1 0 0 1.9178933e+00
R 2 0 0 3.1787773e+00
R 3 ft 0 0 3.3584956e+00
R 4 0 0 3.4200158e+00
R 5 0 0 3.5008508e+00
IMG 2
R 1 \ 0 0 0.0000000e+00
R 2 0 0 2.9960626e+00
R 3 0 0 3.4399795e+00
R 4 i 0 0 3.5661385e+00
R 5 0 0 3.6350114e+00

ちなみに、PGMファイルのOSX環境での変換はImageMagicを使います。
こちらは次のコラムへどうぞ。

No comments:

Post a Comment