sudo vi /etc/apt/sources.list
添加deb http://archive.ubuntu.com/ubuntu bionic universe
其中bionic和自己安装的系统有关,根据实际情况进行改变;
sudo apt install tesseract-ocr
sudo apt install libtesseract-dev
命令格式
tesseract FILE OUTPUTBASE [OPTIONS]...[CONFIGFILE]...
参数说明
参数 | 说明 |
---|---|
FILE | 可以为图片也可以为文本。当为文本时,一行文本表示一张图片。 |
OUTPUTBASE | 输出 |
OPTINONS | 见下表 |
CONFIGFILE | 见下表 |
OPTIONS | 说明 |
---|---|
-c | |
–dpi N | 指定dpi,默认N为300,如果图片不包括内容,Tesseract将会去猜测; |
-l LANG -l SCRIPT | 指定语言,默认为英语,可以指定多种语言,使用+连接 |
–psm N | 设定图片中文字的格式. |
–oem N | 指定使用tesseract还是LSTM |
–tessdata-dir PATH | 指定tessdata的路径 |
–user-patterns FILE | 指定用于patterns文件位置? |
–user-words FILE | 指定用户words 文件位置? |
CONFIGFILE
CONFIGFILE | 说明 |
---|---|
alto | 输出格式为OUTPUTBASE.alto |
hocr | 输出格式为OUTPUTBASE.hocr |
输出格式为OUTPUTBASE.pdf | |
tsv | 输出格式为OUTPUTBASE.tsv |
txt | 输出格式为OUTPUTBASE.txt |
get.images | 将输入的图片写入文件 |
logfile | debug信息 |
lstm.train | |
makebox | 输出bounding-box |
quiet | 将debug信息输出到/dev/null |
其他选项
选项 | 说明 |
---|---|
-h | 帮助 |
–help-extra | 高级用法帮助 |
–help-psm | 页分割模式帮助 |
–help-oem | engine模式帮助 |
–list-langs | 可用的语言 |
–print-parameters | 打印参数 |
参考链接https://github.com/tesseract-ocr/tesseract/wiki