charlesw / tesseract-ocr-dotnet

Other
31 stars 35 forks source link

Runtime exception #9

Open hypertunes opened 12 years ago

hypertunes commented 12 years ago

I am trying to integrate the tesseract ocr in my C'# application. I have included the libtesseract.dll in my application as a reference and during the tesseract initialization it throws a runtime exception saying

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

I am using the same code example that has been given by on this page

                    using (var bmp = numberplate)
                    {
                        var success = processor.Init(@"E:\Roshan Rajaratnam\Desktop\tesseract-ocr-3.01.eng (1)\tesseract-ocr\tessdata\", language, (int)eOcrEngineMode.OEM_DEFAULT);
                        if (!success)
                        {
                            Console.WriteLine("Failed to initialize tesseract.");
                        }
                        else
                        {
                            string text = processor.Recognize(bmp);
                            Console.WriteLine("Text:");
                            Console.WriteLine("*****************************");
                            Console.WriteLine(text);
                            Console.WriteLine("*****************************");
                        }
                    }

what can be the cause for this?

charlesw commented 12 years ago

The most common causes are that the app is running as a 64 bit process or the tesseract data directory isn't correct (you must use language definitions compiled for version 3.02 of tesseract-ocr).

Hope that helps