VPI - Vision Programming Interface

3.1 Release

Perspective Warp

Applies a perspective warp on an image. More...


typedef float VPIPerspectiveTransform[3][3]
 Represents a 2D perspective transform. More...


VPIStatus vpiSubmitPerspectiveWarp (VPIStream stream, uint64_t backend, VPIImage input, const VPIPerspectiveTransform xform, VPIImage output, const VPIWarpGrid *grid, VPIInterpolationType interp, VPIBorderExtension border, uint64_t flags)
 Submits a Perspective Warp operation to the stream. More...

Detailed Description

Applies a perspective warp on an image.

Refer to Perspective Warp for more details and usage examples.

Typedef Documentation

◆ VPIPerspectiveTransform

typedef float VPIPerspectiveTransform[3][3]

#include <vpi/Types.h>

Represents a 2D perspective transform.

[vx]   [a11 a12 tx] [ux]
[vy] = [a21 a22 ty] [uy]
[vw]   [ p0  p1  p] [ 1]
u'x  = vx/vw
u'y  = vy/vw

In these equations,

  • ux, uy are the inhomogeneous coordinates in the source image.
  • u'x, u'y are the inhomogeneous coordinates in the destination image.
  • vx,vy,vw are the homogeneous coordinates in the destination image.
  • a11,a12,a21,a22 are the2x2 non-singular matrix with the linear component of the transform.
  • tx,ty is the translation component of the transform.
  • p0,p1,p are the projective components of the transform. p is usually 1.

Definition at line 689 of file Types.h.

Function Documentation

◆ vpiSubmitPerspectiveWarp()

VPIStatus vpiSubmitPerspectiveWarp ( VPIStream  stream,
uint64_t  backend,
VPIImage  input,
const VPIPerspectiveTransform  xform,
VPIImage  output,
const VPIWarpGrid grid,
VPIInterpolationType  interp,
VPIBorderExtension  border,
uint64_t  flags 

#include <vpi/algo/PerspectiveWarp.h>

Submits a Perspective Warp operation to the stream.

[in]streamThe stream where the operation will be queued in.
  • Must not be NULL.
  • Stream must have enabled the backends that will execute the algorithm.
[in]backendVPI backends that are eligible to execute the algorithm.
[in]inputInput image to be warped.
[in]xformTransform to be applied.
[out]outputOutput image where warped image is written to. Dimensions may be different from input.
  • Must not be NULL.
  • Image must have enabled the backends that will execute the algorithm.
  • Must have same format as input image.
  • Dimensions must be even.
[in]gridGrid on the output to establish performance/quality trade-offs. A dense grid will result in best quality, albeit slower performance. Grid must be set depending on the perf/quality criteria needed. Pass NULL as a shortcut for using a dense grid.
  • CPU and CUDA only accept dense grids.
  • Grid dimensions must match output dimensions.
[in]interpInterpolation mode to be used when source coordinate doesn't fall exactly on pixel center.
[in]borderBorder extension to use for samples that fall outsize input's bounds.
[in]flagsFlags to modify algorithm behavior.
  • Can be a combination of one or more of the following values:
    • 0 : default, transform maps the input into the output
    • VPI_WARP_INVERSE : transform maps the output back into the input.
    • VPI_PRECISE : precise, but potentially slower implementation.
Return values
VPI_ERROR_INVALID_ARGUMENTinput and output must have the same format.
VPI_ERROR_INVALID_ARGUMENTborder not supported.
VPI_ERROR_INVALID_ARGUMENTbackend is invalid or unknown.
VPI_ERROR_INVALID_ARGUMENTinput and/or output dimensions not supported.
VPI_ERROR_INVALID_ARGUMENTgrid configuration not supported by backend.
VPI_ERROR_INVALID_ARGUMENTgrid dimensions don't match output image's.
VPI_ERROR_INVALID_IMAGE_FORMATImage format not supported.
VPI_ERROR_NOT_IMPLEMENTEDPerspective Warp algorithm is not supported by given backend.
VPI_ERROR_INVALID_OPERATIONBackend hardware not available.
VPI_ERROR_INVALID_OPERATIONThe needed backends aren't enabled in stream, input or output.
VPI_SUCCESSOperation executed successfully.