TemplateMatching#
Functions#
- NVCVStatus pvaTemplateMatchingCreate(NVCVOperatorHandle *handle, NVCVTensorRequirements const *const inImageTensorRequirements, NVCVTensorRequirements const *const inTemplateTensorRequirements, NVCVTensorRequirements const *const outTensorRequirements)
Constructs and an instance of the TemplateMatching operator.
- NVCVStatus pvaTemplateMatchingSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle inImage, NVCVTensorHandle inTemplate, NVCVTensorHandle out)
Submits the TemplateMatching operator to a CUDA stream.
- NVCVStatus pvaTemplateMatchingSubmit(NVCVOperatorHandle handle, cupvaStream_t stream, NVCVTensorHandle inImage, NVCVTensorHandle inTemplate, NVCVTensorHandle out)
Submits the TemplateMatching operator to a cuPVA stream.
Functions#
- NVCVStatus pvaTemplateMatchingCreate(
- NVCVOperatorHandle *handle,
- NVCVTensorRequirements const *const inImageTensorRequirements,
- NVCVTensorRequirements const *const inTemplateTensorRequirements,
- NVCVTensorRequirements const *const outTensorRequirements,
Constructs and an instance of the TemplateMatching operator.
Limitations:
Input image tensor:
If the input image tensor has a resolution W × H, then W >= 94 and H >= 94.
Data Layout: [CHW], [HWC], [NCHW], [NHWC] only when
C: [1]
N: [1]
Data Type
Allowed
8bit Unsigned
Yes
8bit Signed
No
16bit Unsigned
No
16bit Signed
No
32bit Unsigned
No
32bit Signed
No
32bit Float
No
64bit Float
No
Input template tensor:
If the template image tensor has a resolution w × h, then 0 < w <= 31 and 0 < h <= 31.
The template is matched only over translations, so matching is neither rotation- nor scale-invariant. A rotated or resized instance of the template is not detected.
Data Layout: [CHW], [HWC], [NCHW], [NHWC] only when
C: [1]
N: [1]
Data Type
Allowed
8bit Unsigned
Yes
8bit Signed
No
16bit Unsigned
No
16bit Signed
No
32bit Unsigned
No
32bit Signed
No
32bit Float
No
64bit Float
No
Output tensor:
The output tensor is the normalized sum of squared differences (score) for every possible location of the template inside the input image tensor. The best match is the lowest score, and an exact match scores zero.
If the input image tensor has a resolution W × H and input template tensor has a resolution w × h, then the output image has a resolution (W - w + 1) × (H - h + 1).
Data Layout: [CHW], [HWC], [NCHW], [NHWC] only when
C: [1]
N: [1]
Data Type
Allowed
8bit Unsigned
No
8bit Signed
No
16bit Unsigned
No
16bit Signed
No
32bit Unsigned
No
32bit Signed
No
32bit Float
Yes
64bit Float
No
Input/Output dependency
Property
Input == Output
Data Layout
Yes
Data Type
No
Number
Yes
Channels
Yes
Width
No
Height
No
- Parameters:
handle – [out] Where the operator instance handle will be written to.
Must not be NULL.
inImageTensorRequirements – [in] Pointer to the NVCVTensorRequirements structure for input image tensor which contains Tensor rank, shape, layout and data type information.
inTemplateTensorRequirements – [in] Pointer to the NVCVTensorRequirements structure for input template tensor which contains Tensor rank, shape, layout and data type information.
outTensorRequirements – [in] Pointer to the NVCVTensorRequirements structure for output tensor which contains Tensor rank, shape, layout and data type information.
- 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 pvaTemplateMatchingSubmit(
- NVCVOperatorHandle handle,
- cudaStream_t stream,
- NVCVTensorHandle inImage,
- NVCVTensorHandle inTemplate,
- NVCVTensorHandle out,
Submits the TemplateMatching operator to a CUDA stream.
Note
CUDA stream support requirements:
PVA SDK 2.7.0 or later
Jetpack 7 or later
DriveOS 7 or later
x86 Emulator is not supported
- Parameters:
handle – [in] Handle to the operator.
stream – [in] Handle to a valid CUDA stream.
inImage – [in] Input image tensor handle.
inTemplate – [in] Input template tensor handle.
out – [out] Output tensor 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.
- NVCVStatus pvaTemplateMatchingSubmit(
- NVCVOperatorHandle handle,
- cupvaStream_t stream,
- NVCVTensorHandle inImage,
- NVCVTensorHandle inTemplate,
- NVCVTensorHandle out,
Submits the TemplateMatching operator to a cuPVA stream.
- Parameters:
handle – [in] Handle to the operator.
Must not be NULL.
stream – [in] Handle to a valid cuPVA stream.
inImage – [in] Input image tensor handle.
inTemplate – [in] Input template tensor handle.
out – [out] Output tensor 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.