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:

  • The data memory and stream of the input and output tensors must be located in the same device.
  • For synchronization, the device where the input and output tensor data memory is located must be the same as the initialized device.
  • The size of the pasted region is subject to the caption tensor. By default, the pasted region is the reference rectangle. If no reference rectangle is set, the sizes of all caption tensors are used as the compute region. For other tensors, the height and width of the reference rectangle must be the same as those of the tensor. If the reference rectangle is not set, the sizes of all tensors are considered as the compute region. The compute region of all input and output tensors must have the same height and width. The maximum width is 1920.

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.