VpcBatchCropResize

Function Usage

Batch image cropping and resizing 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 minimum size of the cropped ROI is 10 x 6. The width and height of the cropped ROI cannot exceed the actual width and height of the input data. It is recommended that the four values of each input cropped coordinate box 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 cropRect 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.

  • The resizing range is 18 x 6 to 4096 x 4096 and cannot exceed a multiple of [1/32, 16] of the cropped ROI.

Prototype

1
APP_ERROR DvppWrapper::VpcBatchCropResize(DvppDataInfo& inputDataInfo, std::vector<DvppDataInfo>& outputDataInfoVec, std::vector<CropRoiConfig>& cropConfigVec, ResizeConfig& resizeConfig, AscendStream& stream);
1
APP_ERROR DvppWrapper::VpcBatchCropResize(DvppDataInfo& inputDataInfo, std::vector<DvppDataInfo>& outputDataInfoVec, std::vector<CropRoiConfig>& cropConfigVec, ResizeConfig& resizeConfig);
1
APP_ERROR DvppWrapper::VpcBatchCropResize(DvppDataInfo& inputDataInfo, std::vector<DvppDataInfo>& outputDataInfoVec, std::vector<CropRoiConfig>& cropConfigVec, std::vector<ResizeConfig>& resizeConfigVec, AscendStream& stream);
1
APP_ERROR DvppWrapper::VpcBatchCropResize(DvppDataInfo& inputDataInfo, std::vector<DvppDataInfo>& outputDataInfoVec, std::vector<CropRoiConfig>& cropConfigVec, std::vector<ResizeConfig>& resizeConfigVec);
1
APP_ERROR DvppWrapper::VpcBatchCropResize(std::vector<DvppDataInfo>& inputDataInfoVec, std::vector<DvppDataInfo>& outputDataInfoVec, std::vector<CropRoiConfig>& cropConfigVec, std::vector<ResizeConfig>& resizeConfigVec, AscendStream& stream);
1
APP_ERROR DvppWrapper::VpcBatchCropResize(std::vector<DvppDataInfo>& inputDataInfoVec, std::vector<DvppDataInfo>& outputDataInfoVec, std::vector<CropRoiConfig>& cropConfigVec, std::vector<ResizeConfig>& resizeConfigVec);

Parameters

Parameter

Input/Output

Description

inputDataInfo

Input

Data to be cropped or resized.

inputDataInfoVec

Input

A group of data to be cropped and scaled. The length must be the same as that of cropConfigVec.

cropConfigVec

Input

Cropping configuration group. The length cannot be 0. For details, see CropRoiConfig.

resizeConfigVec

Input

Resizing configuration group. The length must be the same as that of cropConfigVec.

outputDataInfoVec

Output

Data group output after cropping. The length must be the same as that of cropConfigVec. The requirement of a single configuration item in the array must be the same as that of cropConfig of VpcCrop.

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.