tesseract

ocr识别开源软件tesseract试用记录

这一生的挚爱 提交于 2019-12-04 13:43:35
针对公司系统现场查验场景中,需要用到拍照识别并查验证件信息的需求。对其中关键的ocr开源软件tesseract技术进行了简单试用记录。 1、新建一个winform测试项目,通过nuget搜索安装tesseract的sdk。 2、去github下载语言包: https://github.com/tesseract-ocr/tessdata ,分各种语言,下载英文(eng.traineddata)以及中文(chi_sim.traineddata)的,下载完成后放到测试项目的\debug\tessdata目录下,注意只能是tessdata目录,名字不能错。 3、代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Tesseract; namespace TestOCR { public partial class Form1 : Form { public

Using Tesseract OCR in VC++

久未见 提交于 2019-12-04 13:20:20
In my project I have to read the numbers from the image(.jpg or .tiff). After googling a lot, I came to know about the open OCR i.e., Tesseract OCR. Am begginer for Tesseract OCR, I read all the documentation of tesseract & how to use it in Visual studio. Bascically am facing some problem in using tesseract... I followed the steps like this: 1) Downloaded & Installed tesseract-ocr-setup-3.02.02.exe from http://code.google.com/p/tesseract-ocr/downloads/detail?name=tesseract-ocr-setup-3.02.02.exe 2)Open up Microsoft Visual Studio 2008 and go to Tools -> Options Project solutions -> VC++

get Font Size in Python with Tesseract and Pyocr

空扰寡人 提交于 2019-12-04 13:13:46
Is it possible to get font size from an image using pyocr or Tesseract ? Below is my code. tools = pyocr.get_available_tools() tool = tools[0] txt = tool.image_to_string( Imagee.open(io.BytesIO(req_image)), lang=lang, builder=pyocr.builders.TextBuilder() ) Here i get text from image using function image_to_string . And now, my question is, if i can get font-size (number) too of my text. Using tesserocr , you can get a ResultIterator after calling Recognize on your image, for which you can call the WordFontAttributes method to get the information you need. Read the method's documentation for

Tesseract 3.x multiprocessing weird behaviour

浪尽此生 提交于 2019-12-04 12:28:56
问题 I am not sure whether it is my infrastucture that does this weird stuff or the tesseract-ocr itself. Whenever i use image_to_stirng in single-process environment - the tesseract-ocr works fine. But when I spawn multiple workers with gunicorn and all of them get to do some work with ocr reading - the tesseract-ocr starts reading very poorly (and not from performance-vise, but accuracy-vise). Even after the load is done - tesseract never has the same accuracy. I need to restart all the workers

How to sort an array of rectangles by position?

眉间皱痕 提交于 2019-12-04 12:22:12
I've just realized that if I perform OCR process only on the regions that contain text, it would be a lot faster. So what I did were detecting the text regions in the image and then perform OCR process on each one of them. This is the result of "detecting text regions" step using OpenCV (I used it to draw the rectangles on the image): The only problem remains is I couldn't arrange the text result in the order that they appear on the original image. In this case, it should be: circle oval triangle square trapezium diamond rhombus parallelogram rectangle pentagon hexagon heptagon octagon nonagon

pytesseract using tesseract 4.0 numbers only not working

自闭症网瘾萝莉.ら 提交于 2019-12-04 12:21:25
问题 Any one tried to get numbers only calling the latest version of tesseract 4.0 in python? The below worked in 3.05 but still returns characters in 4.0, I tried removing all config files but the digits file and still didn't work; any help would be great: im is an image of a date, black text white background: import pytesseract im = imageOfDate im = pytesseract.image_to_string(im, config='outputbase digits') print(im) 回答1: You can specify the numbers in the tessedit_char_whitelist as below as a

python Tesseract安装方法

人盡茶涼 提交于 2019-12-04 10:53:53
python Tesseract安装方法 EXE可执行文件地址:http://download.csdn.net/download/whatday/7740469; 下载tesseract-ocr-setup-3.02.02.exe安装包,安装成功后会在相应磁盘下有Tesseract-OCR文件夹 设置path环境变量 还有新建TESSDATA_PREFIX环境变量 D:\Program Files (x86)\Tesseract-OCR加进去就可以了 tesseract --list-langs  #查看Tesseract-OCR支持语言 如果要识别简体中文 就要下载字库 简体中文字库文件下载地址为:http://download.csdn.net/detail/wanghui2008123/7621567下载完成后解压,然后将该文件剪切到tessdata目录下去就可以了。 运行下 <pre> tesseract C://Users/Administrator/Desktop/1.jpg C://Users/Administrator/Desktop/output –l chi_sim </pre> 然后会生成output.txt文件 打开就可以看到转化的文字 来源: https://www.cnblogs.com/newmiracle/p/11856314.html

How to use trained data with pytesseract?

北城余情 提交于 2019-12-04 10:27:21
Using this tool http://trainyourtesseract.com/ I would like to be able to use new fonts with pytesseract. the tool give me a file called *.traineddata Right now I'm using this simple script : try: import Image except ImportError: from PIL import Image import pytesseract as tes results = tes.image_to_string(Image.open('./test.jpg'),boxes=True) file = open('parsing.text','a') file.write(results) print(results) How to I use my traineddata file so I'm able to read new font with the python script ? thanks ! edit#1 : so I understand that *.traineddata can be used with Tesseract as a command-line

tesseract error - Image too large

安稳与你 提交于 2019-12-04 10:10:09
I am getting below error from tesseract for an image of size 5+ MB. Tesseract Open Source OCR Engine v3.01 with Leptonica Page 0 Image too large: (39667, 56133) Error during processing. Is there a limit on file size or is there a parameter to resolve this issue. Appreciate your help.. It's not the file size but rather the image size (dimension) that exceeds Tesseract limits. I have no problems with Tesseract recognizing 16MB image. Try resize or rescale your image and try again. The maximum width and height are 32767. From the source code (file baseapi.cpp): if (tesseract_->ImageWidth() > MAX

Image Preprocessing steps to improve the recognition rate

谁说胖子不能爱 提交于 2019-12-04 10:05:26
问题 I am making a simple OCR Android App using TessBaseAPI for my project. I have done some image preprocessing steps like binarization and image inhancement. But their result is 50% to 60%. How can we improve the recognition rate? I include two sample images. http://imageshack.us/photo/my-images/94/1school.jpg/ http://imageshack.us/photo/my-images/43/15071917.jpg/ 回答1: The following additions to above command works for your second image: -negate \ -deskew 40% \ +repage \ -crop 393x110+0+0 \ They