Image Cropping, Resizing, and Pasting (Single-Image, Single-ROI)

Ascend 310 acldvpp API

Ascend 310P hi_mpi API

What You Need to Do

Configure the input image information:

acldvppCreatePicDesc

acldvppSetPicDescData

acldvppSetPicDescSize

acldvppSetPicDescWidth

acldvppSetPicDescHeight

acldvppSetPicDescWidthStride

acldvppSetPicDescHeightStride

acldvppSetPicDescFormat

acldvppDestroyPicDesc

No corresponding API. Directly assign values to the members of the hi_vpc_pic_info struct when configuring the input image parameters:

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.

Configure the output image information:

acldvppCreatePicDesc

acldvppSetPicDescData

acldvppSetPicDescSize

acldvppSetPicDescWidth

acldvppSetPicDescHeight

acldvppSetPicDescWidthStride

acldvppSetPicDescHeightStride

acldvppSetPicDescFormat

acldvppDestroyPicDesc

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 image cropping, resizing, and pasting: acldvppVpcCropResizePasteAsync

Implement image cropping, resizing, and pasting:

hi_mpi_vpc_crop_resize_paste

Modify your code to use the hi_mpi_vpc_crop_resize_paste API.

Note: The hi_mpi_vpc_crop_resize_paste API supports both the single-image single-ROI and single-image multi-ROI scenarios. For the single-image multi-ROI scenario, you need to configure the crop ROI, resizing algorithm, and paste ROI information for each ROI.