How to use the Filter Wizard
When it comes to preprocessing and preparing an image for the OCR process, it can be daunting. Multiple filters can be used on an image; however, it can be complicated to try and test which combination suits your image best, as it is often a case-by-case basis. The process itself can be incredibly time-consuming, as you try different combinations repeatedly to verify which method yields the best results.
However, IronOCR provides an effective and easy way to handle this by introducing the OcrInputFilterWizard
. The Filter Wizard automatically evaluates combinations of preprocessing filters to maximize OCR confidence and accuracy. It performs a "brute-force" scan for optimal settings and additionally returns the best filter combination as a code snippet, allowing developers to reproduce the result easily.
In this how-to guide, we'll quickly go through an example of how the Filter Wizard works and showcase the code snippets and parameters it uses.
Get started with IronOCR
Start using IronOCR in your project today with a free trial.
How to use the Filter Wizard
- Download a C# library to use the filter wizard
- Instantiate the IronTesseract engine
- Load the input image into the
OcrInputFilterWizard
Run
the filter wizard and review the outputs, such as confidence- Utilize the code given and apply it to the input image, and verify the results
Filter Wizard Example
The OcrInputFilterWizard.Run
method takes in three parameters: the input image, an out parameter for the resulting confidence level, and the Tesseract Engine instance.
It works using a brute-force method by repeatedly combining different combinations of preprocess filters to achieve the best confidence score. The highest confidence score at the end determines which set of preprocessing image filters you should ideally apply to your input image.
Do note that there are no presets in the filter wizard, and there's no limit on the combinations it can try. The primary focus of the filter wizard is to achieve the best possible confidence score by testing various combinations of image filters.
Here's a list of all the filters that it can use in its combinations. Note that these are all filter methods available within the IronOCR library:
input.Contrast()
input.Sharpen()
input.Binarize()
input.ToGrayScale()
input.Invert()
input.Deskew()
input.Scale(...)
input.Denoise()
input.DeepCleanBackgroundNoise()
input.EnhanceResolution()
input.Dilate()
,input.Erode()
For a more in-depth look at what each individual filter does, please refer to this extensive tutorial on image filters we have.
Input
For this input, we'll use a screenshot with heavy artificial noise to illustrate the functionality of the filter wizard.

Code
:path=/static-assets/ocr/content-code-examples/how-to/filter-wizard-process.cs
using IronOcr;
using System;
// Initialize the Tesseract engine
var ocr = new IronTesseract();
// 1. Pass the image path ("noise.png").
// 2. Pass an 'out' variable to store the best confidence score found.
// 3. Pass the tesseract instance to be used for testing.
string codeToRun = OcrInputFilterWizard.Run("noise.png", out double confidence, ocr);
// The 'confidence' variable is now populated with the highest score achieved.
Console.WriteLine($"Best Confidence Score: {confidence}");
// 'codeToRun' holds the exact C# code snippet that achieved this score.
// The returned string is the code you can use to filter similar images.
Console.WriteLine("Recommended Filter Code:");
Console.WriteLine(codeToRun);
IRON VB CONVERTER ERROR developers@ironsoftware.com
Output

As you can see from its output, the filter wizard determined that, through all the combinations, 65% confidence is the best it can achieve with this specific image.
Filter Wizard Best Combination
After the filter wizard runs, we can then follow the code snippet it provided. We apply those exact settings to our input image to verify the result and confidence.
Code
:path=/static-assets/ocr/content-code-examples/how-to/filter-wizard-best-combination.cs
using IronOcr;
using System;
// Initialize the Tesseract engine
var ocrTesseract = new IronTesseract();
// Load the image into an OcrInput object
using (var input = new OcrImageInput("noise.png"))
{
// Apply the exact filter chain recommended by the Wizard's output
input.Invert();
input.DeNoise();
input.Contrast();
input.AdaptiveThreshold();
// Run OCR on the pre-processed image
OcrResult result = ocrTesseract.Read(input);
// Print the final result and confidence
Console.WriteLine($"Result: {result.Text}");
Console.WriteLine($"Confidence: {result.Confidence}");
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
Output

As you can see, IronOCR can make out most of the text even under these heavily distorted conditions, and the confidence level matches what was reported by the filter wizard.