I've add the C# wrapper for tesseract : TesseractEngine
I've two types of images to read :
And the second type (one letter only) :
But in both case, Tesseract return empty string.
Here is my code (found in docs) :
public static void Main(string[] args)
{
var testImagePath = @"C:\plate\ExtractLicensePlate-0.jpg";
if (args.Length > 0)
{
testImagePath = args[0];
}
try
{
using (var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default))
{
engine.SetVariable("tessedit_char_whitelist", "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
using (var img = Pix.LoadFromFile(testImagePath))
{
using (var page = engine.Process(img))
{
var text = page.GetText();//<-- empty :(
}
}
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
Console.Read();
}
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
Maybe I miss an option or something else?
EDIT : I've try this kind but no success to :
EDIT 2 : I've try Gray and Black and White and Tesseract Give me : EEEEEEE
I don't know what I can do better... :
Try setting the PageSegMode
to SingleChar
or SingleWord
using (var page = engine.Process(img, PageSegMode.SingleChar)) { var text = page.GetText(); }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.