ImageGear Professional v18.2 > User Guide > Using ImageGear > Optical Character Recognition > Preparing the Image for Recognition > Pre-Processing the Image > Deskewing |
Image deskewing can be done on any image type (bi-tonal, grayscale, or color), either automatically or with a programmed value. A deskewed image should increase auto-zoning and recognition accuracy.
The function IG_REC_image_deskew() immediately deskews a whole single image in the recognition engine's memory space by an amount defined in the function itself - up to 30 degrees. IG_REC_image_skew_detect() can be used to detect the amount of skew in an image.
Function IG_REC_image_deskew3D performs 3D deskew on the current image. The function tries to correct the skew and perspective distortion of an image taken by a digital camera. Parallel text lines are transformed to be horizontal, and column edges are transformed to be vertical.
IG_REC_image_deskew3D and IG_REC_image_deskew() ignore the deskewing mode setting IG_REC_deskew_mode_set() and the value given by IG_REC_slope_set(). The deskewed image replaces the original one, retaining its type and format, and is available to the recognition engine and the application.
A deskewing mode setting is made with IG_REC_deskew_mode_set(), taking values from enumIGRecImgDeskew. These are:
The skew value to be applied for IG_REC_IMG_DESKEW_SET is defined with IG_REC_slope_set(). The value needed here can be obtained by IG_REC_image_skew_detect().
This mode-induced deskewing is performed when IG_REC_image_preprocess() 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 IG_REC_IMG_DESKEW_AUTO is set, grayscale or color images undergo an implicit secondary conversion to create a clean but hidden bi-tonal image. If DSK_AUTO is set and despeckle mode is ON for a bi-tonal image with over 280 dpi, a hidden, despeckled bi-tonal image is created. Skew detection is done on the bi-tonal image - the despeckled one, if available. These hidden bi-tonal images are not available to the application. The detected deskew value is applied to the original image.