【技术】Google开源OCR项目Tesseract安装版在Windows下的使用测试记录

开源OCR项目有很多,给大家一个链接,这个链接列出了现有的比较出名的OCR开源项目,链接如下:

https://en.wikipedia.org/wiki/Comparison_of_optical_character_recognition_software

从上面的排名可以看到,Tesseract是排在第一名的,所以咱们就先研究和测试它吧!

首先下载Tesseract在Windows下的安装版。(因为在国外访问不了谷歌,所以我翻墙下载了下来,这里给大家百度网盘链接)

http://pan.baidu.com/s/1i56Uxlr

下载下来之后一路Next安装好,然后在开始菜单找到其控制台引导程序,如下图所示:

上面的安装包里自带了已经训练好的英文-拉丁文识别数据~所以我们先来测试一下英文字符的识别吧~识别图像如下:

上面这幅图片的下载链接:http://pan.baidu.com/s/1c9k4X4

把上面的图片放到Tesseract的安装目录下,如下图所示:

然后打开上面提到的控制台窗口,如下图所示:

在窗口中输入命令:“tesseract.exe 03.jpg 3”,并回车,如下图所示:

解释一下:03.jpg代表待识别的源文件,3代表输出文件名,默认输出格式是txt文件格式!

如果你不知道命令的参数格式,可以像下面这样查询:

注意,上面的 lang之前是-l 而不是-1!

输入命令“tesseract.exe 03.jpg 3”后,在安装目录下生成了3.txt文件,这是识别结果,如下图所示:

可见,对英文字符的识别率还是挺不错的。

接下来,我们测试下对中文的识别。首先要把中文训练数据放到目录C:\Program Files (x86)\Tesseract-OCR\tessdata 下边,如下图所示:

图片中的chi_tra.traineddata下载链接:http://pan.baidu.com/s/1nvaYhJz

然后在目录中放入测试图片04.jpg 05.jpg 这两幅图的下载链接为:http://pan.baidu.com/s/1qXUMwOk

如下图所示:

  

然后在CMD窗口中分别输入如下命令:

tesseract.exe 04.jpg 5 -l chi_tra

tesseract.exe 05.jpg 5_2 -l chi_tra

运行结果如下图所示:

 

可见,结果非常不理想,所以接下来的任务就是要研究怎样提高识别率了,当然这是后话了,本文就先写到这样!

转自:https://blog.csdn.net/wenhao_ir/article/details/52213224

发布了392 篇原创文章 · 获赞 492 · 访问量 241万+
展开阅读全文

如何使用Google Cloud OCR进行图像到文本识别

05-19

<div class="post-text" itemprop="text"> <p>I will highly appreciate if we can set up here a step by step working example of how to use Google Cloud API services for image to text OCR recognition. I want to get a text from an image. As far as I read: 1. You need to set up credentials to use this API which I did it and as result I had to download a file (I hided the real keys & private_key):</p> <pre><code>{ "type": "service_account", "project_id": "carcheck-login", "private_key_id": "replace with yours", "private_key": "-----BEGIN PRIVATE KEY-----replace with yours -----END PRIVATE KEY----- ", "client_email": "carcheck@carcheck-login.iam.gserviceaccount.com", "client_id": "replace with yours", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/carcheck%40carcheck-login.iam.gserviceaccount.com" } </code></pre> <p>But from here what is next? How do I include the php or JS library and where I download it? </p> <p>I found some functions and sample how to read image here: <a href="https://cloud.google.com/vision/docs/detecting-text#vision-text-detection-php" rel="nofollow noreferrer">https://cloud.google.com/vision/docs/detecting-text#vision-text-detection-php</a> but it is now clear how to use these first 2 lines:</p> <pre><code>namespace Google\Cloud\Samples\Vision; use Google\Cloud\Vision\V1\ImageAnnotatorClient; </code></pre> <p>and where to download their libraries..</p> <p>Please help to add the missing part so this can be used as a working example</p> <p>Thanks for your time</p> </div> 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览