Resizing and pasting API of the Image class. It supports asynchronous execution. The tensor memory allocated by calling this API does not need to be managed by the users. It is released by the internal management module. Implicit memory allocation is supported. If the sizes of the pre-pasted images are different, resize the images first.
Only Atlas inference product support this API.
1 | APP_ERROR ResizePaste(const MxBase::Tensor &background, std::vector<MxBase::Tensor> &inputPics, std::vector<MxBase::Rect> &pasteRects, MxBase::Tensor &dst, bool keepMargin = false, MxBase::AscendStream &stream = MxBase::AscendStream::DefaultStream()); |
Parameter |
Input/Output |
Description |
|---|---|---|
background |
Input |
Input tensor, target tensor to be pasted. The uint8 data type is supported. The tensor dimension can be HW (2-dimensional) or HWC (3-dimensional). The tensor width range is [16, 4096], the height range is [6, 4096], and the grayscale range is [18, 4096]. The data memory must be on the device side or DVPP side. |
inputPics |
Input |
std::vector<Tensor> class, input tensor. Tensor group pasted to the target tensor. The uint8 input type is supported. The tensor dimension can be HW (2-dimensional) or HWC (3-dimensional). The tensor width range is [10, 4096], the height range is [6, 4096], and the grayscale range is [18, 4096]. The data memory must be on the device side or DVPP side. |
PasteRects |
Input |
std::vector<Rect> class. Pasted image rectangle. The rectangle width is aligned upwards to a multiple of 16. After alignment, the width and height of the rectangle cannot exceed the background image range. |
dst |
Output |
Tensor class, output tensor, pasting result. When keepMargin is set to true, the result is automatically aligned to a multiple of 16. The uint8 input type is supported. The tensor dimension can be HW (2-dimensional) or HWC (3-dimensional). The tensor width range is [10, 4096], the height range is [6, 4096], and the grayscale range is [18, 4096]. The data memory must be on the device side or DVPP side. If the dst width is a multiple of 16 and the memory is on the DVPP side, the input background memory is reused. |
keepMargin |
Input |
Boolean type. It specifies whether to retain the invalid boundary in the output dst. |
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. |
Data Structure |
Description |
|---|---|
APP_ERROR |
For details about the returned error codes, see APP_ERROR Description. |