tesseract-ocr是一個開源的OCR引擎,對於普通的圖像文字識別來講,通過這工具配備英語的訓練庫已經可以識別大部分英文和數字的需求。
#tesseract安装 wget -c http://tesseract-ocr.googlecode.com/files/tesseract-3.00.tar.gz tar -zxvf tesseract-3.00.tar.gz cd tesseract-3.00 ./configure --prefix=/usr make clean make && make install #英语语言包安装 wget -c http://tesseract-ocr.googlecode.com/files/eng.traineddata.gz gunzip eng.traineddata.gz mv eng.traineddata /usr/share/tessdata/eng.traineddata
-----------------------------------------------------------------------
#下载ITPUB的校验图片 wget -O test.png http://www.itpub.net/authimg.php #通过imagemagick将test.png转化为test.tif,改变图片的色深等参数,为了使tesseract能够识别 convert -compress none -depth 8 -alpha off test.png test.tif #通过imagemagick调整test.tif的大小,并设置为灰度图 convert test.tif -scale 150% -colorspace Gray test2.tif #通过tesseract进行ocr处理 ./tesseract test2.tif result #检查输出结果 cat result.txt
資料來源:轉太多筆,不可考= =
沒有留言:
張貼留言