More complex solution:
http://www.sk-spell.sk.cx/getting-component-coordinates-with-python-from-tesseract-c-api

Zdenko


On Thu, Dec 5, 2013 at 7:56 PM, zdenko podobny <[email protected]> wrote:

>  You need to use leptonica (e.g. via ctypes, but there is also python
> module pylepthonica).
>
> Modify relevant part of script with something like this:
>
>
> lep = ctypes.cdll.LoadLibrary("liblept.so")
> pix_image = lep.pixRead(filename)print "image width:", 
> lep.pixGetWidth(pix_image)print "image height:", lep.pixGetHeight(pix_image)
>
> tesseract.TessBaseAPISetImage2(api, pix_image)
> tesseract.TessBaseAPISetRectangle(api, 30, 60, 400, 100)
> text_out = tesseract.TessBaseAPIGetUTF8Text(api)
> result_text = ctypes.string_at(text_out)print result_text
>
>
> Zdenko
>
>
> On Thu, Dec 5, 2013 at 10:34 AM, Sneha Murganoor <[email protected]>wrote:
>
>> Hi Zdenko,
>>
>> how to get size of image and set recognition to a sub-rectangle of the
>> image in this?
>>
>> Thanks,
>> Sneha
>>
>>
>> On Wed, Dec 4, 2013 at 11:18 AM, Sneha Murganoor <[email protected]>wrote:
>>
>>> Zdenko,
>>>
>>> It is just excellent. It works very well. Thank you.
>>>
>>> Thanks,
>>> Sneha
>>>
>>>
>>> On Wed, Nov 20, 2013 at 6:59 PM, Nick White <[email protected]>wrote:
>>>
>>>> Hi Zdenko,
>>>>
>>>> On Wed, Nov 20, 2013 at 02:19:07PM +0100, zdenko podobny wrote:
>>>> > Anyway you can use tesseract 3.02.02 in python via ctypes - see
>>>> example[1]
>>>> >
>>>> > [1]
>>>> https://code.google.com/p/tesseract-ocr/source/browse/trunk/contrib/
>>>> > tesseract-c_api-demo.py?r=903
>>>>
>>>> That's neat, I hadn't seen python's ctypes before! Any chance you
>>>> could add that (or a link to it) to the APIExample wiki page?
>>>>
>>>> Nick
>>>>
>>>> --
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "tesseract-ocr" group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/tesseract-ocr?hl=en
>>>>
>>>> ---
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "tesseract-ocr" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/tesseract-ocr/tfi9RrPk3_E/unsubscribe
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>
>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "tesseract-ocr" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/tesseract-ocr?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "tesseract-ocr" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to