Failed to ocr the images with border ie like buttons in emgu 4.4.0.4099 in c#

47 Views Asked by At

I have updated emgu from 4.1 to 4.4.0.4099 in c# .netframework. I have a BitMap image where the image contains a border. I am not getting the empty result from it (it was working in older version emgu 4.1). I am not getting what I need to change to work it.

Attached sample file:

enter image description here

string filePath = @"C:\Users\Testing\Desktop\AI Image\3.PNG";         
string Save=(@"C:\Users\Testing\Desktop\AI Image\Vikas1.png");
Bitmap imageBmp = new Bitmap(filePath);
var tesseract = new Tesseract(@"D:\\Model\OCR\English\", "eng", OcrEngineMode.TesseractLstmCombined);
{
    // Load the image
    //using (Image<Gray, byte> img = imageBmp.ToImage<Gray, byte>())
    using (var img = new UMat(filePath, ImreadModes.Grayscale))
    {
        img.Save(Save);
        // Set the image for Tesseract
        tesseract.SetImage(img);

        // Perform OCR
        tesseract.Recognize();

        // Retrieve the detected text
        string ocrText = tesseract.GetUTF8Text();

        // Print the OCR result
        Console.WriteLine("Detected text: " + ocrText);
    }
}

0

There are 0 best solutions below