goncalopp / simple-ocr-opencv

A simple python OCR engine using opencv
GNU Affero General Public License v3.0
525 stars 175 forks source link

error with the operator "-" in code #30

Closed nuclearWinters closed 6 years ago

nuclearWinters commented 6 years ago

TypeError: numpy boolean subtract, the - operator, is deprecated, use the bitwise_xor, the ^ operator, or the logical_xor function instead.

class ContainedFilter(Filter): """desirable segments are not contained by any other"""

def _good_segments(self, segments):
    m = contained_segments_matrix(segments)
    return (True - numpy.max(m, axis=1))

Should I install something or i need to change it manually?

nuclearWinters commented 6 years ago

srry I just ran it on the command promp and worked

mit456 commented 6 years ago

Hello,

I am getting the same error what do you mean by running on command prompt? I ran python3 example_grounding.py from my command line and it is failing?

RedFantom commented 6 years ago

@mit456 This is the same issue as #29 . Numpy has deprecated the - operator for arrays. @goncalopp did post he cherry-picked the fix, but I can't find it on any pushed branches. You can use a numpy version of 1.13.0 or earlier (if I'm not mistaken), or you could cherry-pick the changes from my fork of the repository from the numpy branch.

goncalopp commented 6 years ago

@RedFantom Thanks! You're absolutely right, the commit isn't there, apparently I cherry picked it back to master on 09/03, but forgot to push to github - I've fixed that now :)

@mit456 Can you please try the most recent version in the master branch and see if the problem goes away?

mit456 commented 6 years ago

@goncalopp It works with the latest master, I tested it.

goncalopp commented 6 years ago

@mit456 Great, thanks!