Coder Social home page Coder Social logo

ttesseractocr4's People

Contributors

mateusvicente100 avatar r1me avatar voscha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ttesseractocr4's Issues

Cant execute .SynchronizeBegin when calling .SetImage using Pointer to Buffer

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 :
Untitled

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

Linux

Does it works with Lazarus on Linux ?

Thanks

V5 support

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

Applying a threshold in which OCR'ing should or should not be attempted

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?

build error

when build unit FormTesseractOCRImage;
show below error:

image

Can't run example

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

can't use delphi_console_simple

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 ?

TessBaseAPISetPageSegMode

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

tesseract

the console mode application works well for both images.

64-bit DLL?

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.

Project settings : Record field alignment

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).

Exception when running in debug mode

I get the attached exception when i try to run the application using this library on debug mode
image

This happens also to the attached demo, but working fine on release build config.

Errors with PageSegMode

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.