如何獲取讀取信心
在光學字符識別 (OCR) 中,閱讀信心是指 OCR 系統對其在圖像或文件中辨識出的文字準確性所賦予的確定性或可靠性水平。 這是衡量OCR系統對識別文字正確性的信心程度。
高信心分數表明識別的準確性非常高,而低信心分數則表明識別的可靠性可能較低。
開始使用IronOCR
立即在您的專案中使用IronOCR,並享受免費試用。
如何獲取讀取信心
取得讀取信心示例
在對輸入影像進行光學字符識別(OCR)後,文字的信心水平存儲在Confidence屬性中。 使用 'using' 語句來自動處理物件的釋放。 分別使用 OcrImageInput
和 OcrPdfInput
類別添加圖片和 PDF 等文件。 Read
方法將返回一個 'OcrResult' 對象,允許訪問 Confidence 屬性
: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
獲取不同層級的閱讀信心度
不僅可以檢索整個文件的置信度,還可以訪問每個頁面、段落、行、單詞和字符的置信度。 此外,您可以獲得一個區塊的信心度,該區塊代表一個或多個緊密相鄰的段落的集合。
: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
獲取字符選擇
除了信心水準外,還有另一個有趣的屬性稱為Choices。 選項包含一系列替代詞選擇及其統計相關性。 此信息允許用戶訪問其他可能的字符。
: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
檢索到的信息
