I am trying to detect digits located inside a grid and to tell their positions in an image and don't know where to start. So any help is welcome. So far I have used GT Text software but it didn't solve the purpose. Any helper function, libraries, tutorials, links or anything is welcome.
-
Is this what you are looking for stackoverflow.com/questions/9413216/… ?MartyIX– MartyIX2015-11-27 12:51:40 +00:00Commented Nov 27, 2015 at 12:51
-
Can digits be detected without the training set ? Because in the question which I have to solve conditions allow only one image to be input and that too the experimental one.Heisenberg– Heisenberg2015-11-27 14:19:42 +00:00Commented Nov 27, 2015 at 14:19
-
I don't know. I would try to ask people who work with OpenCV: irc.freenode.net at #opencvMartyIX– MartyIX2015-11-27 14:27:26 +00:00Commented Nov 27, 2015 at 14:27
Add a comment
|
1 Answer
You should check out the pytesseract module:
https://pypi.python.org/pypi/pytesseract/0.1
It has a one-liner for what you're trying to do:
try:
import Image
except ImportError:
from PIL import Image
import pytesseract as tes
results = tes.image_to_string(Image.open('test.png'),boxes=True)
This will give you results, which has each digit and the image coordinates of its bounding box.
You will need to install PIL (python image library, pip install PIL) and the tesseract c library (brew install tesseract if you have homebrew..) so it's not super trivial but once you have it working, this is the most straight forward OCR in python, and requires no training whatsoever.