Reputation: 1186
I have downloaded tesseract
from Here. When i tried to add the dll
file to visual studio 2012, its showing error that its not an valid assembly. Can anyone suggest me some other dll
file of ocr
and sample coding. I've tried many websites but i dint found any good one. Then i found this dll
file tessrect and used the following code
string path = @"C:\pic\mytext.jpg";
Bitmap image = new Bitmap(path);
Tesseract ocr = new Tesseract();
ocr.SetVariable("tessedit_char_whitelist", "0123456789"); // If digit only
ocr.Init(@"C:\tessdata\", "eng", false); // To use correct tessdata
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
foreach (tessnet2.Word word in result)
Console.WriteLine("{0} : {1}", word.Confidence, word.Text);
But visual studio throwing error that its not valid assembly. can anyone help me in this ...
EDIT : Frameworks in properties folder only Thanks n advance
Upvotes: 1
Views: 15208
Reputation: 5398
I tried to use Tesseract .NET wrapper. It has more pleasent syntax:
using (var engine = new TesseractEngine(pathToLangFolder, "eng", EngineMode.Default))
{
// have to load Pix via a bitmap since Pix doesn't support loading a stream.
using (var image = new Bitmap(fileName))
{
using (var pix = PixConverter.ToPix(image))
{
using (var page = engine.Process(pix))
{
Console.WriteLine(page.GetMeanConfidence() + " : " + page.GetText());
}
}
}
}
Upvotes: 2
Reputation:
Why Dont u Try for OCRSDK its an paid service and also available for trial . It as accuracy of 85% in extracting text from image ...
Upvotes: 0