-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example program (example.py) crashing at first run under python 3.9 windows #38
Comments
same, did you able to solve it? |
Hello goncallop, I managed to repair the cv2.line problem by PR #39. Nevertheless, the program runs into more problems under python 3.9:
Pretty similar in example_grounding.py
Probably all locations |
It's been a while, so I don't exactly remember what the numpy array
types/shapes of "classes" are, but ultimately you need to convert it to
a string or list of characters.
The code is still in python2.
`unichr` is just `chr` in python3.
The array conversion problem might have several causes.
`print(type(classes)); print(classes.shape); print(classes.dtype)` will
give you valuable debug information.
I wonder if doing a `classes.reshape(-1)` might help.
Thank you for picking this up. If you have time to contribute back your
changes that would definitely be appreciated by a lot of people that are
still downloading this despite its age :)
|
Hi everyone, you can change the code in
And this is my output:
|
Hi @zhixuanli,
Thank you! It works for me, too, but I don't know why: My knowledge of Python, CV and OCR is by far too limited... I came to this program because I want to read out photos like these: As far as I understand the processes I need to train and "ground" the picture. Obviously, |
C:\users\david\simple-ocr-opencv\simpleocr_init_.py:28: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif sys.platform is "win32":
showing after BlurProcessor (waiting for input)
showing ContourSegmenter contours (waiting for input)
showing image after segmentation by RawContourSegmenter (waiting for input)
showing segments filtered by LargeFilter (waiting for input)
showing segments filtered by SmallFilter (waiting for input)
showing segments filtered by LargeAreaFilter (waiting for input)
showing segments filtered by ContainedFilter (waiting for input)
Traceback (most recent call last):
File "example.py", line 15, in
test_chars, test_classes, test_segments = ocr.ocr(test_image, show_steps=True)
File "C:\users\david\simple-ocr-opencv\simpleocr\ocr.py", line 73, in ocr
self.segmenter.display()
File "C:\users\david\simple-ocr-opencv\simpleocr\processor.py", line 162, in display
p.display(display_before=False)
File "C:\users\david\simple-ocr-opencv\simpleocr\segmentation_aux.py", line 83, in display
draw_lines(copy, self.lines_tops, (0, 0, 255))
File "C:\users\david\simple-ocr-opencv\simpleocr\opencv_utils.py", line 115, in draw_lines
cv2.line(image, (0, y), (image.shape[1], y), color, line_width)
TypeError: only integer scalar arrays can be converted to a scalar index
The text was updated successfully, but these errors were encountered: