public RasterImage GetRasterImage(
OcrPageType pageType
)
- (nullable LTRasterImage *)rasterImageForPageType:(LTOcrPageType)pageType error:(NSError **)error;
public RasterImage getRasterImage(OcrPageType pageType)
RasterImage^ GetRasterImage(
OcrPageType pageType
)
def GetRasterImage(self,pageType):
pageType
The page type to get.
A RasterImage object that represent the current or processing image data of this page.
Each IOcrPage contains two versions of the image used to create it: an original (current) and an optional processing version. The processing version usually black/white and has uniform resolution (if the original image is FAX for example) and it gets passed to the internal OCR engine during the zoning and recognition process. The AutoPreprocess method also uses the B/W image to determine if the page is inverted, skewed or has an orientation; however, it applies the correction to both the current and processing images.
You can use GetRasterImage(OcrPageType) to get a copy of either of these images.
You cannot set the processing image of a page; it is created automatically by the engine. This is why there is no IOcrPage.SetRasterImage(OcrPageType pageType) method.
If the original image is black and white and has uniform vertical and horizontal resolution, then the engine will not create a processing image, in other words, GetRasterImage(OcrPageType.Current) and GetRasterImage(OcrPageType.Processing) will return identical RasterImage objects.
If the original image has different horizontal and vertical resolution, such as a FAX image, the processing page will be have be resized to have uniform resolution.
The LEADTOOLS C# .NET Main OCR demo (<INSTALLDIR>\Examples\OCR\DotNet\OcrDemo
) has an option in the page menu to toggle between showing the current (default) or processing image of each page.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Ocr;
using Leadtools.Forms.Common;
using Leadtools.Document.Writer;
using Leadtools.WinForms;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
public void OcrPageTypeExample()
{
OcrEngineType engineType = OcrEngineType.LEAD;
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(engineType))
{
ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir);
// Load an image as 24-bpp
RasterImage image = ocrEngine.RasterCodecsInstance.Load(Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif"), 24, CodecsLoadByteOrder.Bgr, 1, 1);
// Show the original image properties
Console.WriteLine("Original size is {0} by {1} at {2} bits/pixel", image.ImageWidth, image.ImageHeight, image.BitsPerPixel);
System.Diagnostics.Debug.Assert(image.BitsPerPixel == 24);
// Create a page for it
using (IOcrPage ocrPage = ocrEngine.CreatePage(image, OcrImageSharingMode.AutoDispose))
{
// Show the current OCR page size and color depth
using (image = ocrPage.GetRasterImage(OcrPageType.Current))
{
Console.WriteLine("Original size is {0} by {1} at {2} bits/pixel", image.ImageWidth, image.ImageHeight, image.BitsPerPixel);
System.Diagnostics.Debug.Assert(image.BitsPerPixel == 24);
}
// Show the processing OCR page size and color depth
using (image = ocrPage.GetRasterImage(OcrPageType.Processing))
{
Console.WriteLine("Original size is {0} by {1} at {2} bits/pixel", image.ImageWidth, image.ImageHeight, image.BitsPerPixel);
System.Diagnostics.Debug.Assert(image.BitsPerPixel == 1);
}
}
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
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.