Assembly: AForge.Imaging (in AForge.Imaging.dll) Version: 22.214.171.124 (126.96.36.199)
public class DocumentSkewChecker
The class implements document's skew checking algorithm, which is based on Hough line transformation. The algorithm is based on searching for text base lines - black line of text bottoms' followed by white line below.
The range of angles to detect is controlled by MaxSkewToDetect property.
The filter accepts 8 bpp grayscale images for processing.
// create instance of skew checker DocumentSkewChecker skewChecker = new DocumentSkewChecker( ); // get documents skew angle double angle = skewChecker.GetSkewAngle( documentImage ); // create rotation filter RotateBilinear rotationFilter = new RotateBilinear( -angle ); rotationFilter.FillColor = Color.White; // rotate image applying the filter Bitmap rotatedImage = rotationFilter.Apply( documentImage );