Batch Image Cropping, Resizing, and Pasting

Ascend 310 acldvpp API

Ascend 310P hi_mpi API

What You Need to Do

Configure the image (input in batches) information:

acldvppCreateBatchPicDesc

acldvppGetPicDesc

acldvppSetPicDescData

acldvppSetPicDescSize

acldvppSetPicDescWidth

acldvppSetPicDescHeight

acldvppSetPicDescWidthStride

acldvppSetPicDescHeightStride

acldvppSetPicDescFormat

acldvppDestroyBatchPicDesc

No corresponding API. Directly assign values to the members of the hi_vpc_pic_info struct when configuring the input image parameters. Each array element indicates an input image, and pic_num indicates the batch size.

picture_address;

picture_buffer_size;

picture_width;

picture_height;

picture_width_stride;

picture_height_stride;

picture_format;

Modify your code to configure the parameters of the input image information by assigning values to the members of the hi_vpc_pic_info struct.

Set the number of crop ROIs for each input image:

roiNums

size

The data structure is as follows. The length of the array is the same as that of the input pic_num.

count[]

Modify your code to implement the function by assigning values to the member dest_pic_info in the hi_vpc_crop_resize_paste_region struct.

Configure the image (output in batches) information:

acldvppCreateBatchPicDesc

acldvppGetPicDesc

acldvppSetPicDescData

acldvppSetPicDescSize

acldvppSetPicDescWidth

acldvppSetPicDescHeight

acldvppSetPicDescWidthStride

acldvppSetPicDescHeightStride

acldvppSetPicDescFormat

acldvppDestroyBatchPicDesc

No corresponding API. Directly assign values to the member dest_pic_info (the hi_vpc_pic_info struct) of the hi_vpc_crop_resize_paste_region struct when configuring the output image parameters. The hi_vpc_pic_info struct consists of:

picture_address;

picture_buffer_size;

picture_width;

picture_height;

picture_width_stride;

picture_height_stride;

picture_format;

Modify your code to implement the function by assigning values to the member dest_pic_info in the hi_vpc_crop_resize_paste_region struct.

Configure the cropping ROI information of the input image:

acldvppCreateRoiConfig

acldvppSetRoiConfig

acldvppSetRoiConfigLeft

acldvppSetRoiConfigRight

acldvppSetRoiConfigTop

acldvppSetRoiConfigBottom

acldvppDestroyRoiConfig

No corresponding API. Directly assign values to the member crop_region (the hi_vpc_crop_region struct) of the hi_vpc_crop_resize_paste_region struct when configuring crop ROI information. The hi_vpc_crop_region struct consists of:

top_offset;

left_offset;

crop_width;

crop_height;

Modify your code to implement the function by assigning values to the member crop_region in the hi_vpc_crop_resize_paste_region struct.

Configure the resizing algorithm:

acldvppCreateResizeConfig

acldvppSetResizeConfigInterpolation

acldvppDestroyResizeConfig

No corresponding API. Directly assign values to the member resize_info (the hi_vpc_resize_info struct) of the hi_vpc_crop_resize_paste_region struct when configuring resizing information. The hi_vpc_resize_info struct consists of:

resize_width;

resize_height;

interpolation;

Modify your code to implement the function by assigning values to the member resize_info in the hi_vpc_crop_resize_paste_region struct.

Configure the paste ROI information of the output image:

acldvppCreateRoiConfig

acldvppSetRoiConfig

acldvppSetRoiConfigLeft

acldvppSetRoiConfigRight

acldvppSetRoiConfigTop

acldvppSetRoiConfigBottom

acldvppDestroyRoiConfig

No corresponding API. Directly assign values to the members dest_top_offset and dest_left_offset of the hi_vpc_crop_resize_paste_region struct when configuring paste ROI information.

Modify your code to implement the function by assigning values to the members dest_top_offset and dest_left_offset in the hi_vpc_crop_resize_paste_region struct.

Implement batch image cropping, resizing, and pasting: acldvppVpcBatchCropResizePasteAsync

Implement batch image cropping, resizing, and pasting:

hi_mpi_vpc_batch_crop_resize_paste

Modify your code to use the hi_mpi_vpc_batch_crop_resize_paste API.

Note: The length of pic_num, source_pic, and count must be consistent.