tesseract

Using C API of tesseract 3.02 with ctypes and cv2 in python

家住魔仙堡 提交于 2020-01-01 03:19:07
问题 I am trying to use Tesseract 3.02 with ctypes and cv2 in python. Tesseract provides a DLL exposed set of C style APIs, one of them is as following: TESS_API void TESS_CALL TessBaseAPISetImage(TessBaseAPI* handle, const unsigned char* imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line); So far, my code is as follows: tesseract = ctypes.cdll.LoadLibrary('libtesseract302.dll') api = tesseract.TessBaseAPICreate() tesseract.TessBaseAPIInit3(api, '', 'eng') imcv = cv2.imread(

安装Python第三方包“tesserocr”的方法和遇到的坑

柔情痞子 提交于 2019-12-31 17:21:47
1. 环境: 系统环境:Win7 32 位系统 Python版本: 3.6.5 虚拟环境为:Miniconda3 2. 共需要安装的模块: a. tesserocr b. tesseract c. PIL 3. 安装方法: 我的 安装顺序 为:b -> a -> c 其实安装最为麻烦,报错最多的模块是tesserocr,我尝试了以下这些命令: pip install tesserocr pip3 install tesserocr conda install tesserocr conda install -c simonflueckiger tesserocr 前三个根本就是不行 最后一个确实是能找到tesserocr的资源,但是根本就下不动,我估计要是挂代理下载的话也许能行,有条件的可以试试。 最后我的解决办是参照了这篇博客: win7系统安装tesseract及tesserocr 中所讲的方法,在网上下载了 tesserocr-2.4.0-cp36-cp36m-win32.whl 这个.whl文件来安装,很好,安装的很顺利。 其中需要注意的是 ,当你执行: pip install tesserocr-2.4.0-cp36-cp36m-win32.whl 这条命令的时候,如果你没把你下载下来的.whl文件放在正确的文件目录下的话,这条语句会报错,提示你:tesserocr-2

Export HOCR output for tesseract OCR in android

孤人 提交于 2019-12-31 02:49:07
问题 I tried to use tess-two, a fork of Tesseract Tools for Android. I want to turn on hocr output in tesseract, from this link, I tried to set variable tessedit_create_hocr as true, but I can't see hocr in output. Here is my try: baseApi.init(FileUtil.getAppFolder(), "eng", TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED); baseApi.setVariable("tessedit_create_hocr", "1") baseApi.setImage(bitmap); String recognizedText = baseApi.getUTF8Text(); Somebody told the hocr output should be in config folder or in

tesseract-ocr

血红的双手。 提交于 2019-12-31 01:33:02
标签: pytesseract.pytesseract winerror 其实也不算自己写的,在网上东找找西找找,合一块问题就解决了。 和谐社会的程序猿不都这样么。。 上正菜。 先安装pillow windows 10上面先打开命令提示符: 注:不知道为啥我装python 3.5的时候蛋疼的选择了管理员安装,所以运行命令提示符的话也需要管理员权限。怎么操作就不说了。 1. 安装Pillow 2. 安装pytesseract 3. 再安装tesseract-ocr,注意这个很关系是文字识别的核心程序。 报错了,看来前面太顺了,python看不过去了。 至于报错的信息:error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools 让我去这个网站装 Microsoft Visual C++ 14.0相关的东东,N N D 我打开网站,下载之后安装,看所需要的空间 4GB。玩不起,还是算了,我是菜鸟,太多的东西不懂,所以不要为难我。 所以找其它方法装tesseract-ocr 这里面有tesseract-ocr for windows的安装方法

Tesseract-OCR-04-使用 jTessBoxEditor 进行训练

强颜欢笑 提交于 2019-12-31 01:32:44
Tesseract-OCR-04-使用 jTessBoxEditor 进行训练 本篇是关于 jTessBoxEditor 进行训练,使 Tesseract-OCR 文字识别准确率得到极大的提高,本篇完善了很多细节,初学者也可以看懂,一起学习吧! 想要一遍成功要细心关注【注意】,我踩过的坑都标出来了 训练的大致步骤: 1.安装 jTessBoxEditor 2.获取样本文件 3.Merge 样本文件 4.生成 .box 文件 5.定义字符配置文件 6.字符矫正 7.执行批处理文件 8.将生成的 num.trainddata 放入 Tesseract 安装目录的 tessdata 文件夹里 1.安装 jTessBoxEditor 下载jTessBoxEditor,地址https://sourceforge.net/projects/vietocr/files/jTessBoxEditor/ 解压后得到jTessBoxEditor 由于这是由Java开发的,所以我们应该确保在运行jTessBoxEditor前先安装JRE(Java Runtime Environment,Java运行环境) 没有安装 jre 的可以到官网下载安装: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155

linux安装tesseract

混江龙づ霸主 提交于 2019-12-29 23:38:53
# https://github.com/tesseract-ocr/tesseract/tree/4.0.0 https://codeload.github.com/tesseract-ocr/tesseract/zip/master # https://jaist.dl.sourceforge.net/project/tess4j/tess4j/3.4.8/Tess4J-3.4.8-src.zip http://www.leptonica.org/source/leptonica-1.74.4.tar.gz yum install gcc gcc-c++ yum install autoconf automake libtool yum install libjpeg-devel libpng-devel libtiff-devel zlib-devel tar -xzvf leptonica-1.74.4.tar.gz cd leptonica-1.74.4 ./configure make && make install export LD_LIBRARY_PATH=$LD_LIBRARY_PAYT:/usr/local/lib export LIBLEPT_HEADERSDIR=/usr/local/include export PKG_CONFIG_PATH=/usr

Disable dictionary in Tesseract

∥☆過路亽.° 提交于 2019-12-29 04:26:08
问题 How can I disable dictionary corrections when running Tesseract for English language? I'm currently running tesseract as a child process. 回答1: Try to set these variables (put them in a config file) to false: load_system_dawg load_freq_dawg load_punc_dawg load_number_dawg load_unambig_dawg load_bigram_dawg load_fixed_length_dawgs https://groups.google.com/forum/?fromgroups=#!searchin/tesseract-ocr/Disable$20dictionary$20in$20Tesseract/tesseract-ocr/5nvIo1DJxHE/f3gBi2pTKykJ Also read How to

Disable dictionary in Tesseract

左心房为你撑大大i 提交于 2019-12-29 04:26:06
问题 How can I disable dictionary corrections when running Tesseract for English language? I'm currently running tesseract as a child process. 回答1: Try to set these variables (put them in a config file) to false: load_system_dawg load_freq_dawg load_punc_dawg load_number_dawg load_unambig_dawg load_bigram_dawg load_fixed_length_dawgs https://groups.google.com/forum/?fromgroups=#!searchin/tesseract-ocr/Disable$20dictionary$20in$20Tesseract/tesseract-ocr/5nvIo1DJxHE/f3gBi2pTKykJ Also read How to

Apache Tika extract scanned PDF files

陌路散爱 提交于 2019-12-28 12:35:08
问题 i'm having some troubles using Apache TIKA (version 1.10). I got some PDF files which are just scanned pieces of paper. That means each page is just an image. My goal is to extract the text of the PDF files anyway. My tesseract is set up correctly and extracting JPG and PNG files works like a charm. The code i'm using looks like that (don't mind the missing excetion handling): public String extractText(InputStream stream) { AutoDetectParser parser = new AutoDetectParser(); BodyContentHandler

Tess4J: Invalid memory access

故事扮演 提交于 2019-12-28 07:03:05
问题 I am trying to use Tess4J in my project to extract text from an image. I am getting the following error when I try run the OCR: Exception in thread "main" java.lang.Error: Invalid memory access try { File imageFile = new File("example4.jpg"); Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping //Tesseract1 instance = new Tesseract1(); String result = instance.doOCR(imageFile); System.out.println(result); } catch (Exception e) { e.printStackTrace(); } 回答1: you can set the