using IronOcr;using System;// Initialize the Tesseract enginevar 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);
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);
ImportsIronOcrImportsSystem' Initialize the Tesseract engineDim ocr As 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.Dim confidence AsDoubleDim codeToRun AsString = OcrInputFilterWizard.Run("noise.png", 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)
Imports IronOcr
Imports System
' Initialize the Tesseract engine
Dim ocr As 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.
Dim confidence As Double
Dim codeToRun As String = OcrInputFilterWizard.Run("noise.png", 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)
/* :path=/static-assets/ocr/content-code-examples/how-to/filter-wizard-batch.cs */using IronOcr;using System;using System.IO;// Process multiple similar imagesvar ocr = new IronTesseract();string[] imageFiles = Directory.GetFiles(@"C:\Images", "*.png");// Run Filter Wizard on first image to discover optimal settingsstring optimalCode = OcrInputFilterWizard.Run(imageFiles[0], out double baselineConfidence, ocr);Console.WriteLine($"Baseline confidence: {baselineConfidence:P2}");Console.WriteLine($"Optimal filter sequence discovered");// Apply discovered filters to all imagesforeach (string imagePath in imageFiles){ using (var input = new OcrImageInput(imagePath)) { // Apply the filter sequence discovered by the wizard // The actual filters would be applied here based on the wizard output var result = ocr.Read(input);Console.WriteLine($"Processed: {Path.GetFileName(imagePath)} - Confidence: {result.Confidence:P2}"); }}
/* :path=/static-assets/ocr/content-code-examples/how-to/filter-wizard-batch.cs */
using IronOcr;
using System;
using System.IO;
// Process multiple similar images
var ocr = new IronTesseract();
string[] imageFiles = Directory.GetFiles(@"C:\Images", "*.png");
// Run Filter Wizard on first image to discover optimal settings
string optimalCode = OcrInputFilterWizard.Run(imageFiles[0], out double baselineConfidence, ocr);
Console.WriteLine($"Baseline confidence: {baselineConfidence:P2}");
Console.WriteLine($"Optimal filter sequence discovered");
// Apply discovered filters to all images
foreach (string imagePath in imageFiles)
{
using (var input = new OcrImageInput(imagePath))
{
// Apply the filter sequence discovered by the wizard
// The actual filters would be applied here based on the wizard output
var result = ocr.Read(input);
Console.WriteLine($"Processed: {Path.GetFileName(imagePath)} - Confidence: {result.Confidence:P2}");
}
}
ImportsIronOcrImportsSystemImportsSystem.IO' Process multiple similar imagesDim ocr As New IronTesseract()Dim imageFiles AsString() = Directory.GetFiles("C:\Images", "*.png")' Run Filter Wizard on first image to discover optimal settingsDim baselineConfidence AsDoubleDim optimalCode AsString = OcrInputFilterWizard.Run(imageFiles(0), baselineConfidence, ocr)Console.WriteLine($"Baseline confidence: {baselineConfidence:P2}")Console.WriteLine("Optimal filter sequence discovered")' Apply discovered filters to all imagesFor Each imagePath AsStringIn imageFilesUsing input As New OcrImageInput(imagePath) ' Apply the filter sequence discovered by the wizard ' The actual filters would be applied here based on the wizard output Dim result = ocr.Read(input)Console.WriteLine($"Processed: {Path.GetFileName(imagePath)} - Confidence: {result.Confidence:P2}")EndUsingNext
Imports IronOcr
Imports System
Imports System.IO
' Process multiple similar images
Dim ocr As New IronTesseract()
Dim imageFiles As String() = Directory.GetFiles("C:\Images", "*.png")
' Run Filter Wizard on first image to discover optimal settings
Dim baselineConfidence As Double
Dim optimalCode As String = OcrInputFilterWizard.Run(imageFiles(0), baselineConfidence, ocr)
Console.WriteLine($"Baseline confidence: {baselineConfidence:P2}")
Console.WriteLine("Optimal filter sequence discovered")
' Apply discovered filters to all images
For Each imagePath As String In imageFiles
Using input As New OcrImageInput(imagePath)
' Apply the filter sequence discovered by the wizard
' The actual filters would be applied here based on the wizard output
Dim result = ocr.Read(input)
Console.WriteLine($"Processed: {Path.GetFileName(imagePath)} - Confidence: {result.Confidence:P2}")
End Using
Next
using IronOcr;using System;// Initialize the Tesseract enginevar ocrTesseract = new IronTesseract();// Load the image into an OcrInput objectusing (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 confidenceConsole.WriteLine($"Result: {result.Text}");Console.WriteLine($"Confidence: {result.Confidence}");}
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}");
}
ImportsIronOcrImportsSystem' Initialize the Tesseract engineDim ocrTesseract As New IronTesseract()' Load the image into an OcrInput objectUsing input As 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 Dim result AsOcrResult = ocrTesseract.Read(input) ' Print the final result and confidenceConsole.WriteLine($"Result: {result.Text}")Console.WriteLine($"Confidence: {result.Confidence}")EndUsing
Imports IronOcr
Imports System
' Initialize the Tesseract engine
Dim ocrTesseract As New IronTesseract()
' Load the image into an OcrInput object
Using input As 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
Dim result As OcrResult = ocrTesseract.Read(input)
' Print the final result and confidence
Console.WriteLine($"Result: {result.Text}")
Console.WriteLine($"Confidence: {result.Confidence}")
End Using
/* :path=/static-assets/ocr/content-code-examples/how-to/filter-wizard-validation.cs */using IronOcr;using System;var ocrEngine = new IronTesseract();try{ using (var input = new OcrImageInput(@"C:\Images\document.png")) { // Apply Filter Wizard recommended sequence input.Invert(); input.DeNoise(); input.Contrast(); input.AdaptiveThreshold(); // Configure additional OCR settings ocrEngine.Configuration.ReadBarCodes = false; ocrEngine.Configuration.RenderSearchablePdf = true; // Perform OCR with timeout protection var result = ocrEngine.Read(input); // Validate results if (result.Confidence >= 0.6) {Console.WriteLine("OCR successful with high confidence"); // Process the extracted text } else {Console.WriteLine("Low confidence result - consider manual review"); } }}catch (Exception ex){Console.WriteLine($"OCR processing error: {ex.Message}");}
/* :path=/static-assets/ocr/content-code-examples/how-to/filter-wizard-validation.cs */
using IronOcr;
using System;
var ocrEngine = new IronTesseract();
try
{
using (var input = new OcrImageInput(@"C:\Images\document.png"))
{
// Apply Filter Wizard recommended sequence
input.Invert();
input.DeNoise();
input.Contrast();
input.AdaptiveThreshold();
// Configure additional OCR settings
ocrEngine.Configuration.ReadBarCodes = false;
ocrEngine.Configuration.RenderSearchablePdf = true;
// Perform OCR with timeout protection
var result = ocrEngine.Read(input);
// Validate results
if (result.Confidence >= 0.6)
{
Console.WriteLine("OCR successful with high confidence");
// Process the extracted text
}
else
{
Console.WriteLine("Low confidence result - consider manual review");
}
}
}
catch (Exception ex)
{
Console.WriteLine($"OCR processing error: {ex.Message}");
}
ImportsIronOcrImportsSystemDim ocrEngine As New IronTesseract()TryUsing input As New OcrImageInput("C:\Images\document.png") ' Apply Filter Wizard recommended sequence input.Invert() input.DeNoise() input.Contrast() input.AdaptiveThreshold() ' Configure additional OCR settings ocrEngine.Configuration.ReadBarCodes = False ocrEngine.Configuration.RenderSearchablePdf = True ' Perform OCR with timeout protection Dim result = ocrEngine.Read(input) ' Validate results If result.Confidence >= 0.6 ThenConsole.WriteLine("OCR successful with high confidence") ' Process the extracted text ElseConsole.WriteLine("Low confidence result - consider manual review") End IfEndUsingCatch ex AsExceptionConsole.WriteLine($"OCR processing error: {ex.Message}")EndTry
Imports IronOcr
Imports System
Dim ocrEngine As New IronTesseract()
Try
Using input As New OcrImageInput("C:\Images\document.png")
' Apply Filter Wizard recommended sequence
input.Invert()
input.DeNoise()
input.Contrast()
input.AdaptiveThreshold()
' Configure additional OCR settings
ocrEngine.Configuration.ReadBarCodes = False
ocrEngine.Configuration.RenderSearchablePdf = True
' Perform OCR with timeout protection
Dim result = ocrEngine.Read(input)
' Validate results
If result.Confidence >= 0.6 Then
Console.WriteLine("OCR successful with high confidence")
' Process the extracted text
Else
Console.WriteLine("Low confidence result - consider manual review")
End If
End Using
Catch ex As Exception
Console.WriteLine($"OCR processing error: {ex.Message}")
End Try
OcrInputFilterWizard.Run()に画像パス、信頼度スコアのoutパラメータ、IronTesseractインスタンスを指定するだけです。例えば: string code = OcrInputFilterWizard.Run("image.png", out double confidence, new IronTesseract());
What factors should be considered when selecting test images for the Filter Wizard?
When selecting test images, consider factors like image resolution, document type, and source quality, as these can affect the filter evaluation process and OCR performance.
How can I optimize the Filter Wizard for large-scale operations?
For large-scale operations, consider using multithreading to process multiple images simultaneously, and implement performance optimizations like the fast OCR configuration to reduce processing time.
What advanced usage tips are recommended for using the Filter Wizard?
Advanced tips include batch processing, performance optimization, custom language support, API integration, document-specific optimization, memory management, and error recovery strategies.
Is the Filter Wizard suitable for handling different document types?
Yes, the Filter Wizard can optimize OCR processing for various document types by automatically finding the best preprocessing pipeline, applicable to forms, mixed content, multi-page documents, and more.