tesseract如何在Linux下卸载,Tesseract装配
Tesseract安装
【1】直接安装
1)Ubuntu 14.04下,可以直接安装发行包tesseract-ocr
sudo apt-get install tesseract-ocr
这样安装的系统在/usr/bin下,数据文件在/usr/share/tesseract-ocr/tessdata下(已经安装了eng包)
在/usr/local/lib/python*.*/dist-package下有一个文件夹pytesseract
(也许是我不小心装上去的,GitHub[https://github.com/madmaze/pytesseract]上写的是sudo pip install pytesseract安装),
这样就可以在Python中用tesseract了,例子如下:
import Image
import pytesseract
print pytesseract.image_to_string(Image.open('./Test/Python/t2.png'))
print pytesseract.image_to_string(Image.open('./Test/Python/t2.png'), lang='eng')
把我训练好的数字样本文件num.traineddata拷贝到数据文件目录下
print pytesseract.image_to_string(Image.open('./Test/Python/t2.png'), lang='num')
特殊的数字识别就很准了!
2)这样安装好的tesseract-ocr有一个问题,就是在Terminal下无法使用tesseract命令解析,报如下错误(但Python中可用):
Tesseract Open Source OCR Engine v3.03 with Leptonica
Error in pixReadStreamPng: function not present
Error in pixReadStream: png: no pix returned
Error in pixRead: pix not read
Error in pixGetInputFormat: pix not defined
Reading ./Test/Python/t2.png as a list of filenames...
Error in fopenReadStream: file not found
Error in pixRead: image file not found: �PNG
Image file �PNG cannot be read!
Error during processing.
网上说是因为Leptonica不认识png,tif,jpg格式(其实基本上什么格式都不认识,真不知道为什么还要基于这个库?)
(这个问题我还没有解决?????????????????)
--------------------------------------------------------------------------------------------
【2】从源码安装
1)首先需要安装leptonica,下载地址:www.leptonica.org/download.html,例如下载leptonica-1.68.tar.gz
然后安装,使用如下的基本安装方式就可以了(leptonica的定制安装有兴趣的再弄吧):
./configure [build the Makefile]
make [builds the library and shared library versions of all the progs]
sudo make install [as root; this puts liblept.a into /usr/local/lib/ and all the progs into /usr/local/bin/ ]
2)下载Tesseract,现在Tesseract托管到GitHub了(https://github.com/tesseract-ocr)。(不用FQ了去googlecode了下了!)
从GitHub下载代码,解压缩到某个目录(例如/tmp/tesseract)
3)安装
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
注意这样安装好的系统在/usr/local/bin下,数据文件在/usr/local/share/tessdata下!
其中可能会有如下错误:
[1]./autogen.sh时,报错一堆工具没有,则需要补齐相应工具:
没有aclocal sudo apt-get install automake
没有libtoolize sudo apt-get install libtool
如果再报没有其他工具,则执行这个工具,Ubuntu会告诉你如何安装它。
[2]数据问题
源码make出来的系统是没有数据的,必须至少安装一个数据包(一般是eng)才能运行系统,安装方法:
先下载数据包,然后解压缩到/usr/local/share/tessdata
[3]测试是否安装成功
先测试系统安装,运行tesseract,出现以下内容说明安装成功!
searchware@ubuntu:/usr/local/share/tessdata$ tesseract
Usage:tesseract 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
常见错误是没有语言数据,如下,这是需要按照前面说的安装好语言数据(最好装上eng,系统默认是eng,而且eng肯定用得上):
Error opening data file /usr/local/share/tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
Could not initialize tesseract.
然后测试文件识别,源码目录下有个phototest.tif文件,可以作为测试用。
tesseract phototest.tif test1 -l eng
常见错误是Leptonica不匹配,如下:
Tesseract Open Source OCR Engine v3.02.02 with Leptonica
Error in findTiffCompression: function not present
Error in pixReadStreamTiff: function not present
Error in pixReadStream: tiff: no pix returned
Error in pixRead: pix not read
Unsupported image type.
这个问题我还没有解决,网上说的方法不行(在Ubuntu 14.04上没试通)????????????????????????????????
tesseract如何在Linux下卸载,Tesseract装配相关推荐
- 教你如何在linux 下批量卸载
教你如何在linux 下批量卸载 最 近本来想在linux 下配置 JDK 6.0 用来开发java,然后遇到很多麻烦,一开始的时候屁颠屁颠的到SUN的网站去下载个 JRE 的bin 文件,这个文件比 ...
- linux下部署Tesseract OCR及调用
官方源码:github 详细教程:Installing Tesseract for OCR linux下直接终端运行 sudo apt-get install tesseract-ocr 查看是否安装 ...
- linux如何进u盘 命令,如何在linux下使用u盘
如何在linux下使用u盘 发布时间:2008-09-08 17:09:38 作者:佚名 我要评论 其实使用U盘也是一件简单的事情: 1.首先你要成为root用户. 2.然后 cd /mnt ...
- u盘linux下使用,如何在Linux下使用U盘
如何在Linux下使用U盘 U盘的主目录 您习惯于在Windows系统下即插即用U盘,在Linux系统下可能无法使用它. 为什么这么说由于Linux系统USB闪存驱动器被视为SCSI设备,因此无法直接 ...
- 如何在linux下做软raid
如何在linux下做软raid?希望以下介绍能对朋友们有所帮助和启发! 在虚拟机系统中添加一块10g的硬盘为sdb,将硬盘分5个逻辑盘分别是sdb{5,6,7,8,9},每个盘的大小是1G. 首先利用 ...
- 如何在Linux下使用rsync
如何在Linux下使用rsync 对于各种组织和公司,数据对他们是最重要的,即使对于电子商务,数据也是同样重要的.Rsync是一款通过网络备份重要数据的工具/软件.它同样是一个在类Unix和Windo ...
- 如何在linux系统下修改mysql密码_如何在linux下修改mysql数据库密码?linux修改数据库密码的方法...
本篇文章给大家带来的内容是介绍如何在linux下修改mysql数据库密码?linux修改数据库密码的方法.有一定的参考价值,有需要的朋友可以参考一下,希望对你们有所帮助. Linux下修改Mysql的 ...
- 如何在Linux下安装Docker
如何在Linux下安装Docker Docker概念: Docker包括三个基本概念: l 镜像(Image) l 容器(Container) l 仓库(Repository) 理解了这三个概念 ...
- 如何在Linux下安装MySQL8.0
如何在Linux下安装MySQL8.0 准备工作: mysql8.0 rpm文件 测试工具(比如 idea的database工具) 安装步骤: 1. 下载mysql的repo源,下载地址:ht ...
最新文章
- 小tips:JS中typeof与instanceof用法
- Science重磅!人类特有基因触发猴子长出更强大的大脑
- python难度大的题_早看少被坑!Python 最难的问题
- 没有搜索_没有明显足够搜索量关键词的类目产品应该怎么办?
- hdu 3047 Zjnu Stadium(并查集)
- 将当前的head推送到远程_Git 通俗易懂系列 三、远程仓库和标签
- django中URL常用配置方法
- 前后端分离导出excel_Vue + .NetCore前后端分离的快速发开框架
- Android真机调试时LogCat不显示日志信息
- 2021年低压电工模拟考试题库及低压电工作业考试题库
- 计算机技术转让增值税,技术转让免征增值税如何开票
- Python:实现zellers congruence泽勒一致算法(附完整源码)
- 齐向东:云计算时代的网络安全更重要
- 【文献心得】内存隔离技术研究现状调研
- linux查询系统硬件配置
- 阿飞播放器 android 万能播放器
- 内推网创始人黄小亮:拒绝猎头的P2P招聘
- MQTT与物联网平台(一):基础知识和设备接入物联网平台的实现(以华为云为例)
- PTA 单链表结点删除
- 批量将多个 Word 文件的软换行替换为硬换行
热门文章
- 推理集 —— 特殊的工具
- C 标准库 —— stdio.h
- 【剑指 offer】(十九)—— 二叉树镜像
- csdn markdown 的使用 (二)
- go token验证_GitHub - goflyfox/gtoken: 基于gf框架的token插件,通过服务端验证方式实现token认证;...
- java 二叉树 遍历_JAVA实现二叉树(简易版--实现了二叉树的各种遍历)
- python语言的读法-python是什么语言编写的
- 学python需要什么基础-要学 Python 需要怎样的基础?
- python利器-python利器APP下载-python利器 v4.0.1_手机乐园
- 学python需要什么基础-学习Python需要哪些基础知识?