MinMaxLoc#

Functions#

NVCVStatus pvaMinMaxLocCreate(NVCVOperatorHandle *handle, NVCVTensorRequirements *tensorRequirements)

Constructs and an instance of MinMaxLoc operator.

NVCVStatus pvaMinMaxLocSubmit(NVCVOperatorHandle handle, cupvaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle minVal, NVCVTensorHandle minLoc, NVCVTensorHandle numMin, NVCVTensorHandle maxVal, NVCVTensorHandle maxLoc, NVCVTensorHandle numMax)

Executes the min/max location operation on image.

Functions#

NVCVStatus pvaMinMaxLocCreate(
NVCVOperatorHandle *handle,
NVCVTensorRequirements *tensorRequirements,
)#

Constructs and an instance of MinMaxLoc operator.

It calculates location coordinates achieving min/max values on the input image.

Limitations:

  1. The operator supports arbitrary image sizes, but achieves the best performance when image width is divisible by tile width 64.

  2. The min/max count number accumulates for all locations achieving the min/max value. But the number of min/max locations to return is limited by the user defined capacity.

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

    • Must not be NULL.

  • tensorRequirements[in] NVCVTensorRequirements structure to specify input parameters:

     layout: [HWC, NHWC, CHW, NCHW], where N=1 and C=1.
     rank: 3 for [HWC, CHW], and 4 for [NHWC, NCHW].
     shape: input tensor shape. For example, for [HWC] layout, shape={image_height, image_width, channel_number}.
     dtype: input tensor data type, must be one of:
     {NVCV_DATA_TYPE_U8, NVCV_DATA_TYPE_U16, NVCV_DATA_TYPE_U32, NVCV_DATA_TYPE_F32}.
    

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 pvaMinMaxLocSubmit(
NVCVOperatorHandle handle,
cupvaStream_t stream,
NVCVTensorHandle in,
NVCVTensorHandle minVal,
NVCVTensorHandle minLoc,
NVCVTensorHandle numMin,
NVCVTensorHandle maxVal,
NVCVTensorHandle maxLoc,
NVCVTensorHandle numMax,
)#

Executes the min/max location operation on image.

[Note] The operator supports arbitrary image sizes, but achieves the best performance when image width is divisible by tile width 64.

Limitations:

Input: Data Layout: [HWC, NHWC, CHW, NCHW] Batches(N): [1] Channels(C): [1]

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

Yes

16bit Unsigned

Yes

16bit Signed

Yes

32bit Unsigned

Yes

32bit Signed

Yes

32bit Float

Yes

64bit Float

No

Parameters:
  • handle[in] Handle to the operator.

    • Must not be NULL.

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

  • in[in] Input image tensor handle. Currently only supports [HWC] tensor layout.

  • minVal[out] Output tensor handle for min values. For current [HWC] input layout with 1 channel, the output tensor is of 1 number.

     Data Layout:    [W]
     Length:         1
     Data Type:      the same as input data type
    

  • minLoc[out] Output tensor handle for min location coordinates. Maximum number of locations is locCapacity defined in pvaMinMaxLocCreate.

     Data Layout:    [W]
     Channel:        1
     Length:         locCapacity
     Data Type:      NVCV_DATA_TYPE_2S16 (16 bit signed int, XY-interleaved)
    

  • numMin[out] Output tensor handle for min location counts. For current [HWC] input layout with 1 channel, the output tensor is of 1 number. [Note] The count number will accumulate for all the min/max locations in the input, thus could be larger than the location tensor capacity.

    Data Layout:    [W]
    Length:         1
    Range:          [1, image_height * image_width]
    Data Type:      NVCV_DATA_TYPE_S32
    

  • maxVal[out] Output tensor handle for max values. For current [HWC] input layout with 1 channel, the output tensor is of 1 number.

     Data Layout:    [W]
     Length:         1
     Data Type:      the same as input data type
    

  • maxLoc[out] Output tensor handle for max location coordinates. Maximum number of locations is locCapacity defined in pvaMinMaxLocCreate.

     Data Layout:    [W]
     Channel:        1
     Length:         locCapacity
     Data Type:      NVCV_DATA_TYPE_2S16 (16 bit signed int, XY-interleaved)
    

  • numMax[out] Output tensor handle for max location counts. For current [HWC] input layout with 1 channel, the output tensor is of 1 number. [Note] the count number will accumulate for all the min/max locations in the input, thus could be larger than the location tensor capacity.

    Data Layout:    [W]
    Length:         1
    Range:          [1, image_height * image_width]
    Data Type:      NVCV_DATA_TYPE_S32
    

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.