Warp Affine

group NVCV_C_ALGORITHM_WARP_AFFINE

Typedefs

typedef float NVCVAffineTransform[6]

Functions

NVCVStatus cvcudaWarpAffineCreate(NVCVOperatorHandle *handle, const int32_t maxVarShapeBatchSize)

Constructs and an instance of the WarpAffine operator.

Parameters
  • handle[out] Where the image instance handle will be written to.

    • Must not be NULL.

  • maxVarShapeBatchSize[in] maximum batch size for var shape operator

Return values
  • NVCV_ERROR_INVALID_ARGUMENT – Handle is null.

  • NVCV_ERROR_OUT_OF_MEMORY – Not enough memory to create the operator.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus cvcudaWarpAffineSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle out, const NVCVAffineTransform xform, const int32_t flags, const NVCVBorderType borderMode, const float4 borderValue)

Executes the WarpAffine operation on the given cuda stream. This operation does not wait for completion.

Applies an affine transformation to an image. outputs(x,y) = saturate_cast<out_type>(input(transform(x,y))) where transform() is the linear transformation operator (matrix)

Limitations:

Input: Data Layout: [kNHWC, kHWC] Channels: [1,3,4]

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

Yes

16bit Signed

Yes

32bit Unsigned

No

32bit Signed

No

32bit Float

Yes

64bit Float

No

Output: Data Layout: [kNHWC, kHWC] Channels: [1,3,4]

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

Yes

16bit Signed

Yes

32bit Unsigned

No

32bit Signed

No

32bit Float

Yes

64bit Float

No

Input/Output dependency

 Property      |  Input == Output
-------------- | -------------
 Data Layout   | Yes
 Data Type     | Yes
 Number        | Yes
 Channels      | Yes
 Width         | No
 Height        | No

Parameters
  • handle[in] Handle to the operator.

    • Must not be NULL.

  • stream[in] Handle to a valid CUDA stream.

  • in[in] input tensor.

  • out[out] output tensor.

  • xform[in] 2x3 float affine transformation matrix stored as a 1-D array of length 6.

  • flags[in] Combination of interpolation methods(NVCV_INTERP_NEAREST, NVCV_INTERP_LINEAR or NVCV_INTERP_CUBIC) and the optional flag NVCV_WARP_INVERSE_MAP, that sets xform as the inverse transformation.

  • borderMode[in] pixel extrapolation method (NVCV_BORDER_CONSTANT or NVCV_BORDER_REPLICATE).

  • borderValue[in] used in case of a constant border.

Return values
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.

  • NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus cvcudaWarpAffineVarShapeSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVImageBatchHandle in, NVCVImageBatchHandle out, NVCVTensorHandle transMatrix, const int32_t flags, const NVCVBorderType borderMode, const float4 borderValue)