Skip to content
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

ValueError: setting an array element with a sequence. #55

Closed
braddockcg opened this issue Sep 3, 2015 · 4 comments
Closed

ValueError: setting an array element with a sequence. #55

braddockcg opened this issue Sep 3, 2015 · 4 comments
Labels

Comments

@braddockcg
Copy link

On some images, rpred and rtrain's dewarp function throws an error because the padding is insufficient. This seems to be particularly true of images which have borders or other noise near the top and bottom edges. Attached is an example.

ocropy-bug-example

I have a simple, but unsatisfying, fix for this where I double the amount of padding. See my github fork commit (branch bugfix) at:
braddockcg@be2e6d1

The full error is:

Traceback (most recent call last):
File "/usr/local/bin/ocropus-rpred", line 245, in safe_process1
return process1(arg)
File "/usr/local/bin/ocropus-rpred", line 145, in process1
line = lnorm.normalize(line,cval=amax(line))
File "/usr/local/lib/python2.7/dist-packages/ocrolib/lineest.py", line 59, in normalize
dewarped = self.dewarp(img,cval=cval,dtype=dtype)
File "/usr/local/lib/python2.7/dist-packages/ocrolib/lineest.py", line 56, in dewarp
dewarped = array(dewarped,dtype=dtype).T
ValueError: setting an array element with a sequence.

@tmbdev
Copy link
Collaborator

tmbdev commented Oct 11, 2015

Thanks; I'll look into this again soon, when I get around to cleaning up some of this code.

@zuphilip
Copy link
Collaborator

zuphilip commented Oct 24, 2016

The picture is a color image and it should be just a black/white picture. If you binarize the picture, then the ocropus-rpred is working as it should. It looks that the check, which should prevent that case, is not working correctly.

@zuphilip
Copy link
Collaborator

While my comment above is true, it seems that this is more like some coincident and a real fix should somehow increase the padding. I created now another PR #133 extending your idea, which will solves this issue then.

@zuphilip
Copy link
Collaborator

Closed by #133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants