GdPicture.NET Reference Guide
AutoDeskew(Int32,Single,Int32,Single,Boolean) Method
Example 





GdPicture14 Namespace > GdPictureImaging Class > AutoDeskew Method : AutoDeskew(Int32,Single,Int32,Single,Boolean) Method
GdPicture Image Identifier.
Maximum angle of research. IE: set 10 to perform a skew research about ±10 degrees. A value lower than 15 is suggested. Value used by other overloads is 15.
Color to use to fill background. A suitable color value can be obtained by using the ARGBI() method.
Determines the smallest angle of skew to detect. 0.25 is suggested. Higher value results in faster detection and vice-versa. Value used by other overloads is 0.25.
Determines if the engine must be optimistic in the skew detection. For example, set true when you know the image has a skew and false otherwise. Value used by other overloads is False.
Tries to deskew a GdPicture image to about ± specified degrees. This method enables to specify the background color to use as a Color Integer Value. It also enables you to put a cut off value where slight skewing of image is allowed. Deskewing an image can help a lot to do OCR, OMR, barcode detection or just improve the readability of an image.
Syntax

Parameters

ImageID
GdPicture Image Identifier.
MaxAngleOfResearch
Maximum angle of research. IE: set 10 to perform a skew research about ±10 degrees. A value lower than 15 is suggested. Value used by other overloads is 15.
BackColor
Color to use to fill background. A suitable color value can be obtained by using the ARGBI() method.
AngleStep
Determines the smallest angle of skew to detect. 0.25 is suggested. Higher value results in faster detection and vice-versa. Value used by other overloads is 0.25.
Optimistic
Determines if the engine must be optimistic in the skew detection. For example, set true when you know the image has a skew and false otherwise. Value used by other overloads is False.

Return Value

A member of the GdPictureStatus enumeration.
Remarks

When minor skewing of images does not affect the subsequent processes, sometimes it is perferred not to deskew the image, could be for quality or timesaving. This method offers the input of a cutt off value, where slight skewing is allowed.

Be aware: If the skew angle is larger than the cutt off value, the returned value will be rounded to the nearest multiple of (AngleStep)

Example
Using AutoDeskew on an image with max angle of 10 is considered for investigation with green as a background color.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("input.png")
If imageId <> 0 Then
   oGdPictureImaging.AutoDeskew(ImageID, 10, oGdPictureImaging.ARGBI(255, 0,255,0), 0.25, True)
   oGdPictureImaging.SaveAsPNG(ImageID, "output.png")
   oGdPictureImaging.ReleaseGdPictureImage(ImageID)
Else
   MessageBox.Show("Error: " + oGdPictureImaging.GetStat().ToString())
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
Overload List
GetSkewAngle(Int32) Method
ARGBI Method