Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency in APIExample #14

Open
NilsIrl opened this issue May 26, 2020 · 0 comments
Open

Inconsistency in APIExample #14

NilsIrl opened this issue May 26, 2020 · 0 comments

Comments

@NilsIrl
Copy link
Contributor

NilsIrl commented May 26, 2020

Moved from tesseract-ocr/tesseract#2832.

Current Behavior:

The the wiki page APIExample, for the python example, the handle api is is run through the TessBaseAPIDelete function if the api failed to be initialized whereas for the C example, this is not the case.

python:

rc = tesseract.TessBaseAPIInit3(api, TESSDATA_PREFIX, lang)
if (rc):
    tesseract.TessBaseAPIDelete(api)
    print("Could not initialize tesseract.\n")
    exit(3)

c:

if(TessBaseAPIInit3(handle, NULL, "eng") != 0)
    die("Error initializing tesseract\n");

Expected Behavior:

Either the python example doesn't destroy the api handle or the api handle is destroyed in the c example.

Suggested Fix:

Change either of the examples so they both do the same thing. I do not know tesseract enough to be able to tell which is the correct one. However, I feel like the correct one would be to add TessBaseAPIDelete to the C example as it seems to be an omission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant