Are you sure you compare apples to apples? e.g. Is not your c++ code built as debug and C# with release optimisations?
Reasoning: Charles Weld (.NET wrapper[1]) did not port tesseract to C# but it wraps (uses) tesseract C-API in C# library. C-API wraps tesseract C++ API. Each wrapping should cause small (maybe not even measurable) performance, but definitely wrapper could not be faster than the original library. [1] https://github.com/charlesw/tesseract Zdenko so 16. 11. 2024 o 9:30 Iain Downs <[email protected]> napĂsal(a): > I mainly develop under windows and have used the emgu cv port and one of > the tesseract c# ports (Charles Weld). Both lack some features so I've > build C++ libraries to better support pageiterators (and with the especial > hope that bold and italic in v5 will someday work). > > I'm finding that the C++ implementations are 3 or 4 times slower than the > equivalent code written in c#. The same is true if I have a C++ > application and if I use static libraries or dlls for Tesseract. > > I have imported Tesseract and Leptonica using VCPKG. > > My code in all test cases resolves to the below or the c# equivalent:- > > tesseract::TessBaseAPI* tessApi = new tesseract::TessBaseAPI(); > retval = tessApi->Init(NULL, "eng"); > tessApi->SetPageSegMode(tesseract::PSM_SINGLE_BLOCK); > Pix* image = pixRead(argv[1]); > tessApi->SetImage(image); > tessApi->Recognize(0); > char* text = tessApi->GetUTF8Text(); > tessApi->End(); > delete tessApi; > > I have no idea where to look here and would appreciate any help. > > Iain > > -- > You received this message because you are subscribed to the Google Groups > "tesseract-ocr" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/tesseract-ocr/8dbfdc4c-fa3a-4a92-9ded-4aec27384e7dn%40googlegroups.com > <https://groups.google.com/d/msgid/tesseract-ocr/8dbfdc4c-fa3a-4a92-9ded-4aec27384e7dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8z0id9AEky4Ez50VKWhXjNYhZPWNy%3DpyoVoRWas%2BGh9PA%40mail.gmail.com.

