Closed hryamzik closed 11 years ago
That's curious. I assume this is on the latest published commit (c5a985)? I get the RuntimeWarning on example.py there too, although the example works; I've been doing something some changes that probably belong on a unstable branch Can you try example.py on commit bce590 and see if that works?
Thanks, I'll give this commit a try and will let you know. FYI, here's a possible explanation: http://stackoverflow.com/questions/2752913/why-does-python-array-module-process-strings-and-lists-differently
I get the same issue...
$ python example.py
Traceback (most recent call last):
File "example.py", line 12, in
and after changing the "L" for "I" in classification.py line 17:
$ python example.py
/usr/lib/python2.7/dist-packages/numpy/lib/function_base.py:489: RuntimeWarning: invalid value encountered in divide
avg = a.mean(axis)
Traceback (most recent call last):
File "example.py", line 15, in
P.S: this is from the most current master branch
@pedropatinho As I mentioned, the current master is unusable (my bad) Did you try commit bce590 ? If you get the same result there I'll look into it
Trying it now. Seems to work, but had to change the "L" to "I" in classification.py. Otherwise, would get the first error I reported above.
If anyone is reading this, pedropatinho's second letter is not a lowercase "L", it is an upper case "i".. (Github's fonts)
Not only github's, stackoverflow's as well. Just copy and paste! ;-)
If someone having this problem can attach the output of this program I'd be grateful.
import struct
import array
print struct.calcsize("L")
print struct.calcsize("I")
print array.array("L").itemsize
print array.array("I").itemsize
Here it goes:
$ python Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import struct import array print struct.calcsize("L") 8 print struct.calcsize("I") 4 print array.array("L").itemsize 8 print array.array("I").itemsize 4
8 4 8 4
Ok, I've pushed a bugfix branch. Let me know if it runs smoothly, then I'll rebase the master branch to point there.
Well, it works with the example.py, but I'm stucked into getting it to work with my own .png files...
This is more like a question than a bug report, but could you give some details on how to work with my own images? I don't know much about image processing, I'm just trying to do some ocr... When I put an image (some crop of the digits1 or digits2), I get this error:
Traceback (most recent call last):
File "example2.py", line 15, in
Also, how do I generate my own .box file? I've been browsing the source, but couldn't find it.
Thanks for your efforts, Pedro.
@pedropatinho
I don't know much about image processing, I'm just trying to do some ocr...
This is intended as an educational project. It's purposefully simple, still very immature and will always have below-average performance as a OCR engine. If you just want to do OCR, you'll probably want to look into Tesseract, or a commercial solution if you need a GUI.
Exception: different number of lines
This currently happens when the engine has trouble guessing the text lines location. I've recently changed the algorithm for this, so you may want to check if the previous one works better for you (check commit c886ac).
Also, how do I generate my own .box file? I've been browsing the source, but couldn't find it.
check issue #2 It's also worth noticing that the box files are in Tesseract's format
/simple-ocr-opencv/clustering.py:45: RuntimeWarning: invalid value encountered in divide return min(tmp) / max_intra_distance Traceback (most recent call last): File "example.py", line 15, in
test_classes, test_segments= ocr.ocr( test_image, show_steps=True )
File "/simple-ocr-opencv/ocr.py", line 40, in ocr
segments= self.segmenter.process( image_file.image )
File "/simple-ocr-opencv/processor.py", line 87, in process
output= self._process(arguments)
File "/simple-ocr-opencv/processor.py", line 131, in _process
arguments= p.process( arguments )
File "/simple-ocr-opencv/processor.py", line 87, in process
output= self._process(arguments)
File "/simple-ocr-opencv/segmentation_aux.py", line 91, in _process
raise Exception("different number of lines")
Exception: different number of lines