BlendImageCaption

Function Usage

Blend the caption with the background board by transparency of the caption and the background board. (that is, caption × alpha/255 + (1 - alpha/255) × (1 - Opacity) × frame + captionBg × Opacity × (1 - alpha/255)). Asynchronous calling is supported.

Only Atlas inference product support this API.

The following conditions must be met:

Prototype

1
APP_ERROR BlendImageCaption(Tensor &frame, const Tensor &caption, const Tensor &captionAlpha, const Tensor &captionBg,  float captionBgOpacity, AscendStream &stream = AscendStream::DefaultStream());

Description

Parameter

Input/Output

Description

frame

Input/Output

Tensor class, input and output tensors, and background frame tensor. Both height and width ranges are [64, 4096]. Only the uint8 type is supported. NHWC (N = 1), HWC, and HW are supported. The number of channels must be the same as that of captions. The data memory must be on the device or DVPP side. Empty tensors are not supported.

caption

Input

Tensor class, input tensor, caption tensor. Both height and width ranges are [64, 4096]. Only the uint8 type is supported. NHWC (N = 1), HWC, and HW are supported. The number of channels is 1 or 3. The data memory must be on the device or DVPP side. Empty tensors are not supported.

captionAlpha

Input

Tensor, input tensor, caption and image mask tensors. Both height and width ranges are [64, 4096]. Only the uint8 type is supported. NHWC (N = 1), HWC, and HW are supported. The number of channels is 1. The data memory must be on the device or DVPP side. Empty tensors are not supported.

captionBg

Input

Tensor, input tensor, caption and background tensors. Both height and width ranges are [64, 4096]. Only the uint8 type is supported. NHWC (N = 1), HWC, and HW are supported. The number of channels must be the same as that of captions. The data memory must be on the device or DVPP side. Empty tensors are not supported.

captionBgOpacity

Input

Background opacity. The value range is [0, 1].

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.