ocr

How to detect location of characters using python 3.x

回眸只為那壹抹淺笑 提交于 2019-12-11 05:19:24
问题 I want to detect the location of each character in an image. I tried pytesseract as suggested in how to get character position in pytesseract but gives me an error import csv import cv2 from pytesseract import pytesseract as pt pt.run_tesseract('bw.png', 'output', lang=None, boxes=True, config="hocr") # To read the coordinates boxes = [] with open('output.box', 'rb') as f: reader = csv.reader(f, delimiter = ' ') for row in reader: if(len(row)==6): boxes.append(row) # Draw the bounding box img

Check if a curve is closed

江枫思渺然 提交于 2019-12-11 05:18:30
问题 How can I check efficiently if a curve is closed? For example look this figure: The curve will always be white on a black background. I tried with flood fill algorithm but not works well with this situation (I don't understand how modify it). Here the code: public static boolean isWhite(BufferedImage image, int posX, int posY) { Color color = new Color(image.getRGB(posX, posY)); int r=color.getRed(); int g=color.getGreen(); int b=color.getBlue(); if(r==0&&g==0&&b==0) return false; return true

TextRecognizer isOperational API always returns false

天大地大妈咪最大 提交于 2019-12-11 05:09:21
问题 I need to capture characters of an image so i am using TextRecognizer . My code is given below TextRecognizer textRecognizer = new TextRecognizer.Builder(mActivity.getGalleryApplication().getAndroidContext()).build(); if (!textRecognizer.isOperational()) { new AlertDialog.Builder(mActivity.getAndroidContext()) .setMessage("Text recognizer could not be set up :(").show(); return; } textRecognizer.release(); I have added dependencies in build.gradle as below: dependencies { compile 'com.google

removing horizontal lines from scanned image

心不动则不痛 提交于 2019-12-11 05:09:18
问题 Well tried morphology in Imagemagick, but unfortunately the output also affects the text, thus making it unsatisfactory for ocr. So is there any faster way to remove the lines from image without affecting the text for ocr? Input image: Imagemagick code: magick 1sa.jpg -morphology close:1 "1x4: 0,1,1,0" result.png Output image Edit: Thanks to all those who replied. I finally made it work by the following code: magick E:\1sa.jpg ( +clone -threshold 50% -negate -statistic median 219x1 ) -compose

How to set and get a variable in tesseract using C++

浪尽此生 提交于 2019-12-11 04:13:20
问题 I have a quick question: How to I get the variable in tesseract using C++. For example I want to set "load_system_dawg" to false `tesseract.setVariable("load_system_dawg",?);` Is ? = 0 and 1, or "true" and "false"? And also how to check the settings of a variable? `tesseract.getBoolVariable("load_system_dawg");` or `tesseract.getVariableAsString("load_system_dawg");` In all my cases and attempts the code breaks. Documentation Tesseract GetBoolVariable EDIT I am able to get a variable, but why

Adding custom phrases to Tesseract white list

痞子三分冷 提交于 2019-12-11 04:04:28
问题 I'm building a simple Tesseract application on Android it goals is to recognize simple command like CALL, MESSAGE, etc. Because the number of commands is small and fixed, I want to add them to white list so the program can achieve higher accuracy. How can I do that? Many thanks in advance :) 回答1: As far as I understand you cannot whitelist words in tesseract. You can only whitelist characters and digits using the following code snippet tessBaseAPI.setVariable(TessBaseAPI.VAR_CHAR_WHITELIST,

Python/C++/Java: Is there a library that will recognize characters and tell me where they are in an image?

血红的双手。 提交于 2019-12-11 03:35:53
问题 I've looked into PyTesser/Tesseract and as far I as I can tell, it only gives me a string once I input an image. However, I'd like to receive, instead, the coordinates/bounding rectangle of each character it recognized. The string itself might be useful for me later on, but right now that's now what I need. Assuming PyTesser/Tesseract don't offer me that functionality, is there something freely available (ie, not Matlab or something similar) that does? 回答1: According to this mailing list

Android Tesseract OCR on Android Studio [closed]

﹥>﹥吖頭↗ 提交于 2019-12-11 02:57:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . For a while I have been trying to include teseract in my android app on Android Studio (using this tutorial). Since it did not work after many trys (missing allheaders.h) I contacted the creators (blog Gautam Gupta and OCR Robert Theis)they told me to try it on eclipse. Since I am not very found of Eclipse

Python PIL to extract number from image

三世轮回 提交于 2019-12-11 02:42:34
问题 I have an image like this one: and I would like to have a black number written on white so that I can use an OCR to recognise it. How could I achieve that in Python? Many thanks, John. 回答1: If you just want to turn a white-on-black image to black-on-white, that's trivial; it's just invert: from PIL import Image, ImageOps img = Image.open('zero.jpg') inverted = ImageOps.invert(img) inverted.save('invzero.png') If you also want to do some basic processing like increasing the contrast, see the

Exception initializing Emgu.CV

痴心易碎 提交于 2019-12-11 02:32:32
问题 Hey this is my first time using this website, but I a problem. I saw this awesome youtube video about getting ocr to work with vb.net. Here the url: http://www.youtube.com/watch?v=Kjdu8SjEtG0 So I decided to download the emgu libraries, here the url: http://sourceforge.net/projects/emgucv/ I did everything the video say and I get this error: "An error occurred creating the form. See Exception.InnerException for details. The error is: The type initializer for 'Emgu.CV.OCR.Tesseract' threw an