VpcCrop
Function Usage
Image cropping 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 inputDataInfo resolution range is [18 x 6, 4096 x 4096]. The resolution range of a YUV_SP_420 or YVU_SP_420 image is [18 x 6, 8192 x 8192].
- The cropped ROI cannot exceed the input image region. It is recommended that the four coordinates of the cropConfig 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 maximum resolution of the cropped ROI is 4096 x 4096, and the minimum resolution is 18 x 6. For example, if cropConfig is set to {1, 1, 1287, 1287}, the actual width and height of the cropped ROI are ((1287 + 1) - (1 - 1)) = 1288, and the resolution is 1288 x 1288.
Prototype
1 | APP_ERROR DvppWrapper::VpcCrop(DvppDataInfo& inputDataInfo, DvppDataInfo& outputDataInfo, CropRoiConfig& cropConfig, AscendStream& stream); |
1 | APP_ERROR DvppWrapper::VpcCrop(DvppDataInfo& inputDataInfo, DvppDataInfo& outputDataInfo, CropRoiConfig& cropConfig); |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
inputDataInfo |
Input |
Data to be cropped |
outputDataInfo |
Output |
Data after cropping |
cropConfig |
Input |
Image cropping configuration Restrictions:
|
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. |
Parent topic: DvppWrapper