Affine Transform Utility Functions
Affine Transforms

## Functions

NppStatus | nppiGetAffineTransform (NppiRect oSrcROI, const double aQuad[4][2], double aCoeffs[2][3])
| Computes affine transform coefficients based on source ROI and destination quadrilateral. More...
NppStatus | nppiGetAffineQuad (NppiRect oSrcROI, double aQuad[4][2], const double aCoeffs[2][3])
| Compute shape of transformed image. More...
NppStatus | nppiGetAffineBound (NppiRect oSrcROI, double aBound[2][2], const double aCoeffs[2][3])
| Compute bounding-box of transformed image. More...

## Detailed Description

## Function Documentation

NppStatus nppiGetAffineBound | ( | NppiRect | oSrcROI,
|  | double | aBound[2][2],
|  | const double | aCoeffs[2][3]
| ) |  |

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

NppStatus nppiGetAffineQuad | ( | NppiRect | oSrcROI,
|  | double | aQuad[4][2],
|  | const double | aCoeffs[2][3]
| ) |  |

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[4][2],
|  | double | aCoeffs[2][3]
| ) |  |

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

Copyright © 2009-2018 NVIDIA Corporation