dlareklami / tesseract-ocr

Automatically exported from code.google.com/p/tesseract-ocr
Other
0 stars 0 forks source link

Add TessChoiceIterator + methods to C API #1149

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I added the TessChoiceIterator to the C API to have access to symbol choice 
alternatives from my Java code. I attached a patch to merge it into the main 
repository.

It introduces the following methods:

    TESS_API const TessChoiceIterator* TESS_CALL TessResultIteratorGetChoiceIterator(const TessResultIterator* handle);

    TESS_API BOOL  TESS_CALL TessChoiceIteratorNext(TessChoiceIterator* handle);
    TESS_API const char* TESS_CALL TessChoiceIteratorGetUTF8Text(const TessChoiceIterator* handle);
    TESS_API float TESS_CALL TessChoiceIteratorConfidence(const TessChoiceIterator* handle);

as well as one typedef

    typedef tesseract::ChoiceIterator TessChoiceIterator;

With this patch, I was able to use the symbol choices API example 
(https://code.google.com/p/tesseract-ocr/wiki/APIExample) through a BridJ 
wrapper I created. It already works in production.

Original issue reported on code.google.com by p.vorb...@gmail.com on 2 May 2014 at 9:52

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks. Fixed in revision 1091.

Original comment by zde...@gmail.com on 3 May 2014 at 9:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for merging the patch!

I forgot to also add the corresponding delete function:

    TESS_API void TESS_CALL TessChoiceIteratorDelete(TessChoiceIterator* handle);

I attached another patch that includes the TessChoiceIteratorDelete. I also 
recognized that I used tabs for indentation instead of spaces which also is 
fixed by the patch.

Original comment by p.vorb...@gmail.com on 3 May 2014 at 8:09

Attachments:

GoogleCodeExporter commented 9 years ago
OK. Just remark - patch has mixed EOL (unix and windows). I will commit it soon.

Original comment by zde...@gmail.com on 3 May 2014 at 8:17

GoogleCodeExporter commented 9 years ago
Sorry, I was wondering why the diff included changes for obviously equal lines 
but I didn't notice the difference in eols. I'm new to VisualStudio and 
configuring it properly can be tedious...

Original comment by p.vorb...@gmail.com on 4 May 2014 at 12:07

Attachments:

GoogleCodeExporter commented 9 years ago
This change stopped the C-API being useable if it isn't being called with 
baseapi, as TessChoiceIterator would be an undefined type.

Attached is a patch to fix that.

Original comment by nick.wh...@durham.ac.uk on 7 May 2014 at 3:42

Attachments:

GoogleCodeExporter commented 9 years ago
Sure, a very basic example program, and the error output when compiling, 
attached.

Original comment by nick.wh...@durham.ac.uk on 7 May 2014 at 6:21

Attachments:

GoogleCodeExporter commented 9 years ago
thanks. Fixed if r1095

Original comment by zde...@gmail.com on 7 May 2014 at 8:54