Performs quadrilateral transformation of an area in the source image.

The class implements simple algorithm described by Olivier Thill for transforming quadrilateral area from a source image into rectangular image. The idea of the algorithm is based on finding for each line of destination rectangular image a corresponding line connecting "left" and "right" sides of quadrilateral in a source image. Then the line is linearly transformed into the line in destination image.

Due to simplicity of the algorithm it does not do any correction for perspective.

To make sure the algorithm works correctly, it is preferred if the "left-top" corner of the quadrilateral (screen coordinates system) is specified first in the list of quadrilateral's corners. At least user need to make sure that the "left" side (side connecting first and the last corner) and the "right" side (side connecting second and third corners) are not horizontal.

Use QuadrilateralTransformation to avoid the above mentioned limitations, which is a more advanced quadrilateral transformation algorithms (although a bit more computationally expensive).

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 SimpleQuadrilateralTransformation filter = new SimpleQuadrilateralTransformation( corners, 200, 200 ); // apply the filter Bitmap newImage = filter.Apply( image );

Initial image:

Result image:

Inheritance: BaseTransformationFilter
 /// <summary>
 /// Initializes a new instance of the <see cref="QuadrilateralTransformationBilinear"/> class.
 /// </summary>
 /// 
 /// <param name="sourceCorners">Corners of the source quadrilateral area.</param>
 /// 
 /// <remarks><para>This constructor sets <see cref="AutomaticSizeCalculaton"/> to
 /// <see langword="true"/>, which means that destination image will have width and
 /// height automatically calculated based on <see cref="SourceCorners"/> property.</para></remarks>
 ///
 public QuadrilateralTransformationBilinear( List<IntPoint> sourceCorners )
 {
     baseFilter = new SimpleQuadrilateralTransformation( sourceCorners );
     baseFilter.UseInterpolation = true;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="QuadrilateralTransformationBilinear"/> class.
 /// </summary>
 ///
 /// <param name="sourceCorners">Corners of the source quadrilateral area.</param>
 ///
 /// <remarks><para>This constructor sets <see cref="AutomaticSizeCalculaton"/> to
 /// <see langword="true"/>, which means that destination image will have width and
 /// height automatically calculated based on <see cref="SourceCorners"/> property.</para></remarks>
 ///
 public QuadrilateralTransformationBilinear(List <IntPoint> sourceCorners)
 {
     baseFilter = new SimpleQuadrilateralTransformation(sourceCorners);
     baseFilter.UseInterpolation = true;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="QuadrilateralTransformationNearestNeighbor"/> class.
 /// </summary>
 /// 
 /// <param name="sourceCorners">Corners of the source quadrilateral area.</param>
 /// 
 /// <remarks><para>This constructor sets <see cref="AutomaticSizeCalculaton"/> to
 /// <see langword="true"/>, which means that destination image will have width and
 /// height automatically calculated based on <see cref="SourceCorners"/> property.</para></remarks>
 ///
 public QuadrilateralTransformationNearestNeighbor( List<IntPoint> sourceCorners ) 
 {
     baseFilter = new SimpleQuadrilateralTransformation( sourceCorners );
     baseFilter.UseInterpolation = false;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="QuadrilateralTransformationNearestNeighbor"/> class.
 /// </summary>
 ///
 /// <param name="sourceCorners">Corners of the source quadrilateral area.</param>
 ///
 /// <remarks><para>This constructor sets <see cref="AutomaticSizeCalculaton"/> to
 /// <see langword="true"/>, which means that destination image will have width and
 /// height automatically calculated based on <see cref="SourceCorners"/> property.</para></remarks>
 ///
 public QuadrilateralTransformationNearestNeighbor(List <IntPoint> sourceCorners)
 {
     baseFilter = new SimpleQuadrilateralTransformation(sourceCorners);
     baseFilter.UseInterpolation = false;
 }