r1me / ttesseractocr4 Goto Github PK
View Code? Open in Web Editor NEWObject Pascal binding for tesseract-ocr - an optical character recognition engine
License: MIT License
Object Pascal binding for tesseract-ocr - an optical character recognition engine
License: MIT License
Orientation returns ORIENTATION_PAGE_UP no matter what orientation I feed in to it.
Simply said it dose not work
Took data from https://github.com/tesseract-ocr/tesseract/wiki/Data-Files#data-files-for-version-400-november-29-2016
Ver 4
compile with Delphi 10.2.1
Load 2 demo picture
On the simple one got text gifi'gégzgéégzizfiséZi,.
On the more complex nothing except error at
if (TessBaseAPIRecognize(FTessBaseAPI, FProgressMonitor) = 0) then
floating point error
Hello
I've tried to export image to PDF, it generates the pdf, but the text is not searchable.
Hi
I'm not sure if this will be seen or not but I'm hoping it might.
I am trying to utilise the library (which looks amazing by all accounts and thank you for making it) and I can see how it works well via the Freepascal\Lazarus example and the use of .SetImage for a traditional file.
However, I am trying to use .SetImage in the third form, that being via use of a Pointer to a buffer.
function SetImage(const ABuffer: Pointer; AImageWidth, AImageHeight: Integer;
ABytesPerPixel: Integer; ABytesPerLine: Integer): Boolean; overload;
As far I can tell, the buffer contains valid data from a picture file and the function returns success. I have passed the various properties like BytesPerLine etc to the function. So all good there.
So the next step is .RecognizeAsText. This calls .RecognizeInternal and this is where my problem hits. It gets to line 460 which calls :
TThread.Synchronize(nil, {$IFDEF FPC}@{$ENDIF}Tesseract.SynchronizeBegin);
So it then jumps to .SynchronizeBegin which is :
procedure TTesseractOCR4.SynchronizeBegin;
begin
if Assigned(FOnRecognizeBegin) then
OnRecognizeBegin(Self);
end;
Sadly, it is here where I get the following exception issue :
I have spent more time than I care to acknowledge trying to work out why this is and I cannot see the problem. And sadly there seems to be few (perhaps no) examples of others using the library with memory buffers. They all seem to use the standard default file based option.
So I am trying to determine if there is a problem\bug with the library in this regard or whether it is indeed just an error with my code which is highly likely, but having spent so long looking at it I thought I'd raise the possibility that perhaps the library needs a tweak?
I am using Lazarus 2.0.10 and FPC 3.2.0.
Many thanks
It's possible get the progress of the pdf creation to show it in a progressbar ?
Does it works with Lazarus on Linux ?
Thanks
...
Hi,
Thank you for providing complete solution with MIT license.
I wonder if there is any plan on updating project for v5 support?
Regards,
Ertan
Hi
Is there a way to set the confidence level? --min-conf 50, for example?
I am using the library well now, and it works great for many "obvious" files. But there are some that seem to be tricking or folling .RecognizeAsText; that causes an exception error.
I'd like to be able to "analyse" the image file first, before attempting the actual OCR, and then only do the OCR if there seems to be a reasonable assessment that text exists. For example, only if there is a 50% confidence level, attempt the OCR.
Any thoughts?
Hello
I'm getting this error while trying to create pdf from attached file.
I'm using portuguese language.
Thanks.
I try to run delphi_console_simple example and get AV in TTesseractOCR4.Initialize on the TessBaseAPIInit2 call.
lstm_recognizer_->DeSerialize(&fp):Error:Assert failed:in file C:\Users\rime.cppan\storage\src\38\cb\0305\ccmain\tessedit.cpp, line 193
Exception EAccessViolation in module pvt.cppan.demo.google.tesseract.libtesseract-master.dll at 000839A9.
Access violation at address 583439A9 in module 'pvt.cppan.demo.google.tesseract.libtesseract-master.dll'. Read of address 00000000.
I use Tokyo 10.2.1, tesseract binaries is downloaded from r1me.pl, eng.traineddata is in tessdata folder
I use Delphi XE7.
I try any of the eng.traineddata I found on github even the UB Mannheim one but I only get the "Failed loading language 'eng'" error.
I see that the eng.trainneddata was changed in 2018. Is this the cause ?
under Tokyo 10.2.2 (Windows 8, french), the VCL Image demo returns "gifi'gégzgéégzizfiséZi,." for eng-text.png until I comment out the line Tesseract.PageSegMode := TessPageSegMode(cbPageSegMode.ItemIndex);
the multi-page image returns nothing with the PageSegMode, and approximative text without it
the console mode application works well for both images.
In my endeavors to resolve issue #16 I am thinking part of my problem might be the expectation of 64-bit compilation for the API I am using to interract with TesseractOCR4. But to use the 64-bit edition, I need 64-bit DLL's of this library.
Do you know where I might find those? Compiling them from source on WIndows looks painfully tedious, with several other tools requring download and installation etc.
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).
I am experiencing errors with some of the constants for PageSegMode when running the example apps, although I have not tested all.
PSM_SINGLE_COLUMN, PSM_SINGLE_BLOCK
Access violation at address 040A4769 in module 'pvt.cppan.demo.google.tesseract.libtesseract-master.dll'. Read of address 00000000.
thread $31cc (TTesseractOCR4.TRecognizerThread):
040a4769 +0e9 pvt.cppan.demo.google.tesseract.libtesseract-master.dll ?error@ERRCODE@@QBAXPBDW4TessErrorLogCode@@0zz
When I create my own apps, I can call recognizetext and it works fine in whatever the default setting is, but when I try and change PageSegMode to any of the constants it causes a floating point operation error at runtime. I assume this is something to do with my Project settings, but insure what.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.