Represents processing statistic data.
[SerializableAttribute()]
public struct OcrStatistic : System.ValueType
<SerializableAttribute()>
Public Structure OcrStatistic
Inherits System.ValueType
[SerializableAttribute()]
public class OcrStatistic
@interface LTOcrStatistic : NSObject
public class OcrStatistic
JAVASCRIPT_NOSTRUCTS
[SerializableAttribute()]
public value class OcrStatistic : public System.ValueType
This structure contains the accuracy and timing data of the latest successful recognition process.
To obtain the statistic, use GetLastStatistic.
Note that the time spent for the text post-processing can be calculated as follows: PostProcessingTime = statistic.ReadingTime - statistic.RecognitionTime.
Note: Only the following members are available for the LEADTOOLS OCR Advantage Engine
This example will show the statistics of the last recognition operation on a page.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms.Ocr;
using Leadtools.Forms.DocumentWriters;
public void OcrStatisticExample()
{
// Create an instance of the engine
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
{
// Start the engine using default parameters
ocrEngine.Startup(null, null, null, LEAD_VARS.OcrAdvantageRuntimeDir);
string tifFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif");
string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.pdf");
// Create an OCR page
using (IOcrPage ocrPage = ocrEngine.CreatePage(ocrEngine.RasterCodecsInstance.Load(tifFileName, 1), OcrImageSharingMode.AutoDispose))
{
// Process the page
ocrPage.AutoPreprocess(OcrAutoPreprocessPageCommand.Deskew, null);
// Recognize the page
// Note, Recognize can be called without calling AutoZone or manually adding zones. The engine will
// check and automatically auto-zones the page
ocrPage.Recognize(null);
// Show the statistic about the last recognize operation
OcrStatistic statistic = ocrEngine.GetLastStatistic();
Console.WriteLine("Recognized characters: {0}", statistic.RecognizedCharacters);
Console.WriteLine("Recognized words: {0}", statistic.RecognizedWords);
Console.WriteLine("Rejected characters: {0}", statistic.RejectedCharacters);
Console.WriteLine("Corrected words: {0}", statistic.CorrectedWords);
Console.WriteLine("Recognition time: {0} ms", statistic.RecognitionTime);
Console.WriteLine("Reading time: {0} ms", statistic.ReadingTime);
Console.WriteLine("Image Preprocessing time: {0} ms", statistic.ImagePreprocessingTime);
Console.WriteLine("Decomposition time: {0} ms", statistic.DecompositionTime);
Console.WriteLine("Post processing time: {0} ms", statistic.ReadingTime - statistic.RecognitionTime);
}
// Shutdown the engine
// Note: calling Dispose will also automatically shutdown the engine if it has been started
ocrEngine.Shutdown();
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
public const string OcrAdvantageRuntimeDir = @"C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Forms.Ocr
Imports Leadtools.Forms.DocumentWriters
<TestMethod>
Public Sub OcrStatisticExample()
' Create an instance of the engine
Using ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, False)
' Start the engine using default parameters
ocrEngine.Startup(Nothing, Nothing, Nothing, LEAD_VARS.OcrAdvantageRuntimeDir)
Dim tifFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif")
Dim pdfFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.pdf")
' Create an OCR page
Using ocrPage As IOcrPage = ocrEngine.CreatePage(ocrEngine.RasterCodecsInstance.Load(tifFileName, 1), OcrImageSharingMode.AutoDispose)
' Process the page
ocrPage.AutoPreprocess(OcrAutoPreprocessPageCommand.Deskew, Nothing)
' Recognize the page
' Note, Recognize can be called without calling AutoZone or manually adding zones. The engine will
' check and automatically auto-zones the page
ocrPage.Recognize(Nothing)
' Show the statistic about the last recognize operation
Dim statistic As OcrStatistic = ocrEngine.GetLastStatistic()
Console.WriteLine("Recognized characters: {0}", statistic.RecognizedCharacters)
Console.WriteLine("Recognized words: {0}", statistic.RecognizedWords)
Console.WriteLine("Rejected characters: {0}", statistic.RejectedCharacters)
Console.WriteLine("Corrected words: {0}", statistic.CorrectedWords)
Console.WriteLine("Recognition time: {0} ms", statistic.RecognitionTime)
Console.WriteLine("Reading time: {0} ms", statistic.ReadingTime)
Console.WriteLine("Image Preprocessing time: {0} ms", statistic.ImagePreprocessingTime)
Console.WriteLine("Decomposition time: {0} ms", statistic.DecompositionTime)
Console.WriteLine("Post processing time: {0} ms", statistic.ReadingTime - statistic.RecognitionTime)
End Using
' Shutdown the engine
' Note: calling Dispose will also automatically shutdown the engine if it has been started
ocrEngine.Shutdown()
End Using
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
Public Const OcrAdvantageRuntimeDir As String = "C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime"
End Class
Products |
Support |
Feedback: OcrStatistic Structure - Leadtools.Forms.Ocr |
Introduction |
Help Version 19.0.2017.6.6
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.