How to Get Read Confidence

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.

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.

Get Started with IronOCR

Start using IronOCR in your project today with a free trial.

First Step:
green arrow pointer



Get Read Confidence Example

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.

:path=/static-assets/ocr/content-code-examples/how-to/tesseract-result-confidence-get-confidence.cs
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;
Imports IronOcr

' Instantiate IronTesseract
Private ocrTesseract As New IronTesseract()

' Add image
Private imageInput = New OcrImageInput("sample.tiff")
' Perform OCR
Private ocrResult As OcrResult = ocrTesseract.Read(imageInput)

' Get confidence level
Private confidence As Double = ocrResult.Confidence
$vbLabelText   $csharpLabel

Get Read Confidences 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.

:path=/static-assets/ocr/content-code-examples/how-to/tesseract-result-confidence-confidence-level.cs
// 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;
' Get page confidence level
Dim pageConfidence As Double = ocrResult.Pages(0).Confidence

' Get paragraph confidence level
Dim paragraphConfidence As Double = ocrResult.Paragraphs(0).Confidence

' Get line confidence level
Dim lineConfidence As Double = ocrResult.Lines(0).Confidence

' Get word confidence level
Dim wordConfidence As Double = ocrResult.Words(0).Confidence

' Get character confidence level
Dim characterConfidence As Double = ocrResult.Characters(0).Confidence

' Get block confidence level
Dim blockConfidence As Double = ocrResult.Blocks(0).Confidence
$vbLabelText   $csharpLabel

Get Character Choices

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.

:path=/static-assets/ocr/content-code-examples/how-to/tesseract-result-confidence-get-choices.cs
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;
Imports IronOcr
Imports IronOcr.OcrResult

' Instantiate IronTesseract
Private ocrTesseract As New IronTesseract()

' Add image
Private imageInput = New OcrImageInput("Potter.tiff")
' Perform OCR
Private ocrResult As OcrResult = ocrTesseract.Read(imageInput)

' Get choices
Private choices() As Choice = ocrResult.Characters(0).Choices
$vbLabelText   $csharpLabel

Retrieved Information

Choices

Frequently Asked Questions

What is read confidence in OCR?

Read confidence in OCR 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.

How can I get started with a C# library to assess read confidence?

To get started with IronOCR, you need to download the library from NuGet, prepare the targeted image and PDF document, and access the Confidence property of the OCR result.

How do I access the confidence level of OCR-recognized text using a C# library?

After performing OCR with IronOCR, the confidence level of the text is stored in the Confidence property of the OcrResult object. This can be accessed using the Read method.

Can I retrieve confidence levels for different text elements?

Yes, with IronOCR, you can retrieve the confidence levels of pages, paragraphs, lines, words, and characters individually.

What are character choices in a C# OCR library?

Character choices provide a list of alternative word choices and their statistical relevance, allowing access to other possible characters recognized by the OCR.

How does the Confidence property in a C# OCR library work?

The Confidence property indicates the accuracy level of the recognized text. It provides a numerical score representing the certainty of the OCR system regarding the recognition.

Is it possible to access confidence levels at the block level in a C# OCR library?

Yes, IronOCR allows you to access the confidence level of a block, which represents a collection of one or more paragraphs located closely together.

What is the purpose of the Choices property in a C# OCR library?

The Choices property is used to provide alternative word choices and their confidence scores, offering users additional insights into possible text interpretations.

How do I implement OCR with confidence levels using C#?

Implement OCR with confidence levels in C# by using IronOCR's library. Set the OCR engine mode, prepare the input, and access the Confidence property through the OcrResult object.

What steps are involved in assessing read confidence with a C# OCR library?

The steps include downloading the IronOCR library, preparing documents, using the Read method to obtain an OcrResult, and accessing the Confidence property for accuracy assessment.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.
Reviewed by
Jeff Fritz
Jeffrey T. Fritz
Principal Program Manager - .NET Community Team
Jeff is also a Principal Program Manager for the .NET and Visual Studio teams. He is the executive producer of the .NET Conf virtual conference series and hosts 'Fritz and Friends' a live stream for developers that airs twice weekly where he talks tech and writes code together with viewers. Jeff writes workshops, presentations, and plans content for the largest Microsoft developer events including Microsoft Build, Microsoft Ignite, .NET Conf, and the Microsoft MVP Summit