BlendImages

Function Usage

Image blending API. It is used to blend the material frame with the background frame based on transparency (material_rgb x (material_alpha/255) + (1 - material_alpha/255) x frame). Asynchronous calling is supported.

Only Atlas inference product support this API.

This API requires CANN 8.0.RC1 or a later version.

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.
  • The width and height of each input and output can be different. During compute, the minimum valid region is used for replacement.

Prototype

1
APP_ERROR BlendImages(const Tensor &material, Tensor &frame, AscendStream& stream = AscendStream::DefaultStream());

Parameters

Parameter

Input/Output

Description

material

Input

Tensor, input tensor, material frame tensor. The uint8 type is supported. The dimension can be HWC (three-dimensional). C (number of channels) is 4 (RGBA format). The tensor width range is [1, 4096], and the tensor height range is [1, 4096]. The data memory must be on the device or DVPP. Empty tensor cannot be passed.

frame

Input/Output

Input and output tensor, background frame tensor. The uint8 type is supported. The dimension can be HWC (three-dimensional). C (number of channels) is 3 (RGB format). The tensor width range is [1, 4096], and the tensor height range is [1, 4096]. The data memory must be on the device or DVPP. Empty tensor cannot be passed.

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.