IRONSOFTWAREHOME

How to Get C# OCR Read Confidence with IronOCR

Curtis Chau
Curtis Chau
Updated: August 2, 2026

IronOCR's read confidence indicates how certain the OCR system is about recognized text accuracy, with values from 0 to 100 where higher scores mean greater reliability - access it via the Confidence property on any OcrResult object.

Read confidence in OCR (Optical Character Recognition) refers to the level of certainty or reliability that the OCR system assigns to the accuracy of the text it has recognized in an image or document. It is a measure of how confident the OCR system is that the recognized text is correct. This metric becomes particularly important when processing scanned documents, photos, or any images where text quality might vary.

A high confidence score indicates a high degree of certainty that the recognition is accurate, while a low confidence score suggests that the recognition may be less reliable. Understanding these confidence levels helps developers implement appropriate validation logic and error handling in their applications.

Quickstart: Get OCR Read Confidence in One Line

Use IronTesseract's Read method with an image file path, then access the Confidence property on the returned OcrResult to see how certain IronOCR is about its text recognition. It's a simple, reliable way to start evaluating OCR output accuracy.

  1. 1Install IronOCR with NuGet Package Manager

    PM > Install-Package IronOcr

  2. 2Copy and run this code snippet.

    double confidence = new IronOcr.IronTesseract().Read("input.png").Confidence;
    C#
  3. 3Deploy to test on your live environment

    Start using IronOCR in your project today with a free trial
    arrow pointer

How Do I Get Read Confidence in C#?

After performing OCR on the input image, the confidence level of the text is stored in the Confidence property. Utilize the 'using' statement to automatically dispose of objects after use. Add documents such as images and PDFs with the OcrImageInput and OcrPdfInput classes, respectively. The Read method will return an OcrResult object that allows access to the Confidence property.

using IronOcr;

// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();

// Add image
using var imageInput = new OcrImageInput("sample.tiff");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);

// Get confidence level
double confidence = ocrResult.Confidence;

The confidence value returned ranges from 0 to 100, where:

  • 90-100: Excellent confidence - Text is highly reliable
  • 80-89: Good confidence - Text is generally accurate with minor uncertainties
  • 70-79: Moderate confidence - Text may contain some errors
  • Below 70: Low confidence - Text should be reviewed or reprocessed

How Can I Get Confidence at Different Levels?

Not only can you retrieve the confidence level of the entire document, but you can also access the confidence levels of each page, paragraph, line, word, and character. Furthermore, you can obtain the confidence of a block, which represents a collection of one or more paragraphs located closely together.

// Get page confidence level
double pageConfidence = ocrResult.Pages[0].Confidence;

// Get paragraph confidence level
double paragraphConfidence = ocrResult.Paragraphs[0].Confidence;

// Get line confidence level
double lineConfidence = ocrResult.Lines[0].Confidence;

// Get word confidence level
double wordConfidence = ocrResult.Words[0].Confidence;

// Get character confidence level
double characterConfidence = ocrResult.Characters[0].Confidence;

// Get block confidence level
double blockConfidence = ocrResult.Blocks[0].Confidence;

Practical Example: Filtering by Confidence

When processing documents with varying quality, such as low-quality scans, you can use confidence scores to filter results:

using IronOcr;
using System.Linq;

// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();

// Configure for better accuracy
ocrTesseract.Configuration.ReadBarCodes = false;
ocrTesseract.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.AutoOsd;

// Add image
using var imageInput = new OcrImageInput("invoice.png");
// Apply filters to improve quality
imageInput.Deskew();
imageInput.DeNoise();

// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);

// Filter words with confidence above 85%
var highConfidenceWords = ocrResult.Words
    .Where(word => word.Confidence >= 85)
    .Select(word => word.Text)
    .ToList();

// Process only high-confidence text
string reliableText = string.Join(" ", highConfidenceWords);
Console.WriteLine($"High confidence text: {reliableText}");

