Function: set_aipp_crop_params

C Prototype

aclError aclmdlSetAIPPCropParams(aclmdlAIPP *aippParmsSet, int8_t cropSwitch,int32_t cropStartPosW, int32_t cropStartPosH, int32_t cropSizeW, int32_t cropSizeH,uint64_t batchIndex)

Python Function

ret = acl.mdl.set_aipp_crop_params(aipp_parms_set, crop_switch, crop_start_pos_w, crop_start_pos_h, crop_size_w, crop_size_h, batch_index)

Function Usage

Sets cropping parameters in the dynamic AIPP scenario.

Input Description

aipp_parms_set: int, pointer address of the dynamic AIPP configuration object. The aclmdlAIPP data must be created by the acl.mdl.create_aipp call in advance.

crop_switch: int, whether to crop an image. Values:

  • 0: The image is not cropped. When cropSwitch is set to 0, cropStartPosW, cropStartPosH, cropSizeW, and cropSizeH are invalid.
  • 1: The image is cropped.

crop_start_pos_w: int, horizontal coordinate of the crop start. For the YUV420SP_U8 format, the value must be an even number. The value range is [0, 4095].

crop_start_pos_h: int, vertical coordinate of the crop start. For the YUV420SP_U8 format, the value must be an even number. The value range is [0, 4095].

crop_size_w: int, crop size width. Value range: [1, 4096]

crop_size_h: int, crop size height. Value range: [1, 4096]

batch_index: int, index of the batch for image cropping. The default value is 0. The value range is [0, batch_size). batch_size is set when acl.mdl.create_aipp is called to create data of the aclmdlAIPP type.

Return Value

ret: int, error code.

Restrictions

If the cropping function is enabled, the following conditions must be met for the arguments passed to the acl.mdl.set_aipp_src_image_size call and acl.mdl.set_aipp_crop_params call:

  • srcImageSizeW ≥ cropSizeW + cropStartPosW
  • srcImageSizeH ≥ cropSizeH + cropStartPosH