Morphology

group Morphology

Functions

NVCVStatus cvcudaMorphologyCreate(NVCVOperatorHandle *handle)

Constructs and an instance of the Morphology 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 cvcudaMorphologySubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle out, NVCVTensorHandle workspace, NVCVMorphologyType morphType, int32_t maskWidth, int32_t maskHeight, int32_t anchorX, int32_t anchorY, int32_t iteration, const NVCVBorderType borderMode)

Executes the morphology operation of Dilates/Erodes on images

Limitations:

Input: Data Layout: [kNHWC, kHWC, kNCHW, kCHW] Channels: 1, 3, 4

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

Yes

16bit Signed

No

32bit Unsigned

No

32bit Signed

No

16bit Float

No

32bit Float

Yes

64bit Float

No

Output: Data Layout: [kNHWC, kHWC, kNCHW, kCHW] Channels: 1, 3, 4

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

Yes

16bit Signed

No

32bit Unsigned

No

32bit Signed

No

16bit Float

No

32bit Float

Yes

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.

  • workspace[in] Workspace tensor, must be the same size as the input tensor; can be null if not calling Dilate/Erode with an iteration of 1

  • morphType[in] Type of operation to performs Erode/Dilate. NVCVMorphologyType.

  • maskWidth[in] Width of the mask to use (set heigh/width to -1 for default of 3,3).

  • maskHeight[in] Height of the mask to use (set heigh/width to -1 for default of 3,3).

  • anchorX[in] X-offset of the kernel to use (set anchorX/anchorY to -1 for center of kernel).

  • anchorY[in] Y-offset of the kernel to use (set anchorX/anchorY to -1 for center of kernel).

  • iteration[in] Number of times to execute the operation, typically set to 1. Setting to higher than 1 is equivelent of increasing the kernel mask by (mask_width - 1, mask_height -1) for every iteration.

  • borderMode[in] Border mode to be used when accessing elements outside input image, cf. NVCVBorderType.

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 cvcudaMorphologyVarShapeSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVImageBatchHandle in, NVCVImageBatchHandle out, NVCVImageBatchHandle workspace, NVCVMorphologyType morphType, NVCVTensorHandle masks, NVCVTensorHandle anchors, int32_t iteration, const NVCVBorderType borderMode)

Executes the morphology operation of Dilates/Erodes on images, using an array of variable shape images.

Limitations:

Input: Data Layout: [kNHWC, kHWC, kNCHW, kCHW] Channels: 1, 3, 4

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

Yes

16bit Signed

No

32bit Unsigned

No

32bit Signed

No

16bit Float

No

32bit Float

Yes

64bit Float

No

Output: Data Layout: [kNHWC, kHWC, kNCHW, kCHW] Channels: 1, 3, 4

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

Yes

16bit Signed

No

32bit Unsigned

No

32bit Signed

No

16bit Float

No

32bit Float

Yes

64bit Float

No

Input/Output dependency

 Property      |  Input == Output
-------------- | -------------
 Data Layout   | Yes
 Data Type     | Yes
 Number        | Yes
 Channels      | Yes
 Width         | Yes (per image in/out pair)
 Height        | Yes (per image in/out pair)

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

    • Must not be NULL.

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

  • in[in] Input variable shape tensor.

  • out[out] Output variable shape tensor.

  • workspace[in] Workspace tensor, must be the same size as the input var shape tensor; can be null if not calling Dilate/Erode with an iteration of 1

  • morphType[in] Type of operation to perform (Erode/Dilate). NVCVMorphologyType.

  • masks[inout] 1D Tensor of NVCV_DATA_TYPE_2S32 mask W/H pairs, where the 1st pair is for image 0, second for image 1, etc. Setting values to -1,-1 will create a default 3,3 mask. (Note after the operation the tensor values may be modified by kernel)

  • anchors[inout] 1D Tensor of NVCV_DATA_TYPE_2S32 X/Y pairs, where the 1st pair is for image 0, second for image 1, etc Setting values to -1,-1 will anchor the kernel at the center. (Note after the operation the tensor values may be modified by kernel)

  • iteration[in] Number of times to execute the operation, typically set to 1. Setting to higher than 1 is equivelent of increasing the kernel mask by (mask_width - 1, mask_height -1) for every iteration.

  • borderMode[in] Border mode to be used when accessing elements outside input image, cf. NVCVBorderType.

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.