// Flag low-confidence words for manual review
var lowConfidenceWords = ocrResult.Words
    .Where(word => word.Confidence < 85)
    .Select(word => new { word.Text, word.Confidence })
    .ToList();

foreach (var word in lowConfidenceWords)
{
    Console.WriteLine($"Review needed: '{word.Text}' (Confidence: {word.Confidence:F2}%)");
}

What Are Character Choices in OCR?

Apart from the confidence level, there is another interesting property called Choices. Choices contain a list of alternative word choices and their statistical relevance. This information allows the user to access other possible characters. This feature is particularly useful when working with multiple languages or specialized fonts.

using IronOcr;
using static IronOcr.OcrResult;

// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();

// Add image
using var imageInput = new OcrImageInput("Potter.tiff");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);

// Get choices
Choice[] choices = ocrResult.Characters[0].Choices;

How Do Alternative Character Choices Help?

Alternative character choices provide several benefits:

  1. Ambiguity Resolution: When characters like 'O' and '0', or 'l' and '1' are confused
  2. Font Variations: Different interpretations for stylized or decorative fonts
  3. Quality Issues: Multiple possibilities when dealing with degraded text
  4. Language Context: Alternative interpretations based on language rules
OCR character choices debug view showing confidence scores and text recognition results for 'Chapter Eight'

Working with Character Choices

Here's a comprehensive example demonstrating how to use character choices for improved accuracy:

using IronOcr;
using System;
using System.Linq;
using static IronOcr.OcrResult;

// Configure IronTesseract for detailed results
IronTesseract ocrTesseract = new IronTesseract();

// Process image with potential ambiguities
using var imageInput = new OcrImageInput("ambiguous_text.png");
OcrResult ocrResult = ocrTesseract.Read(imageInput);

// Analyze character choices for each word
foreach (var word in ocrResult.Words)
{
    Console.WriteLine($"\nWord: '{word.Text}' (Confidence: {word.Confidence:F2}%)");
    
    // Check each character in the word
    foreach (var character in word.Characters)
    {
        if (character.Choices != null && character.Choices.Length > 1)
        {
            Console.WriteLine($"  Character '{character.Text}' has alternatives:");
            
            // Display all choices sorted by confidence
            foreach (var choice in character.Choices.OrderByDescending(c => c.Confidence))
            {
                Console.WriteLine($"    - '{choice.Text}': {choice.Confidence:F2}%");
            }
        }
    }
}

Advanced Confidence Strategies

When working with specialized documents like passports, license plates, or MICR cheques, confidence scores become crucial for validation:

using IronOcr;

public class DocumentValidator
{
    private readonly IronTesseract ocr = new IronTesseract();
    
    public bool ValidatePassportNumber(string imagePath, double minConfidence = 95.0)
    {
        using var input = new OcrImageInput(imagePath);
        
        // Configure for passport reading
        ocr.Configuration.ReadBarCodes = true;
        ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.SingleLine;
        
        // Apply preprocessing
        input.Deskew();
        input.Scale(200); // Upscale for better accuracy
        
        var result = ocr.Read(input);
        
        // Find passport number pattern
        var passportLine = result.Lines
            .Where(line => line.Text.Contains("P<") || IsPassportNumberFormat(line.Text))
            .FirstOrDefault();
        
        if (passportLine != null)
        {
            Console.WriteLine($"Passport line found: {passportLine.Text}");
            Console.WriteLine($"Confidence: {passportLine.Confidence:F2}%");
            
            // Only accept if confidence meets threshold
            return passportLine.Confidence >= minConfidence;
        }
        
        return false;
    }
    
    private bool IsPassportNumberFormat(string text)
    {
        // Simple passport number validation
        return System.Text.RegularExpressions.Regex.IsMatch(text, @"^[A-Z]\d{7,9}$");
    }
}

Optimizing for Better Confidence

To achieve higher confidence scores, consider using image filters and preprocessing techniques:

using IronOcr;

// Create an optimized OCR workflow
IronTesseract ocr = new IronTesseract();

