pschomburg / tesseractdotnet

Automatically exported from code.google.com/p/tesseractdotnet
0 stars 0 forks source link

Add support for recognizing a region of the image #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
r42, Win7 64-bit

Please provide any additional information below.

Add a method to recognize a rectangular region of the image. Followed are the 
changes:

Add to TesseractRecognizer.cpp:

String* TesseractProcessor::Recognize(System::Drawing::Image* image, 
System::Drawing::Rectangle rect)
{
    if (_apiInstance == null || image == null)
        return null;

    String* result = "";
    Pix* pix = null;

    try
    {
        pix = PixConverter::PixFromImage(image);
        if (rect != System::Drawing::Rectangle::Empty)
            this->EngineAPI->SetRectangle(rect.Left, rect.Top, rect.Width, rect.Height);

        result = this->Process(this->EngineAPI, pix);
    }
    catch (System::Exception* exp)
    {
        throw exp;
    }
    __finally
    {
        if (pix != null)
        {
            pixDestroy(&pix);
            pix = null;
        }
    }

    return result;
}

Add to TesseractEngineWrapper.h a declaration:

String* Recognize(System::Drawing::Image* image, System::Drawing::Rectangle 
rect);

Original issue reported on code.google.com by nguyen...@gmail.com on 3 Jul 2011 at 2:21

GoogleCodeExporter commented 8 years ago
Thanks!

I'm uploading the new version, this version is based-on the latest 
tesseract-ocr 3.01 r590.

So far the application can load tesseract assembly without libleptxxx.dll.

Here is the link: 
http://tesseractdotnet.googlecode.com/files/tesseractdotnetwrapper_r590.zip

Original comment by congnguy...@gmail.com on 4 Jul 2011 at 7:26