YUV420SP_U8 to BGR
- Scenario:
Assume that AIPP inputs a YUV420SP_U8 (NV12) image and outputs a BGR image, and the input image size is 256 x 256. For the original network model, C is 3, and H and W are the same as those of the AIPP input image.
- AIPP configurations involved in this scenario:
- Do not configure the cropping (crop) function.
- Configure the csc_switch and the corresponding CSC matrix parameters.
- The following is an example of the AIPP configuration file:
aipp_op { aipp_mode: static input_format: YUV420SP_U8 csc_switch: true # If the input image is a YVU420SP_U8 (NV21) image, set rbuv_swap_switch to true. rbuv_swap_switch: false related_input_rank: 0 src_image_size_w: 256 src_image_size_h: 256 crop: false matrix_r0c0: 298 matrix_r0c1: 516 matrix_r0c2: 0 matrix_r1c0: 298 matrix_r1c1: -100 matrix_r1c2: -208 matrix_r2c0: 298 matrix_r2c1: 0 matrix_r2c2: 409 input_bias_0: 16 input_bias_1: 128 input_bias_2: 128 # The normalization parameters are set as required. The following values are examples only. # The normalization parameters are applied to channels after CSC and channel swap. mean_chn_0: 104 mean_chn_1: 117 mean_chn_2: 123 min_chn_0: 0.0 min_chn_1: 0.0 min_chn_2: 0.0 var_reci_chn_0: 1.0 var_reci_chn_1: 1.0 var_reci_chn_2: 1.0 }
Parent topic: Sample Reference