Cropping API of the tensor 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.
For details, see Cropping.
Only Atlas inference product support this API.
Prototype 1:
1 | APP_ERROR Crop(const Tensor &inputTensor, const Rect &cropRect, Tensor &outputTensor, bool keepMargin = false, AscendStream& stream = AscendStream::DefaultStream()); |
Prototype 2:
1 | APP_ERROR Crop(const Tensor &inputTensor, const std::vector<Rect> &cropRectVec, std::vector<Tensor> &outputTensorVec, bool keepMargin = false, AscendStream& stream = AscendStream::DefaultStream()); |
Parameter |
Input/Output |
Description |
|---|---|---|
inputTensor |
Input |
Tensor of type UINT8. The value cannot be empty. Memory needs to be allocated on the device or DVPP side. The input tensor width range is [10, 4096], and the height range is [6, 4096]. If the format YUV_400 is contained, the width range is [18, 4096]. |
cropRect |
Input |
Cropped rectangle of the input tensor, which cannot exceed the width and height range of the input tensor. |
cropRectVec |
Input |
List of coordinates tensor cropping (application scenario: image cropping in a batch). |
outputTensor |
Output |
Tensor class after cropping. |
outputTensorVec |
Output |
List of the tensor class after cropping (application scenario: image cropping in a batch). |
keepMargin |
Input |
Specifies whether to retain the invalid boundary in the tensor in the outputTensor. The default value is false, indicating that the invalid boundary in the tensor is not reserved. The width and height of the output tensor are the same as those of the cropped image. |
stream |
Input |
Stream used for asynchronous execution. The default value is AscendStream::DefaultStream(), indicating that a default stream is created (for synchronous execution). |
Data Structure |
Description |
|---|---|
APP_ERROR |
For details about the returned error codes, see APP_ERROR Description. |