C# Класс Accord.Imaging.Filters.QuadrilateralTransformation

Performs quadrilateral transformation of an area in a given source image.

The class implements quadrilateral transformation algorithm, which allows to transform any quadrilateral from a given source image to a rectangular image. The idea of the algorithm is based on homogeneous transformation and its math is described by Paul Heckbert in his "Projective Mappings for Image Warping" paper.

The image processing filter accepts 8 grayscale images and 24/32 bpp color images for processing.

Sample usage:

// define quadrilateral's corners List<IntPoint> corners = new List<IntPoint>( ); corners.Add( new IntPoint( 99, 99 ) ); corners.Add( new IntPoint( 156, 79 ) ); corners.Add( new IntPoint( 184, 126 ) ); corners.Add( new IntPoint( 122, 150 ) ); // create filter QuadrilateralTransformation filter = new QuadrilateralTransformation( corners, 200, 200 ); // apply the filter Bitmap newImage = filter.Apply( image );

Initial image:

Result image:

Наследование: BaseTransformationFilter
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
newHeight int
newWidth int

Открытые методы

Метод Описание
QuadrilateralTransformation ( ) : System

Initializes a new instance of the QuadrilateralTransformation class.

QuadrilateralTransformation ( List sourceQuadrilateral ) : System

Initializes a new instance of the QuadrilateralTransformation class.

This constructor sets AutomaticSizeCalculaton to , which means that destination image will have width and height automatically calculated based on SourceQuadrilateral property.

QuadrilateralTransformation ( List sourceQuadrilateral, int newWidth, int newHeight ) : System

Initializes a new instance of the QuadrilateralTransformation class.

This constructor sets AutomaticSizeCalculaton to , which means that destination image will have width and height as specified by user.

Защищенные методы

Метод Описание
CalculateNewImageSize ( UnmanagedImage sourceData ) : Size

Calculates new image size.

ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData ) : void

Process the filter on the specified image.

Приватные методы

Метод Описание
CalculateDestinationSize ( ) : void

Описание методов

CalculateNewImageSize() защищенный Метод

Calculates new image size.
Source quadrilateral was not set.
protected CalculateNewImageSize ( UnmanagedImage sourceData ) : Size
sourceData UnmanagedImage Source image data.
Результат System.Drawing.Size

ProcessFilter() защищенный Метод

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData ) : void
sourceData UnmanagedImage Source image data.
destinationData UnmanagedImage Destination image data.
Результат void

QuadrilateralTransformation() публичный Метод

Initializes a new instance of the QuadrilateralTransformation class.
public QuadrilateralTransformation ( ) : System
Результат System

QuadrilateralTransformation() публичный Метод

Initializes a new instance of the QuadrilateralTransformation class.

This constructor sets AutomaticSizeCalculaton to , which means that destination image will have width and height automatically calculated based on SourceQuadrilateral property.

public QuadrilateralTransformation ( List sourceQuadrilateral ) : System
sourceQuadrilateral List Corners of the source quadrilateral area.
Результат System

QuadrilateralTransformation() публичный Метод

Initializes a new instance of the QuadrilateralTransformation class.

This constructor sets AutomaticSizeCalculaton to , which means that destination image will have width and height as specified by user.

public QuadrilateralTransformation ( List sourceQuadrilateral, int newWidth, int newHeight ) : System
sourceQuadrilateral List Corners of the source quadrilateral area.
newWidth int Width of the new transformed image.
newHeight int Height of the new transformed image.
Результат System

Описание свойств

newHeight защищенное свойство

New image height.
protected int newHeight
Результат int

newWidth защищенное свойство

New image width.
protected int newWidth
Результат int