Function Usage
Image rotating API of the tensor class, which is used to rotate an image to a specified angle. Asynchronous calling is supported.
Only Atlas inference product and Atlas 800I A2 inference product support this API.
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 input and output parameters match the tensors types.
Prototype
| APP_ERROR Rotate(const Tensor &src, Tensor &dst, const RotateAngle angle, AscendStream& stream = AscendStream::DefaultStream());
|
Parameters
Parameter
|
Input/Output
|
Description
|
src
|
Input
|
Tensor class, input tensor, which cannot be empty. The input can be HWC (three-dimensional) or HW (two-dimensional).
- For the Atlas inference product, the float16, float32, and uint8 types are supported.
- For the Atlas 800I A2 inference product, the range of the input tensor width is [10, 4096]. When the input image format is YUV_400, the minimum width is 18 and the height range is [10, 4096]. Memory needs to be allocated on the device or DVPP side. The uint8 type is supported.
|
dst
|
Output
|
Tensor class, rotation result. An empty tensor can be passed.
- For the Atlas inference product, if dst is not an empty tensor, call Tensor.Malloc() to allocate memory in advance. The float16, float32, and uint8 types are supported.
- For Atlas 800I A2 inference product, if dst is not an empty tensor, the width range of the input tensor is [10, 4096]. When the input image format is YUV_400, the minimum width is 18 and the height range is [10, 4096]. Memory needs to be allocated on the device or DVPP. The uint8 type is supported.
- If the rotation angle is 180 degrees, the shape is the same as that of src.
- If the rotation angle is 90 degrees or 270 degrees, the shape is the HW channel of the src after transposition.
|
angle
|
Input
|
RotateAngle enumeration class. It specifies the clockwise rotation angle: 90 degrees, 180 degrees, or 270 degrees (ROTATE_90, ROTATE_180, and ROTATE_270).
|
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.
|