tesseract-ocr tips
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tesseract-ocr tips相关的知识,希望对你有一定的参考价值。
【基本用法】
1、官方:https://github.com/tesseract-ocr
2、基本语法:
Usage:tesseract.exe imagename outputbase [-l lang] [-psm pagesegmode] [configfile...] pagesegmode values are: 0 = Orientation and script detection (OSD) only. 1 = Automatic page segmentation with OSD. 2 = Automatic page segmentation, but no OSD, or OCR 3 = Fully automatic page segmentation, but no OSD. (Default) 4 = Assume a single column of text of variable sizes. 5 = Assume a single uniform block of vertically aligned text. 6 = Assume a single uniform block of text. 7 = Treat the image as a single text line. 8 = Treat the image as a single word. 9 = Treat the image as a single word in a circle. 10 = Treat the image as a single character. -l lang and/or -psm pagesegmode must occur before anyconfigfile. Single options: -v --version: version info --list-langs: list available languages for tesseract engine tesseract imagename outputbase [-l lang] [-psm pagesegmode] [configfile...] tesseract 图片名 输出文件名 -l 字库文件 -psm pagesegmode 配置文件
3、示例:
(1)、
tesseract code.jpg code -l chi_sim -psm 7 digits code 生成code.txt的结果文件 -l chi_sim 表示用简体中文字库 -psm 7 表示告诉tesseract code.jpg图片是一行文本,默认为 3 configfile 参数值为tessdata\configs 和 tessdata\tessconfigs 目录下的文件名 digits 内容为 tessedit_char_whitelist 0123456789-. 表示数字
(2)、白名单
tesseract code.jpg code -l eng -psm 7 -c tessedit_char_whitelist="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
(2)、黑名单
tesseract code.jpg code -l eng -psm 7 -c tessedit_char_blacklist="abcdefghijklmnopqrstuvwxy"
【训练】
*** walker ***
本文出自 “walker的流水账” 博客,请务必保留此出处http://walkerqt.blog.51cto.com/1310630/1844753
以上是关于tesseract-ocr tips的主要内容,如果未能解决你的问题,请参考以下文章
Python调用Tesseract-OCR完成图片OCR识别
pytesseract+Tesseract-OCR图片文字识别