ImageGear for C and C++ on Linux v20.0 - Updated
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_deskew_auto

This function automatically detects the angle of the 1-bit document referenced by hIGear, and rotates it so that it is straight (i.e., de-skews it).


Copy Code
        HIGEAR hIGear, 
        DOUBLE dblAngleThresh, 
        AT_MODE nExpand_clip_option


Name Type Description
hIGear HIGEAR HIGEAR handle of image to be decoded.
dblAngleThresh DOUBLE Do not de-skew if the skew angle is less than this parameter.
nExpand_clip_option AT_MODE An AT_MODE type variable, either: IG_ROTATE_CLIP or IG_ROTATE_EXPAND.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

Indexed RGB – 1 bpp;
Grayscale – 1 bpp.


Copy Code
HIGEAR    hIGear;      /* HIGEAR handle of image  */
DOUBLE   angle_thresh;/* max angle above which should not perform skew  */
AT_MODE nExpand_clip_option;/* expand image or clip doc  */
AT_ERRCOUNT nErrcount;    /* will tally returned IG errors */
nErrcount = IG_IP_deskew_auto ( hIGear, 3.0, IG_ROTATE_CLIP);


If the skew angle is less than dblAngleThresh, then the image is not de-skewed. If nExpand_clip_option is set to IG_ROTATE_EXPAND, the size of image width or height will be enlarged as necessary to accommodate the document when it has been rotated. Otherwise, any areas of the document that now fall outside the borders of the original width and height of the image, will be cropped.

If you want to first detect the angle and then decide whether to rotate it, you can make separate calls to IG_IP_deskew_angle_find() and IG_IP_rotate_any_angle() functions.
Is this page helpful?
Yes No
Thanks for your feedback.