DEV Community

IronSoftware
IronSoftware

Posted on • Originally published at ironsoftware.com

Image Resolution Optimization (DPI)

The OcrInput class will automatically resolve low resolution images for Iron Tesseract.

Although Tesseract generally requires a 300DPI input - IronTesseract has been tuned to work with 99+% accuracy on 225 DPI scans. This can double OCR speed.

Too high a DPI is slow. Too low a DPI causes inaccuracies. If in doubt, do nothing and Iron Tesseract will preconfigure everything for you.

C#:

using IronOcr;

var Ocr = new IronTesseract();
using (var Input = new OcrInput(@"images\image.png"))
{
    Input.MinimumDPI = 250;
    Input.TargetDPI = 300;

    var Result = Ocr.Read(Input);
    Console.WriteLine(Result.Text);
}
Enter fullscreen mode Exit fullscreen mode

VB:

Imports IronOcr

Private Ocr = New IronTesseract()
Using Input = New OcrInput("images\image.png")
    Input.MinimumDPI = 250
    Input.TargetDPI = 300

    Dim Result = Ocr.Read(Input)
    Console.WriteLine(Result.Text)
End Using
Enter fullscreen mode Exit fullscreen mode

Top comments (0)