关于获取系统资源的正确姿势 | 安装/使用 tesseract

本文介绍了如何正确安装和使用tesseract进行图像解析。在安装过程中可能会遇到找不到指定模块的问题,文章也对此进行了讨论。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装

#安装tesseract-ocr编译依赖
[root@VM_14_141_centos tesseract-ocr]# yum install autoconf automake libtool
#安装图像解析包  可以自己搭配格式
yum install libjpeg-devel libpng-devel libtiff-devel zlib-devel 
#安装图像处理与图像分析工具,tesseract依赖于它
wget http://www.leptonica.org/source/leptonica-1.71.tar.gz 
./configure  
make  
make install  


#准备安装tesseract-ocr
./autogen.sh  
./configure  
make  
make install  
ldconfig

使用

#tesseract简单使用
[root@VM_14_141_centos reignTools]# tesseract template.jpg a
上述标识在可以正常使用tesseract的前提下 在当前目录下有template.jpg文件一个,对改图像文件进行解析 结果响应到a文件内

tesseract imagename outputbase [-l lang] [-psm pagesegmode] [configfile...]
1.imagename是你要识别的图片的名字,不需要打引号,直接输入即可。
2.outputbase是输出结果文件的名字,不需要文件类型后缀,就是txt,这个参数就是txt的文件名。
3.lang是语言代码,默认英语,如果要识别中文,则:
  tesseract template.jpg a -l chi_sim
  若同时识别中英文,则使用+进行连接  
  tesseract template.jpg a -l chi_sim+eng
4.pagesegmode则用来匹配使用哪种识别模式
  正常键入tesseract会打印
    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.
    0 定向脚本监测(OSD)
    1 使用OSD自动分页
    2 自动分页,但是不使用OSD或OCR(Optical Character Recognition,光学字符识别)
    3 全自动分页,但是没有使用OSD(默认)
    4 假设可变大小的一个文本列。
    5 假设垂直对齐文本的单个统一块。
    6 假设一个统一的文本块。
    7 将图像视为单个文本行。
    8 将图像视为单个词。
    9 将图像视为圆中的单个词。
    10 将图像视为单个字符。

问题

java使用tess4j时在win环境可能会出现

 - java.lang.UnsatisfiedLinkError: 找不到指定的模块

的问题,主要原因是在Windows环境下,gsdll64.dll,liblept170.dll,libtesseract304.dll等三个文件是通过vc2013编译的。

点击此处进行安装。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值