python tesseract "AttributeError: setImage" -
i'm trying make tesseract run in python:
...image numpy array (uint8)... tessapi = tesseract.tessbaseapi() tessapi.init(".","spa",tesseract.oem_default) tessapi.setvariable("tessedit_char_whitelist", "0123456789aceimnoprstu/imn") tessapi.setpagesegmode(tesseract.psm_auto) # setimage(imagedata, width, height, bytes_per_pixel, bytes_per_line) w = int(final.shape[1]) h = int(final.shape[0]) tessapi.setimage(image,w,h,1,w) text = tessapi.getutf8text() print text
and error: raise attributeerror(name) attributeerror: setimage can't figure out why. please, can me?.
check https://code.google.com/p/python-tesseract/source/browse/python-tesseract-0.9/src/tesseract.py
class tessbaseapi(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, tessbaseapi, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, tessbaseapi, name) __repr__ = _swig_repr def __init__(self): = _tesseract.new_tessbaseapi() try: self.this.append(this) except: self.this = __swig_destroy__ = _tesseract.delete_tessbaseapi __del__ = lambda self : none; __swig_getmethods__["version"] = lambda x: _tesseract.tessbaseapi_version if _newclass:version = staticmethod(_tesseract.tessbaseapi_version) __swig_getmethods__["getopencldevice"] = lambda x: _tesseract.tessbaseapi_getopencldevice if _newclass:getopencldevice = staticmethod(_tesseract.tessbaseapi_getopencldevice) __swig_getmethods__["catchsignals"] = lambda x: _tesseract.tessbaseapi_catchsignals if _newclass:catchsignals = staticmethod(_tesseract.tessbaseapi_catchsignals) def setinputname(self, *args): return _tesseract.tessbaseapi_setinputname(self, *args) def getinputname(self): return _tesseract.tessbaseapi_getinputname(self) ... def clearadaptiveclassifier(self): return _tesseract.tessbaseapi_clearadaptiveclassifier(self) def setimage(self, *args): return _tesseract.tessbaseapi_setimage(self, *args)
the function trying call is
def setimage(self, *args): return _tesseract.tessbaseapi_setimage(self, *args)
use uppcase s setimage, not lowercase
Comments
Post a Comment