acldvppCropResizePaste
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
☓ |
|
☓ |
|
☓ |
Function
Crops an ROI from an image, resizes it, and pastes the resized ROI in the specified region of the output image.
Prototype
Each operator has two-phase API calls. First, acldvppCropResizePasteGetWorkspaceSize is called to calculate the required workspace size based on the computation process. Then, acldvppCropResizePaste is called to perform computation. The two-phase APIs are as follows:
- First-phase API:
1acldvppStatus acldvppCropResizePasteGetWorkspaceSize(const aclTensor *self, uint32_t top, uint32_t left, uint32_t height, uint32_t width, const aclIntArray* size, uint32_t interpolationMode, uint32_t topOffset, uint32_t leftOffset, aclTensor *out, uint64_t *workspaceSize, aclOpExecutor **executor)
- Second-phase API:
1acldvppStatus acldvppCropResizePaste(void *workspace, uint64_t workspaceSize, aclOpExecutor *executor, aclrtStream stream)
acldvppCropResizePasteGetWorkspaceSize
- Parameters:
- self: input tensor of the operator, which is of the aclTensor type created by calling aclCreateTensor (the tensor data is stored on the device). The value of dataType of the input tensor can be UINT8 or FLOAT, the value of Format can be NCHW or NHWC, and non-contiguous tensors are not supported. The value of N can be 1 or an empty value, and the value of C can be 1 or 3 (1: input GRAY image; 3: input RGB image).
- top: upper boundary for cropping.
- left: left boundary for cropping.
- height: height for cropping. Value range: [4, 32768].
- width: width for cropping. Value range: [6, 32768].
- size: width and height after resizing. The value range is [4 × 2, 32768 × 32768]. This parameter is of the aclIntArray type created by calling aclCreateIntArray. This parameter is an array with the length of 2, where the first element indicates the height, and the second element indicates the width.
- interpolationMode: a resizing algorithm. The options are as follows:
- 0: bilinear
- 1: nearest neighbour
- 2: bicubic
- topOffset: top offset of the paste ROI on the destination image.
- leftOffset: left offset of the paste ROI on the destination image.
- out: output tensor of the operator, which is of the aclTensor type created by calling aclCreateTensor (the tensor data is stored on the device). The value of dataType of the output tensor can be UINT8 or FLOAT, the value of Format can be NCHW or NHWC, and non-contiguous tensors are not supported. The value of N can only be 1, the value of C can be 1 or 3 (1: GRAY image; 3: RGB image), the values of dataType and Format must be the same as those of self, and the sizes of the C axis and N axis in Shape must be the same as those of self.
- workspaceSize: size of the workspace to be allocated on the device.
- executor: operator executor, containing the operator computation process.
- Returns:
acldvppStatus status code. For details, see acldvpp Return Codes.
acldvppCropResizePaste
- Parameters:
- workspace: address of the device memory allocated by calling aclrtMalloc. The size of the device memory is specified by workspaceSize.
- workspaceSize: The value must be the same as that obtained by calling acldvppCropResizePasteGetWorkspaceSize.
- executor: op executor, which contains the operator computation process and is the same as the executor of the acldvppCropResizePasteGetWorkspaceSize API.
- stream: stream for executing a task, which can be a created stream for saving resources or newly created by the aclrtCreateStream API call.
- Returns:
acldvppStatus status code. For details, see acldvpp Return Codes.
Restrictions
- The supported image resolution ranges from 6 × 4 to 32768 × 32768.
- When the width in Shape of out exceeds 4096, the width × height in Shape of self must be greater than or equal to 128 × 16.
Parent topic: Media Data Processing V1 APIs