ImageGear for .NET User Guide > Using ImageGear for .NET > Using ImageGear.Recognition Namespace > Preparing the Image for Recognition > Pre-Processing Operations > DESKEWING |
Image deskewing can be done on any image type (bitonal, grayscale, or color), either automatically or with a programmed value. A deskewed image should increase auto-zoning and recognition accuracy.
The Deskew Method immediately deskews a whole single image in the recognition engine's memory space by an amount defined in the method itself - up to 30 degrees. The DetectSkew Method can be used to detect the amount of skew in an image.
The Deskew Method ignores the DeskewMode Property and SkewAmount Property set in ImGearRecPreprocessingSettings Class. The deskewed image replaces the original image, retaining its type and format, and is available to the recognition engine and the application.
A deskewing mode setting is made with DeskewMode Property, taking values from ImGearRecDeskewMode Enumeration. These are:
The skew value to be applied for SET is defined with SkewAmount Property. The value needed here can be obtained by ImGearRecImage.DetectSkew Method.
This mode-induced deskewing is performed when ImGearRecImage.Preprocess Method is called. The deskewed image replaces the original one; it keeps its original type and format and is available to the recognition engine and the application.
When AUTO is set, grayscale or color images undergo an implicit secondary conversion to create a clean but hidden bitonal image. If AUTO is set and despeckle mode is ON for a bitonal image with over 280 dpi, a hidden, despeckled bitonal image is created. Skew detection is done on the bitonal image - the despeckled image, if available. These hidden bitonal images are not available to the application. The detected deskew value is applied to the original image.
3D Deskew
The 3D deskew feature performs a 3-dimensional deskew on a page. This is useful for correcting skew and perspective distortion common in images taken by a digital camera. In these distorted images, parallel text lines are transformed to be horizontal and column edges are transformed to be vertical. The 3D Deskew algorithm does NOT detect that a page is upside down, so an image with this orientation may remain that way after 3D deskew has been performed.
Similar to the standard 2-dimensional deskew, 3D deskew can be applied in two different ways; either indirectly as part of the ImGearRecImage.Preprocess Method, or directly by the Deskew3D Method. A value has been added to the ImGearRecDeskewMode Enumeration to enable 3D deskew during preprocessing. For immediate correction, the new ImGearRecImage.Deskew3D Method can be used.
The 3D deskew algorithm does require a minimum number of characters, text lines and column edges to be successful. A column edge is defined as the beginning and/or end of consecutive text lines that have identical vertical positions (i.e. the left edge of a column aligned left or both edges of a justified column). The minimal quantities are approximately 10 text lines and the edges of two columns or both edges of a single, justified column.
3D deskew is not supported for images with Asian languages. If any Asian language is set for recognition before pre-processing, 3D deskew will not be available. |