Warp Perspective

group NVCV_C_ALGORITHM_WARP_PERSPECTIVE

Typedefs

typedef float NVCVPerspectiveTransform[9]

Functions

NVCVStatus cvcudaWarpPerspectiveCreate(NVCVOperatorHandle *handle, const int32_t maxVarShapeBatchSize)

Constructs and an instance of the WarpPerspective operator.

Parameters:

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

  • Must not be NULL.

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 cvcudaWarpPerspectiveSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle out, const NVCVPerspectiveTransform transMatrix, const int32_t flags, const NVCVBorderType borderMode, const float4 borderValue)

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

Applies an perspective 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.

  • transMatrix[in] 3x3 perspective transformation matrix.

  • 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 trans_matrix as the inverse transformation.

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

  • borderValue[in] Used to specify values for a constant border for each color chanel i.e. If ARGB this would contain the values for Alpha, Red, Green, Blue channels.

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 cvcudaWarpPerspectiveVarShapeSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVImageBatchHandle in, NVCVImageBatchHandle out, NVCVTensorHandle transMatrix, const int32_t flags, const NVCVBorderType borderMode, const float4 borderValue)