In This Topic ▼

LEADTOOLS OCR Module - LEAD Engine Settings

The IOcrSettingManager.GetSettingNames method returns the names of the values as described in this table and in the same order.

The following table describes the settings supported by the LEADTOOLS OCR Module - LEAD Engine:


Recognition

Recognition.Adaption.AdaptedDataFilePath

Boolean type. Not used in this version of LEADTOOLS

Recognition.AutoRecognizeManager.DefaultDocumentOrientation`

The default orientation for the generated document if a page is blank or entirely graphics. Enum type with a default value set to None.

Possible values are:

Value Description
(0) None Do not change the orientation.
(1) Portrait Try to change to portrait orientation (make the width less than height) if the page is blank or entirely graphics.
(2) Landscape Try to change to landscape orientation (make the width greater than height) if the page is blank or entirely graphics.

Recognition.AutoRecognizeManager.FormatSpeedOptimized

Boolean type. true to optimize the recognition speed based on the format of the final document; otherwise, false. The default value is true. As an example, the OCR engine does not recognize font attributes such as italic or bold if the final document format is Text.

Recognition.AutoSecondPass

Boolean type. Automatically perform second image processing cleanup on the internal black and white image if the first pass did not provide satisfactory results. The default value is true.

Recognition.CharacterFilter.DiscardNoiseLikeCharacters

Boolean type. true to ignore recognized characters that have features similar to noise; otherwise, false. The default value is false.

Recognition.CharacterFilter.DiscardNoisyZones

Boolean type. true to discard all the results in the zone if the engine determines that all the characters recognized are noise; otherwise, false. The default value is false.

Recognition.CharacterFilter.MinimumPixelHeight

Integer (0 to Int32.MaxValue). The minimum height of a recognized character, in pixels. The default value is 6.

Recognition.CharacterFilter.MinimumPixelSizeExcludeCharacters

String (No maximum. Can be null). Characters to exclude from the minimum pixel width and height rule. The default value is ".".

Recognition.CharacterFilter.MinimumPixelWidth

Integer (0 to Int32.MaxValue). The minimum width of a recognized character, in pixels. The default value is 6.

Recognition.CharacterFilter.PostprocessMICR

Boolean Type. true to post-process any MICR zones by discarding all of the characters, numbers and symbols that do not belong to the MICR character set as well as performing basic validity data checking; otherwise, false. The default value is true.

Recognition.DetectColors

Boolean type. Automatically detect the foreground and background colors of each character. The default value is true. If this value is true, then the engine tries to automatically detect the colors of the zones when IOcrPage.AutoZone is called and sets the values in OcrZone.ForeColor and OcrZone.BackColor.

Recognition.DetectExactCharacterBounds

Boolean type. true to detect the exact bounding rectangle for each recognized character; otherwise, false. The default value is false.

Recognition.Fonts.DetectFontStyles

Enum type. Enable or disable the detection of specific font properties. These flags affect the final generated document if the format supports fonts (such as the PDF or DOCX formats). The default value is Bold | Italic | Underline | SansSerif | Serif | Proportional | Superscript | Subscript | Strikeout (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 | 0x100 = 1FF).

Values can be OR-ed together. Possible values are:

Value Description
(0) None Do not detect any font styles.
(0x01) Bold Detect bold font styles.
(0x02) Italic Detect italic font styles.
(0x04) Underline Detect underline font styles.
(0x08) SansSerif Detect Sans-Serif font styles (for example, Arial).
(0x10) Serif Detect Serif font styles (for example, Times New Roman).
(0x20) Proportional Detect proportional font styles (for example, Times New Roman or Arial) or fixed space font styles (for example, Courier New).
(0x40) Superscript Detect super-script font styles.
(0x80) Subscript Detect subscript font styles.
(0x100) Strikeout Detect strikeout font styles.

Recognition.Fonts.EnableCapsCaps

Boolean type. true to enable Caps/Caps (CamelCase) font recognition enhancements; otherwise, false. The default value is false.

Recognition.Fonts.RecognizeFontAttributes

Boolean type. true to enable font attributes recognition; otherwise, false. The default value is true.

Setting this value to false can improve the speed of the IOcrPage.Recognize method if the font attributes of the recognized characters is not required, for instance, if recognition is used to obtain raw text only and not to create a formatted output document.

Recognition.MaximumPageConventionalMemorySize

Integer (0 to Int32.MaxValue). The appropriate setting for Recognition.MaximumPageConventionalMemorySize depends on the system hardware configuration and the number of cores and application types being used. Change this setting if out-of-memory errors occur when running your application. The IOcrEngine supports loading RasterImage objects directly from disk files, streams or URLs, (as for example, the various methods in the IOcrPageCollection and IOcrAutoRecognizeManager classes do). The RasterImage loaded holds the original image and is useful only when saving graphics zones or image-over-text overlays. If the image is large, and one created using conventional memory, then a large amount of physical memory is used to hold this image in memory and is not available for other purposes such as auto-zoning or recognition. This is more noticeable in multi-threaded applications where loading several large images in conventional memory can cause out-of-memory errors, even when performing operations that normally would succeed.

Use "MaximumPageConventionalMemorySize" to set the maximum size of the image in memory allowed before the IOcrEngine automatically switches to use the disk memory feature of RasterImage and (RasterMemoryFlags). The "MaximumPageConventionalMemorySize" is in KBytes and its default value depends on the processors being used. For x86 processors, the value is 42187 (42MBytes). For x64 processors, the value is calculated dynamically (1.7GBytes for each 8 cores, not exceeding the physical memory size). These values allow a typical OCR image (8.5 by 11 inches at 300 DPI and 32-bits per pixel) to be loaded in conventional memory. Anything significantly larger than that gets switched to use disk memory mode.

Different factors affect the performance of a particular setting and must be weighed and they include the following factors:

Recognition.ModifyProcessingImage

Boolean type. true to modify the processing image after recognition; otherwise, false. The default value is true. It is best to set the value of this setting to true if IOcrPage.Recognize is called only once per page.

IOcrAutoRecognizeManager temporarily sets the value of this setting to true while performing a recognition job.

Recognition.Preprocess.BlackWhiteImageConversionMethod

Enum type. This setting influences how a non-black and white image, stored in the Engine, is converted to a black and white one. The default value is Default (0).

Possible values are:

Value Description
(0) Default This affects grayscale or 24-bit color images. A black and white image is created in the Engine's memory. Image binarization applies an automatic adaptive thresholding algorithm.
(1) Dynamic This affects grayscale or 24-bit color images. A black and white image is created in the Engine's memory. Each pixel is compared to a dynamically-calculated threshold. If the pixel intensity is higher it is set to white; otherwise, it is set to black.
(2) User This affects grayscale or 24-bit color images. A black and white image is created in the Engine's memory. Thresholding with a user-defined threshold value is performed. Set the threshold with Recognition.Preprocess.BlackWhiteImageConversionThreshold).

Recognition.Preprocess.DownSampleLargeImage

Boolean type. true to downsample large images prior to recognition; otherwise, false. The default value is false.

Set the value to true to prevent the OCR engine from creating processing images (the image used for recognition) larger than 4000 by 4000 pixels (in order to preserve memory and resources). This value is ignored if the value of the MobileImagePreprocess setting is true.

Recognition.Preprocess.BlackWhiteImageConversionThreshold

Integer (0 to 255). The threshold to use when converting colored images to bitonal (black and white) in preparation for recognizing the text on the image. Conversion separates the text intensities from the background intensities. The default value is 185.

This is the equivalent of calling IntensityDetectCommand on the image with InColor equal to the detected foreground (text) color, OutColor equal to the detected background color, Channel set to Master, HighThreshold equal to 255, and LowThreshold equal to the value of this setting.

Recognition.Preprocess.ModifyOriginalImageOptions

Enum type. Specifies how the original image is modified when calling the IOcrPage.AutoPreprocess method. The default value is Deskew | Rotate | Invert (0x01 | 0x02 | 0x04 = 0x07).

Values can be OR'd together. Possible values are:

Value Description
(0) None Never modify the original image.
(0x01) Deskew Apply any angle found while deskewing (IOcrPage.GetDeskewAngle) the original image.
(0x02) Rotate Apply the angle (always a right angle) found while performing auto-orientation (IOcrPage.GetRotateAngle) on the original image (auto-orient).
(0x04) Invert Apply the inversion value (IOcrPage.IsInverted) on the original image.

Recognition.Preprocess.MobileImagePreprocess

Boolean type. true to enable mobile image processing mode; otherwise, false. The default value is false.

By design, the OCR engine tries to upscale low resolution (DPI) images. However, most cameras in mobile devices take pictures with a low resolution (for example, 72 DPI) but a large pixel size. If the OCR engine upscales such images, a lot more memory than necessary is consumed. If you are using the OCR engine to process images from a mobile camera, set the mobile image processing mode to true.

Recognition.Preprocess.RemoveInvertedTextRegionsFromProcessImage

Boolean type. true to automatically detect and recognize inverted regions, otherwise; false. The default value is false.

Set this value to true to support OCRing an image that contains both black/white and white/black areas.

Recognition.Preprocess.UseZoningEngine

Boolean type. true to use the zoning engine to exclude graphics areas from preprocessing calculations such as deskew and auto-rotate; otherwise, false. The default value is true.

Recognition.Preprocess.MinimumAutoRotateConfidence

Integer (0 to 100). Used by the IOcrPage.AutoPreprocess method to determine the minimum confidence percentage threshold to use when orienting pages. The default value is 26.

Recognition.RecognitionModuleTradeoff

Enum type. Recognition module tradeoff between speed and accuracy. The default value is Balanced (1).

Possible values are:

Value Description
(0) Accurate Accuracy is more important than speed.
(1) Balanced Accuracy and speed are equally important.
(2) Fast Speed is more important than accuracy.

Recognition.RecognitionModuleType

Enum type. Specifies the recognition module to use to process machine-printed, handwritten text, or a combination of both.

Possible values are:

Value Description
(0) OCR The engine considers all input images to have machine-printed text only.
(1) ICR The engine considers all input images to have handwritten text only.
(2) Mixed The engine considers all input images to have a mix of machine-printed text and handwritten text. The engine detects automatically handwritten zones and machine printed zones, even if these zones have not been pre-specified by users.

Recognition.ShareOriginalImage

Boolean type. true to share the image reference used to create the OCR page; otherwise, false. The default value is false.

Setting this value to true affects the IOcrPageCollection.AddPage(RasterImage, OcrProgressCallback) and IOcrPageCollection.InsertPage(int, RasterImage, OcrProgressCallback) methods. When the value is false (the default), these methods make a copy of the image and use the copy to create the page. Calling IOcrPage.GetRasterImage(OcrPageType.Original) on such a page returns a null reference.

When the value is true, these methods use the same image reference to create the page. Calling IOcrPage.GetRasterImage(OcrPageType.Original) on such a page returns the original image reference.

IOcrAutoRecognizeManager temporarily sets the value of this setting to true while performing a recognition job.

Recognition.Threading.MaximumThreads

Integer (0 to Int32.MaxValue). Gets or sets the maximum number of threads to use in recognition. The LEADTOOLS OCR Module - LEAD Engine provides support for recognizing document zones in separate threads. This can improve the performance of the IOcrPage.Recognize method.

The default value is 0, which instructs LEADTOOLS to use the system thread pool. The number of threads is calculated automatically. Setting the value to a number > 1 also turns multi-threading on, but the number of threads specified is ignored and calculated automatically instead. To turn multi-threading off inside the IOcrPage.Recognize method and use a single thread, set the value to 1.

Recognition.Zoning.CropZoneImage

Boolean type. true to crop each zone from the original image and recognize it by itself; otherwise, false. The default value is true.

Setting this value to true can improve the performance of the IOcrPage.Recognize method.

Recognition.Zoning.DetectVerticalZones

Enum type. Vertical zone detection mode. This works with Latin and Asian languages.

Possible values are:

Value Description
(0) Auto Automatic - currently this means on for Asian languages such as Japanese as off for Latin languages such as English.
(1) On On - currently this means on for both Asian languages such as Japanese and Latin languages such as English.
(2) Off Off - currently this means off for both Asian languages such as Japanese and Latin languages such as English.

Recognition.Zoning.DetectZoneRotationAngle

Boolean type. true to try to detect a separate rotation angle for each zone; otherwise, false. The default value is false.

Setting this value to false can increase the speed of the recognition engine.

Recognition.Zoning.DisableMultiThreading

Boolean type. true to disable multi-threading when performing auto-zoning; otherwise, multi-threading is enabled. The default value is false.

Multi-threading enhances the performance of the auto-zoning algorithm. However, it can be undesirable if the OCR engine is hosted on a server.

Recognition.Zoning.EnableDoubleZoning

Boolean type. true to perform a second, internal autozoning procedure on each text zone in order to generate more homogenous zones for recognition; otherwise, false. The default value is true. Setting this value can improve the performance of the IOcrPage.Recognize method.

Recognition.Zoning.Options

Enum type. These flags affect the way the IOcrPage.AutoZone method works. The default value is Detect Text | Detect Graphics | Detect Table | Detect Accurate Zones | Table Cells As Zones | Use Advanced Table Detection | Use Text Extractor | Favor Graphics (0x01 | 0x02 | 0x04 | 0x10 | 0x40 | 0x80 | 0x100 | 0x400).

Values can be OR'ed together. Possible values are:

Value Description
(0) None No options. The engine will not detect any zones and hence no recognition is performed.
(0x01) Detect Text Search for text zones inside the page image.
(0x02) Detect Graphics Search for graphic zones inside the page image.
(0x04) Detect Table Search for table zones inside the page image.
(0x08) Allow Overlap Allow zones to overlap; otherwise, detected zones will not overlap.
(0x10) Detect Accurate Zones Detect smaller and more accurate zones (like page paragraphs). Unless this flag is set the auto-zone algorithm tries to detect the largest possible zones.
(0x20) Recognize One Cell Table Even if a table has only one cell, detect it as a table. Must be OR'ed with Detect Table
(0x40) Table Cells as Zones Treat each cell detected inside a table as its own zone. If this option is set, the zone types are OcrZoneType.Text instead of OcrZoneType.Table. Must be OR'ed with Detect Table.
(0x80) Use Advanced Table Detection Use advanced table detection to obtain the most accurate results when the document contains tables. This option recursively and aggressively parses the document to locate the positions of tables and cells. Using this option generates the most accurate representation of the original document and its tables in the final output. This option must be OR'ed with Detect Table.
(0x100) Use Text Extractor Improves text zone recognition. Extracts text by separating graphics and tables from text areas.
(0x200) Detect Checkbox Search for checkbox zones inside the page image.
(0x400) Favor Graphics Favor converting a blob with very low accuracy into a contiguous graphics instead of text. This option is on by default and results in better visual representation of the output documents. The OCR engine will set this option off when performing Auto Recognize with Text or PDF with Image over Text options set. In this mode, the engine assumes that the result should contain all text parsed regardless of quality.

Recognition.Words.DiscardLowConfidenceWords

Boolean type. true to discard words with a low rating; otherwise, false. The default value is true.

This setting controls the output. If true, the engine checks the confidence of each word and prevents any having a low rating (lower than the LowWordConfidence value) from being included when saving the recognition results to any of the document formats supported by the LEADTOOLS toolkits.

Recognition.Words.DiscardLowConfidenceZones

Boolean type. true to discard zones with low ratings; otherwise, false. The default value is false. This setting controls the output. If true, the engine checks all of the words/characters in a zone. If it determines that the overall confidence and type of characters constitute noise, then the recognition results for the entire zone is discarded.

Recognition.Words.LowWordConfidence

Integer (0 to 100). Discard any word with a confidence value less than this value. the default value is 50. This setting only takes effect when DiscardLowConfidenceWords is set to true.


SpellChecker

SpellChecker.EnableCache

Boolean type. true to enable caching of frequent words, otherwise; false. The default value is true.

SpellChecker.MaximumDictionaries

Integer (0 to 255). Gets or sets the maximum number of spell checkers to use at the same time. The default value is the number of available dictionaries found in the system.

Help Version 21.0.2020.9.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Imaging, Medical, and Document