Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Geometric Image Transformations » cvWarpPerspective


Applies a perspective transformation to an image.

Name Type Range Description
inSrc Image Source image.
inM Matrix 2x3 transformation matrix.
inDWidth Integer 0 - Width of destination image.
inDHeight Integer 0 - Height of destination image.
inInterpolation CvInterpolationMethod Interpolation method.
inWarpInverseMap Bool True value means that M is the inverse transformation, dst->src.
inBorderMode CvBorderType Pixel extrapolation method.
inBorderValue Pixel* Value used in case of a constant border.
outDst Image Output image.


WarpPerspective transforms source image using specified inM matrix as follows:

when inWarpInverseMap is true. Otherwise, the transformation is first inverted and then put to formula above instead of inM.


The useful transformation matrix may be obtained using cvGetPerspectiveTransform filter.


This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Input transformation matrix must have dimensions 3 x 3 in cvWarpPerspective.

Complexity Level

This filter is available on Basic Complexity Level.

See Also

  • cvWarpAffine – Applies an affine transformation to an image.