TTesseractOCR4 icon indicating copy to clipboard operation
TTesseractOCR4 copied to clipboard

Project settings : Record field alignment

Open Ykurfeza opened this issue 1 year ago • 0 comments

First, thank you for the work put into TTesseractOCR4 for delphi, that helps a lot! Actually working on Delphi 11.3.

I just discovered after some testing and debugging, that the record field alignement is important for the dll to work correctly.

For about a day I was trying to implement Tesseract into my project without success, using the same dlls and trained data files as your project examples, I wasn't able to make mine working (always crashing on the recognize call to the api with an adress error), but the example worked just fine with exactly the same data (images etc.).

After comparing the project settings, I found out that mine had the option "Record field alignment" (Project > Options > Delphi Compiler > Compiling > Code Generation Options) set to Bytes and that your example had it set to "Quad words".

This option cannot be change in my project, but putting the compiler directives {$A+}{$A8} at the beginning of the tesseractocr.capi file solved the issue for me even when keeping the options set to Bytes in delphi project.

Maybe it should be added by default in the source for it to work independently from the project settings? At least it's a good solution at the moment for me (maybe not the best).

Ykurfeza avatar Jul 20 '23 07:07 Ykurfeza