Erode

Function Usage

Corrosion algorithm for image processing. It is a morphological processing algorithm and can be used to eliminate noises and some boundary values. The float16, float32, and uint8 types are supported. Asynchronous calling is supported, but preloading is not. The inplace operation is not supported.

It is supported by the Atlas inference product.

The following conditions must be met:

  • The input and output tensors must be on the device or DVPP side, and the parameters (stream and data memory) must be on the same device.
  • For synchronization, the device where the data memory is located must be the same as the initialized device.
  • Shapes of the tensor corresponding to each input and output must be the same. HW and HWC are supported.
  • When the input size is greater than 240p (320 x 240), the compute performance is better than that of cv::erode on the CPU.

Prototype

1
APP_ERROR Erode(const Tensor& src, Tensor& dst, const BlurConfig& blurconfig, AscendStream& stream=AscendStream::DefaultStream());

Parameters

Parameter

Input/Output

Description

src

Input

Tensor class, input tensor, tensor to be corroded. The uint8, fp16, and fp32 data types are supported. The dimension must be HWC (c = 1, 3, 4).

The tensor width and height must be within the range of [64, 4096].

dst

Output

Tensor class, output tensor. The data type and shape are the same as those of src. An empty tensor can be passed. If dst is not an empty tensor, call Tensor.Malloc() to allocate memory in advance.

blurConfig

Input

Parameter configuration for the corrosion algorithm. For details, see BlurConfig.

stream

Input

AscendStream type. The default value is AscendStream::DefaultStream(). When the parameter value is the default value, the API calling is a synchronous operation. In other cases, the API calling is an asynchronous operation.

Response Parameters

Data Structure

Description

APP_ERROR

For details about the returned error codes, see APP_ERROR Description.