ClearImage .NET API
AutoDeskew Method (ImageEditor)
Example 





Inlite.ClearImageNet Namespace > ImageEditor Class : AutoDeskew Method
Automatically deskew the image
Syntax
'Declaration
 
Public Function AutoDeskew() As System.Double
'Usage
 
Dim instance As ImageEditor
Dim value As System.Double
 
value = instance.AutoDeskew()
public System.double AutoDeskew()
public function AutoDeskew(): System.Double; 
public function AutoDeskew() : System.double;
public:
System.double AutoDeskew(); 

Return Value

The returned value is in the range from -45 degrees to 45 degrees.   If the value is negative, then the image was skewed counterclockwise.
Remarks
Deskews image to the nearest vertical or horizontal axis, on Image content.   If  Zone is set the whole image is deskewed based on data within Zone rectangle.
Example
void RepairMethods(string imageFile, string imageFileOut)
{
    ImageEditor editor = new ImageEditor();
    try
    {
        // Open image file
        editor.Image.Open(imageFile, 1);
        // Do Processing
        editor.AutoDeskew();                // Use AutoDeskew before AutoRotate
        editor.AutoRotate();
        // editor.AutoCrop(10, 10, 10, 10); // Do not use AutoCrop with AutoRegister or BorderExtract
        // editor.AutoRegister(100, 100);   // Do not use AutoRegister with AutoCrop or BorderExtract
        editor.AdvancedBinarize();
        editor.BorderExtract(BorderExtractMode.deskewCrop);
        editor.RemovePunchHoles();
        editor.SmoothCharacters();
        editor.CleanNoise(3);              // Remove only black pixels.  Use CleanNoiseExt to remove white noise
        // editor.CleanNoise(CleanNoiseFlags.black | CleanNoiseFlags.white, 3, 3, 10);
        editor.lineCurvature = LineCurvature.low;
        editor.lineMaxAngle = 5;
        editor.lineMaxGap = 5;
        editor.lineMinLength = 200;
        editor.DeleteLinesAndRepair(LineDirection.horzAndVert);
        //  Save processed image
       editor.Image.SaveAs(imageFileOut, Inlite.ClearImage.EFileFormat.ciEXT);
    }
    catch (ClearImageException ex)
    { Console.WriteLine(ex.Message); }
    finally
    {editor.Dispose(); }  // ClearImage V9 and later
}
See Also

Reference

ImageEditor Class
ImageEditor Members