VpcCropAndPaste

Function Usage

Image cropping and pasting function. Before calling this API, call Init to initialize this function.

  • Supported image formats of the input/output data:
    • Atlas 200/300/500 inference product: YUV_SP_420 and YVU_SP_420 (nv12 and nv21).
    • Atlas 200I/500 A2 inference product: supports YUV_SP_420 and YVU_SP_420 (nv12 and nv21).
    • Atlas inference product: YUV_SP_420, YVU_SP_420, RGB_888 and BGR_888 (nv12, nv21, rgb, and bgr). The resolution of the RGB (BGR) image format cannot exceed 4096 x 4096.
  • The actual width and height of the input data range from 18 x 6 to 4096 x 4096. For images in YUV_SP_420 and YVU_SP_420 formats, the width and height can reach 8192 x 8192.
  • The width and height of the cropped image cannot exceed the actual width and height of the inputDataInfo. The minimum size of the cropped ROI is 10 x 6. It is recommended that the four coordinates of the cropped ROI be even numbers. If odd numbers are included (excluding RGB and BGR formats), the coordinate of the upper left corner is automatically rounded down to an even number, and the coordinate of the lower right corner is automatically rounded up to an even number. For example, if cropRoi is set to {1, 1, 1287, 1287}, the actual width and height of the cropped image are ((1287 + 1) - (1 - 1)) = 1288.
  • The width and height of the pasted region cannot exceed the actual width and height of the outputDataInfo. The maximum size is 4096 x 4096, and the minimum size is 10 x 6.
  • It is recommended that the four coordinates of the pasted rectangle be even numbers. If odd numbers are included (excluding RGB and BGR formats), the coordinate of the upper left corner is automatically rounded down to an even number, and the coordinate of the lower right corner is automatically rounded up to an even number.
  • The width and height of the pasted image cannot exceed a multiple of [1/32, 16] of the cropped image width and height for the Atlas 200/300/500 inference product and Atlas 200I/500 A2 inference product.
  • The output width of the outputDataInfo is a multiple of 16, and its output height is a multiple of 2. So the size range is [32 x 6, 4096 x 4096].

Prototype

1
APP_ERROR DvppWrapper::VpcCropAndPaste(const DvppDataInfo& inputDataInfo, DvppDataInfo& outputDataInfo, CropRoiConfig& pasteRoi, CropRoiConfig& cropRoi, AscendStream& stream)
1
APP_ERROR DvppWrapper::VpcCropAndPaste(const DvppDataInfo& inputDataInfo, DvppDataInfo& outputDataInfo, CropRoiConfig& pasteRoi, CropRoiConfig& cropRoi);

Parameters

Parameter

Input/Output

Description

inputDataInfo

Input

Source image information.

outputDataInfo

Output

Returned paste information.

pasteRoi

Input

Paste ROI.

cropRoi

Input

Cropping ROI of the source image.

stream

Input

AscendStream type. When AscendStream& stream is not specified or the value is AscendStream::DefaultStream(), the API performs a synchronous operation. In other cases, the API performs asynchronous operations.

Response Parameters

Data Structure

Description

APP_ERROR

For details about the returned error codes, see APP_ERROR Description.