SystemAccessViolationException at at Emgu.CV.OCR.OcrInvoke.TessBaseAPIExtractResult

General Discussion
Post Reply
jains
Posts: 2
Joined: Thu Dec 19, 2019 8:49 am

SystemAccessViolationException at at Emgu.CV.OCR.OcrInvoke.TessBaseAPIExtractResult

Post by jains » Thu Dec 19, 2019 8:58 am

Hello ,
I am new to Emgucv and trying a basic program to load a image in imagebox and then recognize characters /text from the image
below is the code

private void button2_Click(object sender, EventArgs e)
{
Mat My_Image2 = My_Image1.Clone();

using (My_Image2)
{
string tessdata = "H:\\Tesseract\\tessdata-master";
using (var ocrProvider = new Tesseract(tessdata, "eng", OcrEngineMode.Default))
{
ocrProvider.SetImage(My_Image2);
Tesseract.Character[] characters = ocrProvider.GetCharacters();
characters = ocrProvider.GetCharacters();
MessageBox.Show(characters.ToString());
ocrProvider.Recognize();
string text = ocrProvider.GetBoxText().TrimEnd();
MessageBox.Show(text);

}
}

}

Niether the getCharacters or GetBoxText() works and I always get SystemAccessViolationException. I have Emgucv.world 4.1.1 in my lib. Any pointers will be great help..

Post Reply