-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
C-API for OSResults (orientation and script results) is not a stable ABI #424
Comments
Thank you for you investigation. |
Posted |
The suggestion looks good to me. @zdenop, I suggest to give @jbarlow83 a green light for sending a PR. |
I must admit that I had to look into the code what "OS" means in the context of OCR. Maybe it is possible to find a better name with "Orientation and Script" ("OaS"?). PS. I just noted that the title of this issue also had the information which I was looking for. |
@jbarlow83 will you create PR? |
Yes, working on it. |
See issue tesseract-ocr#424. The existing C API for TessBaseAPIDetectOS requires a C caller to successfully allocate struct OSResults which is actually a C++ class. Generally it won't be possible for a regular C compiler to do this properly. It's also assumed that most API level users of Tesseract are only interested in Tesseract's best guess as to script and orientation, not the individual values for all possible scripts. This introduces a new API with a better name that is more closely aligned with the output of 'tesseract -psm 0'. Both tesseract -psm 0 and this API now share the same code in baseapi.cpp.
fixed with 3a47adc |
See issue #424. The existing C API for TessBaseAPIDetectOS requires a C caller to successfully allocate struct OSResults which is actually a C++ class. Generally it won't be possible for a regular C compiler to do this properly. It's also assumed that most API level users of Tesseract are only interested in Tesseract's best guess as to script and orientation, not the individual values for all possible scripts. This introduces a new API with a better name that is more closely aligned with the output of 'tesseract -psm 0'. Both tesseract -psm 0 and this API now share the same code in baseapi.cpp.
See issue tesseract-ocr#424. The existing C API for TessBaseAPIDetectOS requires a C caller to successfully allocate struct OSResults which is actually a C++ class. Generally it won't be possible for a regular C compiler to do this properly. It's also assumed that most API level users of Tesseract are only interested in Tesseract's best guess as to script and orientation, not the individual values for all possible scripts. This introduces a new API with a better name that is more closely aligned with the output of 'tesseract -psm 0'. Both tesseract -psm 0 and this API now share the same code in baseapi.cpp.
See issue tesseract-ocr#424. The existing C API for TessBaseAPIDetectOS requires a C caller to successfully allocate struct OSResults which is actually a C++ class. Generally it won't be possible for a regular C compiler to do this properly. It's also assumed that most API level users of Tesseract are only interested in Tesseract's best guess as to script and orientation, not the individual values for all possible scripts. This introduces a new API with a better name that is more closely aligned with the output of 'tesseract -psm 0'. Both tesseract -psm 0 and this API now share the same code in baseapi.cpp.
See issue tesseract-ocr#424. The existing C API for TessBaseAPIDetectOS requires a C caller to successfully allocate struct OSResults which is actually a C++ class. Generally it won't be possible for a regular C compiler to do this properly. It's also assumed that most API level users of Tesseract are only interested in Tesseract's best guess as to script and orientation, not the individual values for all possible scripts. This introduces a new API with a better name that is more closely aligned with the output of 'tesseract -psm 0'. Both tesseract -psm 0 and this API now share the same code in baseapi.cpp.
See issue tesseract-ocr#424. The existing C API for TessBaseAPIDetectOS requires a C caller to successfully allocate struct OSResults which is actually a C++ class. Generally it won't be possible for a regular C compiler to do this properly. It's also assumed that most API level users of Tesseract are only interested in Tesseract's best guess as to script and orientation, not the individual values for all possible scripts. This introduces a new API with a better name that is more closely aligned with the output of 'tesseract -psm 0'. Both tesseract -psm 0 and this API now share the same code in baseapi.cpp.
The existing C API for
TessBaseAPIDetectOS
requires a C caller to successfully allocatestruct OSResults
which is actually a C++ class. If the C++ compiler decides to append anything to the structure, this will fail. The definition of this struct also depends onkMaxNumberOfScripts
so is subject to change if (when) Tesseract adds more scripts.The struct members that a caller is most likely to want are actually in
OSBestResult
whose position may shift.I suggest deprecating this API and providing one that returns the member elements of
OSBestResult
instead. I think it would be useful to have a C API call to obtain this information rather than parsing the executable's output in-psm 0
. Here's one possible API.Returning
OSBestResults
is also an option, but sometimes it's nice to avoid structs entirely.I can contribute changes if there's agreement on them.
The text was updated successfully, but these errors were encountered: