NVIDIA 2D Image And Signal Performance Primitives (NPP)  Version 10.2.*.*
Affine Transform Utility Functions

The set of affine transform utility functions. More...

## Functions

NppStatus nppiGetAffineTransform (NppiRect oSrcROI, const double aQuad, double aCoeffs)
Computes affine transform coefficients based on source ROI and destination quadrilateral. More...

Compute shape of transformed image. More...

NppStatus nppiGetAffineBound (NppiRect oSrcROI, double aBound, const double aCoeffs)
Compute bounding-box of transformed image. More...

## Detailed Description

The set of affine transform utility functions.

## Function Documentation

 NppStatus nppiGetAffineBound ( NppiRect oSrcROI, double aBound, const double aCoeffs )

Compute bounding-box of transformed image.

The method effectively computes the bounding box (axis aligned rectangle) of the transformed source ROI (see nppiGetAffineQuad()).

Parameters
 oSrcROI The source ROI. aBound The resulting bounding box. aCoeffs The afine transform coefficients.
Returns
Error codes:
• NPP_SIZE_ERROR Indicates an error condition if any image dimension has zero or negative value
• NPP_RECTANGLE_ERROR Indicates an error condition if width or height of the intersection of the oSrcROI and source image is less than or equal to 1
• NPP_COEFFICIENT_ERROR Indicates an error condition if coefficient values are invalid

Compute shape of transformed image.

This method computes the quadrilateral in the destination image that the source ROI is transformed into by the affine transformation expressed by the coefficients array (aCoeffs).

Parameters
 oSrcROI The source ROI. aQuad The resulting destination quadrangle. aCoeffs The afine transform coefficients.
Returns
Error codes:
• NPP_SIZE_ERROR Indicates an error condition if any image dimension has zero or negative value
• NPP_RECTANGLE_ERROR Indicates an error condition if width or height of the intersection of the oSrcROI and source image is less than or equal to 1
• NPP_COEFFICIENT_ERROR Indicates an error condition if coefficient values are invalid
 NppStatus nppiGetAffineTransform ( NppiRect oSrcROI, const double aQuad, double aCoeffs )

Computes affine transform coefficients based on source ROI and destination quadrilateral.

The function computes the coefficients of an affine transformation that maps the given source ROI (axis aligned rectangle with integer coordinates) to a quadrilateral in the destination image.

An affine transform in 2D is fully determined by the mapping of just three vertices. This function's API allows for passing a complete quadrilateral effectively making the prolem overdetermined. What this means in practice is, that for certain quadrilaterals it is not possible to find an affine transform that would map all four corners of the source ROI to the four vertices of that quadrilateral.

The function circumvents this problem by only looking at the first three vertices of the destination image quadrilateral to determine the affine transformation's coefficients. If the destination quadrilateral is indeed one that cannot be mapped using an affine transformation the functions informs the user of this situation by returning a NPP_AFFINE_QUAD_INCORRECT_WARNING.

Parameters
 oSrcROI The source ROI. This rectangle needs to be at least one pixel wide and high. If either width or hight are less than one an NPP_RECTANGLE_ERROR is returned. aQuad The destination quadrilateral. aCoeffs The resulting affine transform coefficients.
Returns
Error codes:
• NPP_SIZE_ERROR Indicates an error condition if any image dimension has zero or negative value
• NPP_RECTANGLE_ERROR Indicates an error condition if width or height of the intersection of the oSrcROI and source image is less than or equal to 1
• NPP_COEFFICIENT_ERROR Indicates an error condition if coefficient values are invalid
• NPP_AFFINE_QUAD_INCORRECT_WARNING Indicates a warning when quad does not conform to the transform properties. Fourth vertex is ignored, internally computed coordinates are used instead