WarpPerspective#
Functions#
- NVCVStatus pvaWarpPerspectiveCreate(NVCVOperatorHandle *handle, NVCVImageRequirements *inRequirements, NVCVImageRequirements *outRequirements, PVAWarpInterpolationType interpType, PVAWarpTransformationType warpTransformationType)
Constructs an instance of the WarpPerspective operator.
- NVCVStatus pvaWarpPerspectiveSubmit(NVCVOperatorHandle handle, cupvaStream_t stream, NVCVImageHandle in, WarpMatrixType invWarpMatrix, NVCVImageHandle out)
Executes the image warp perspective operation.
Functions#
- NVCVStatus pvaWarpPerspectiveCreate(
- NVCVOperatorHandle *handle,
- NVCVImageRequirements *inRequirements,
- NVCVImageRequirements *outRequirements,
- PVAWarpInterpolationType interpType,
- PVAWarpTransformationType warpTransformationType,
Constructs an instance of the WarpPerspective operator.
Perspective Warp algorithm allows for correcting perspective distortion caused by camera misalignment with respect to the object plane being captured. If the camera position, tilt and pan relative to the frame are known, a 3x3 pespective transform can be derived. For perspective transformation, it will perserve collinearity and incidence. When the third row of warping matrix is [0, 0, 1], the transformation is also affine. Affine transformation will also maintain parallelism.
Limitations:
When having fixed output tile shape, the related input tile can be whole image theoretically for certain perspective transformations. For PVA implementations, only 32KB can be afforded for intput tile size, and the host sanity check will throw exceptions if it fails.
Currently only NVCV_BORDER_CONSTANT is supported when accessing input pixels outside the image boundary.
Input: Image sizes and formats are specified in inImageRequirements.
Image Format
Allowed
U8
Yes
NV12
Yes
Output: Image sizes and formats are specified in outImageRequirements.
Input/Output Dependency:
Property
Input == Output
Format
Yes
Parameters
- Parameters:
handle – [out] Where the operator instance handle will be written to.
Must not be NULL.
inRequirements – [in] Pointer to the NVCVImageRequirements structure which contains image shape, strides, and format information.
outRequirements – [in] Pointer to the output image NVCVImageRequirements structure.
interpType – [in] Interpolation type to be used when accessing non integer pixel values. PVAWarpInterpolationType.
WARP_INTERPOLATION_NN or WARP_INTERPOLATION_LINEAR
warpTransformationType – [in] to indicate if the warp transformation is perspective or affine. PVAWarpTransformationType.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Possible cases include: 1) The handle, stream, input, or output is either NULL or points to an invalid address. 2) The input or output image does not meet the requirements used to create the operator handle. 3) The metadata of the input does not correspond to the correct NV12 format (e.g., number of planes not equal to 2).
NVCV_ERROR_OUT_OF_MEMORY – Possible cases include: 1) Failed to allocate memory for the operator. 2) Failed to allocate memory for holding input tile buffer, which the host initializes then sends it for the device’s use.
NVCV_SUCCESS – Operation executed successfully.
- NVCVStatus pvaWarpPerspectiveSubmit(
- NVCVOperatorHandle handle,
- cupvaStream_t stream,
- NVCVImageHandle in,
- WarpMatrixType invWarpMatrix,
- NVCVImageHandle out,
Executes the image warp perspective operation.
- Parameters:
handle – [in] Handle to the operator.
Must not be NULL.
stream – [in] Handle to a valid CUPVA stream.
in – [in] Input image handle.
invWarpMatrix – [in] 3x3 row-major matrix for warping remap, input coordinates are computed via invWarpMatrix * [x, y, 1]^T
out – [out] Output image handle.
- 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.