using var input = new OcrImageInput("low_quality_scan.jpg");

// Apply multiple filters to improve confidence
input.Deskew();           // Correct rotation
input.DeNoise();          // Remove noise
input.Sharpen();          // Enhance edges
input.Dilate();           // Thicken text
input.Scale(150);         // Upscale for clarity

// Configure for accuracy over speed
ocr.Configuration.TesseractVersion = TesseractVersion.Tesseract5;
ocr.Configuration.EngineMode = TesseractEngineMode.TesseractOnly;

var result = ocr.Read(input);

Console.WriteLine($"Document confidence: {result.Confidence:F2}%");

// Generate confidence report
var confidenceReport = result.Pages
    .Select((page, index) => new
    {
        PageNumber = index + 1,
        Confidence = page.Confidence,
        WordCount = page.Words.Length,
        LowConfidenceWords = page.Words.Count(w => w.Confidence < 80)
    });

foreach (var page in confidenceReport)
{
    Console.WriteLine($"Page {page.PageNumber}: {page.Confidence:F2}% confidence");
    Console.WriteLine($"  Total words: {page.WordCount}");
    Console.WriteLine($"  Low confidence words: {page.LowConfidenceWords}");
}

Summary

Understanding and utilizing OCR confidence scores is essential for building robust document processing applications. By leveraging IronOCR's confidence properties and character choices, developers can implement intelligent validation, error handling, and quality assurance mechanisms in their OCR workflows. Whether you're processing screenshots, tables, or specialized documents, confidence scores provide the metrics needed to ensure accurate text extraction.

Frequently Asked Questions

What is OCR Read Confidence in IronOCR?

OCR Read Confidence in IronOCR indicates the certainty level of the text recognition process. It utilizes a confidence score ranging from 0 to 100, where a higher score signifies greater accuracy of recognized text.

How can I access the Confidence score in IronOCR?

You can access the Confidence score in IronOCR by utilizing the `Confidence` property of the `OcrResult` object returned by the `IronTesseract.Read` method.

Why is the Confidence score important in OCR?

The Confidence score is crucial as it helps evaluate the reliability of the recognized text. Understanding these scores allows developers to implement appropriate validation and error handling for improved accuracy in OCR applications.

What does a high OCR Confidence score signify?

A high OCR Confidence score signifies a high degree of certainty in text recognition accuracy, indicating that the extracted text is likely correct and reliable.

Can IronOCR provide Confidence scores for different levels of text?

Yes, IronOCR can provide Confidence scores for multiple levels including entire documents, pages, paragraphs, lines, words, and characters, allowing for detailed accuracy assessment.

How can I improve OCR Confidence scores with IronOCR?

To improve OCR Confidence scores with IronOCR, you can apply preprocessing techniques like deskewing, denoising, and upscaling images before running the OCR process. Additionally, configuring IronTesseract for optimal settings can enhance accuracy.

What are character choices in IronOCR?

Character choices in IronOCR refer to alternative word choices and their relevance metrics provided during OCR. This feature is useful for handling ambiguities and understanding potential character variations in the text.

How can character choices aid in text recognition?

Character choices help resolve ambiguities by offering alternative interpretations for similar-looking characters and words. This is particularly beneficial when dealing with font variations, degraded text, and multiple languages.

What preprocessing techniques improve IronOCR text accuracy?

Preprocessing techniques such as deskewing, denoising, sharpening, and scaling can significantly enhance text accuracy by improving image quality before executing OCR processes with IronOCR.

How does IronOCR handle low confidence recognition results?

IronOCR allows you to filter and flag low-confidence recognition results for review. You can identify words with confidence scores below a certain threshold and address uncertainties by using validation or reprocessing strategies.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 6,236,385Version:2026.9just released

Get your FREE

30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
bullet_testTest in production
without watermarks
bullet_calendar30 days fully
functional product
bullet_support24/5 technical
support during trial
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronOcr
nuget.org/packages/IronOcr/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronOCR"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronOCR to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronOCR.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required