Problem porting Lua code from Ocropus 0.4 to 0.6 (python)

27 views
Skip to first unread message

snorrsi

unread,
Mar 8, 2013, 10:05:14 AM3/8/13
to ocr...@googlegroups.com
dear readers,

I am having a trouble porting code from Lua to Python.

The code I am having trouble with at the moment is however from usage iulib
What I am currently trying to do is to use iublib.binary_open_rect(vert,1,20)

    iulib.binary_open_rect(image4,3,4) # image4,1,) # 20)
  File "/usr/local/lib/python2.7/dist-packages/iulib.py", line 1961, in binary_open_rect
    return _iulib.binary_open_rect(*args)
TypeError: in method 'binary_open_rect', argument 1 of type 'bytearray &'

Can anyone tell me of what type it should be.

Is there any document which has information regarding porting Ocropus code from Lua to Python?

best regards,
Snorri

Tom

unread,
Apr 10, 2013, 1:34:33 AM4/10/13
to ocr...@googlegroups.com
The code I am having trouble with at the moment is however from usage iulib
What I am currently trying to do is to use iublib.binary_open_rect(vert,1,20)

    iulib.binary_open_rect(image4,3,4) # image4,1,) # 20)
  File "/usr/local/lib/python2.7/dist-packages/iulib.py", line 1961, in binary_open_rect
    return _iulib.binary_open_rect(*args)
TypeError: in method 'binary_open_rect', argument 1 of type 'bytearray &'

You're trying to call an iulib library function that takes a bytearray as its first argument; those bytearrays are the C++ objects defined in iulib. You seem to be giving it some other kind of object, maybe a Python array.

iulib isn't really used in OCRopus anymore, although you can still use it as a C++/Python library of course. We're mostly using SciPy's ndimage library now for image processing. It has some rough edges (in particular in the morphology code), but it gets the job done. You might want to consider switching to it as well.

Tom
Reply all
Reply to author
Forward
0 new messages