(Document/Medical) Scanned documents are not always straight. They can be skewed by the scanner feeder or get inserted in the wrong direction (upside down). For the best possible results such images need correction before being processed by the OCR engine. LEADTOOLS provides a number of pre-processing command classes that can be used to correct the orientation of images. These include the ImageProcessing.Core.DeskewCommand and ImageProcessing.Core.SearchRegistrationMarksCommandData classes.
Pre-processing bitional (1-Bit) images
For more information about preprocessing bitonal images refer to Cleaning Up 1-Bit Images.
Pre-processing color images
Sometimes documents are scanned in color. Color images can be adjusted or enhanced using various LEADTOOLS commands. For more information, refer to Leadtools.ImageProcessing.Color.
A more practical solution is to convert the image to a bitonal (1-bit) image before processing in order to achieve better results. However, converting color images to a 1-bit image can cause loss of some important features due to the lack of colors in the 1-bit image. Convert color images to bitonal images by using either the ColorResolutionCommand, Leadtools.ImageProcessing.Color.IntensityDetectCommand or the Leadtools.ImageProcessing.Color.DynamicBinaryCommand class.
Auto Binarize
The most sophisticated way to convert color images to bitonal images is by using the Leadtools.ImageProcessing.Core.AutoBinarizeCommand. The Leadtools.ImageProcessing.Core.AutoBinarizeCommand uses several pre-processing and threshold operations in order to maintain the key features of a colored image. The AutoBinarizeCommand can be adjusted to the specific input device used, such as a scanner or camera. It is perfect for making unclear document images more readable.
The following example demonstrates how the AutoBinarizeCommand can be used to detect text with excellent results:
Before
After
The AutoBinarizeCommand class works automatically, but also allows customization of how the algorithm works. Options include whether to perform internal processing on the image. You can also choose which threshold method to use.