C# 클래스 AForge.Imaging.DocumentSkewChecker

Skew angle checker for scanned documents.

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 routine supposes that a white-background document is provided with black letters. The algorithm is not supposed for any type of objects, but for document images with text.

The range of angles to detect is controlled by MaxSkewToDetect property.

The filter accepts 8 bpp grayscale images for processing.

Sample usage:

// 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 );

Initial image:

Deskewed image:

파일 보기 프로젝트 열기: holisticware-admin/MonoVersal.AForgeNET 1 사용 예제들

Private Properties

프로퍼티 타입 설명
CollectLines void
GetMostIntensiveLines AForge.Imaging.HoughLine[]
InitHoughMap void

공개 메소드들

메소드 설명
DocumentSkewChecker ( ) : System

Initializes a new instance of the DocumentSkewChecker class.

GetSkewAngle ( Bitmap image ) : double

Get skew angle of the provided document image.

GetSkewAngle ( Bitmap image, Rectangle rect ) : double

Get skew angle of the provided document image.

GetSkewAngle ( BitmapData imageData ) : double

Get skew angle of the provided document image.

GetSkewAngle ( BitmapData imageData, Rectangle rect ) : double

Get skew angle of the provided document image.

GetSkewAngle ( UnmanagedImage image ) : double

Get skew angle of the provided document image.

GetSkewAngle ( UnmanagedImage image, Rectangle rect ) : double

Get skew angle of the provided document image.

비공개 메소드들

메소드 설명
CollectLines ( short minLineIntensity ) : void
GetMostIntensiveLines ( int count ) : AForge.Imaging.HoughLine[]
InitHoughMap ( ) : void

메소드 상세

DocumentSkewChecker() 공개 메소드

Initializes a new instance of the DocumentSkewChecker class.
public DocumentSkewChecker ( ) : System
리턴 System

GetSkewAngle() 공개 메소드

Get skew angle of the provided document image.
Unsupported pixel format of the source image.
public GetSkewAngle ( Bitmap image ) : double
image System.Drawing.Bitmap Document's image to get skew angle of.
리턴 double

GetSkewAngle() 공개 메소드

Get skew angle of the provided document image.
Unsupported pixel format of the source image.
public GetSkewAngle ( Bitmap image, Rectangle rect ) : double
image System.Drawing.Bitmap Document's image to get skew angle of.
rect System.Drawing.Rectangle Image's rectangle to process (used to exclude processing of /// regions, which are not relevant to skew detection).
리턴 double

GetSkewAngle() 공개 메소드

Get skew angle of the provided document image.
Unsupported pixel format of the source image.
public GetSkewAngle ( BitmapData imageData ) : double
imageData System.Drawing.Imaging.BitmapData Document's image data to get skew angle of.
리턴 double

GetSkewAngle() 공개 메소드

Get skew angle of the provided document image.
Unsupported pixel format of the source image.
public GetSkewAngle ( BitmapData imageData, Rectangle rect ) : double
imageData System.Drawing.Imaging.BitmapData Document's image data to get skew angle of.
rect System.Drawing.Rectangle Image's rectangle to process (used to exclude processing of /// regions, which are not relevant to skew detection).
리턴 double

GetSkewAngle() 공개 메소드

Get skew angle of the provided document image.
Unsupported pixel format of the source image.
public GetSkewAngle ( UnmanagedImage image ) : double
image UnmanagedImage Document's unmanaged image to get skew angle of.
리턴 double

GetSkewAngle() 공개 메소드

Get skew angle of the provided document image.
Unsupported pixel format of the source image.
public GetSkewAngle ( UnmanagedImage image, Rectangle rect ) : double
image UnmanagedImage Document's unmanaged image to get skew angle of.
rect System.Drawing.Rectangle Image's rectangle to process (used to exclude processing of /// regions, which are not relevant to skew detection).
리턴 double