Adaptive Threshold

group NVCV_C_ALGORITHM_ADAPTIVETHRESHOLD

Functions

NVCVStatus cvcudaAdaptiveThresholdCreate(NVCVOperatorHandle *handle, int32_t maxBlockSize, int32_t maxVarShapeBatchSize)

Constructs an instance of the adaptive threshold.

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

    • Must not be NULL.

  • maxBlockSize[in] The maximum block size that will be used by the operator.

    • Positive value.

  • maxVarShapeBatchSize[in] The maximum batch size that will be used by the var-shape operator.

    • Positive value.

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 cvcudaAdaptiveThresholdSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle out, double maxValue, NVCVAdaptiveThresholdType adaptiveMethod, NVCVThresholdType thresholdType, int32_t blockSize, double c)

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

Limitations:

Input: Data Layout: [kNHWC, kHWC] Channels: [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: Data Layout: [kNHWC, kHWC] Channels: [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/Output dependency

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

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.

  • maxValue[in] Non-zero value assigned to the pixels for which the condition is satisfied.

  • adaptiveMethod[in] Adaptive thresholding algorithm to use. NVCVAdaptiveThresholdType.

  • thresholdType[in] Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV. NVCVThresholdType.

  • blockSize[in] Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.

  • c[in] Constant subtracted from the mean or weighted mean. Normally, it is positive but may be zero or negative as well.

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 cvcudaAdaptiveThresholdVarShapeSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVImageBatchHandle in, NVCVImageBatchHandle out, NVCVTensorHandle maxValue, NVCVAdaptiveThresholdType adaptiveMethod, NVCVThresholdType thresholdType, NVCVTensorHandle blockSize, NVCVTensorHandle c)