hi_isp_awb_attr
Description
Defines the AWB attributes of the ISP.
Definition
typedef struct {
hi_bool enable;
hi_u16 ref_color_temp;
hi_u16 static_wb[HI_ISP_BAYER_CHN_NUM];
hi_s32 curve_para[HI_ISP_AWB_CURVE_PARA_NUM];
hi_isp_awb_alg_type alg_type;
hi_u8 rg_strength;
hi_u8 bg_strength;
hi_u16 speed;
hi_u16 zone_sel;
hi_u16 high_color_temp;
hi_u16 low_color_temp;
hi_isp_awb_ct_limit_attr ct_limit;
hi_bool shift_limit_en;
hi_u8 shift_limit;
hi_bool gain_norm_en;
hi_bool natural_cast_en;
hi_isp_awb_cbcr_track_attr cb_cr_track;
hi_isp_awb_lum_histgram_attr luma_hist;
hi_bool awb_zone_wt_en;
hi_u8 zone_wt[HI_ISP_AWB_ZONE_NUM];
} hi_isp_awb_attr;
Members
Member |
Description |
|---|---|
enable |
AWB enable The options are as follows:
|
ref_color_temp |
Color temperature of the illuminant for correcting the static WB coefficient. You are advised to use illuminants near 5000K. Value range: [0x0, 0xFFFF] |
static_wb |
Static WB coefficient, provided by the AWB calibration tool Value range: [0x0, 0xFFF] #define HI_ISP_BAYER_CHN_NUM 4 |
curve_para |
Calibration curve coefficient. Value range: curve_para [3]!=0; curve_para [4]=128 #define HI_ISP_AWB_CURVE_PARA_NUM 6 |
alg_type |
AWB algorithm type. The option can be HI_ISP_AWB_ALG_LOWCOST or HI_ISP_AWB_ALG_ADVANCE. HI_ISP_AWB_ALG_LOWCOST occupies less CPU resources and has good adaptability to the illuminant. HI_ISP_AWB_ALG_ADVANCE improves the AWB precision.
|
rg_strength |
AWB calibration strength for the R channel Value range: [0x0, 0xFF] |
bg_strength |
AWB calibration strength for the B channel Value range: [0x0, 0xFF] |
speed |
Convergence speed of the AWB algorithm. A larger value indicates faster AWB convergence Value range: [0x0, 0xFFF] |
zone_sel |
Global or region-based AWB calculation. The value range is [0, 255]. |
high_color_temp |
Upper color temperature limit for the AWB algorithm. A larger upper limit indicates greater interference of blue objects to the AWB. Recommended value range: [8500, 10000] |
low_color_temp |
Lower color temperature limit for the AWB algorithm. A lower limit indicates greater interference of orange and red objects to the AWB. Value range: [0x0, high_color_temp) |
ct_limit |
Gain calculation mode and gain value setting in manual mode when the color temperature for the AWB algorithm exceeds the preset color temperature range |
shift_limit_en |
Switch for the AWB algorithm to map the gain that exceeds the white point range back to the white point range The options are as follows:
|
shift_limit |
White point range parameter for AWB in the indoor scenario or when indoor and outdoor detection is disabled Value range: [0x0, 0xFF] |
gain_norm_en |
Gain normalization enable for the AWB algorithm. After this function is enabled, the signal-to-noise ratio (SNR) in low illuminance and low color temperature can be improved. The options are as follows:
|
natural_cast_en |
AWB style preference enable at low color temperatures The options are as follows:
|
cb_cr_track |
Associated parameter of the Bayer domain statistics and ISO |
luma_hist |
Parameter of the luminance histogram statistics for WB |
awb_zone_wt_en |
WB zone weight enable The options are as follows:
|
zone_wt[HI_ISP_AWB_ZONE_NUM] |
1024-zone weight table for WB. Value range: [0x0, 0xFF]. #define HI_ISP_AWB_ZONE_NUM (HI_ISP_AWB_ZONE_ORIG_ROW * HI_ISP_AWB_ZONE_ORIG_COLUMN) |
Restrictions
- When enable is HI_TRUE, the AWB works properly and the RGB channel gain coefficient is calculated by the AWB based on the environment color temperature. When enable is HI_FALSE, the AWB does not work and the RGB channel gain coefficient is fixed at the corrected static WB coefficient.
- ref_color_temp, static_wb, and curve_para are the AWB parameters obtained by using the correction tool, ensuring the accuracy of the AWB. After an optical device is replaced, it is recommended that these parameters be corrected again. ref_color_temp is the actual color temperature of the illuminant for static WB correction. You are advised to perform static WB correction under the D50 illuminant. curve_para[0], curve_para[1], and curve_para[2] determine the Planckian curve. curve_para[3], curve_para[4], and curve_para[5] determine the color temperature curve, and curve_para[4] is fixed at 128.
- During AWB, the ambient color temperature is calculated based on the calibration parameters such as curve_para. Within the range of [2500K, 10000K], color temperature calculation is highly accurate. If the range is exceeded, color temperature calculation will have a large error.
- You are advised not to adjust the calibration strength of the AWB R/B channel in normal cases.
The AWB calibration strength can be configured by adjusting the calibration strength of the R/B channel. The value 0x80 indicates the standard strength value. You are advised to set rg_strength and bg_strength to the same value that is less than or equal to 0x80. At a low color temperature, the image has a red cast when the calibration strength is less than 0x80, and the image has a blue cast when the calibration strength is greater than 0x80. At a high color temperature, the image has a blue cast when the calibration strength is less than 0x80, and the image has a red cast when the calibration strength is greater than 0x80.
- speed is used to control the convergence speed of the AWB gain. A larger speed value indicates a faster AWB convergence speed and a wider fluctuation range between frames when the illuminant is switched. A smaller speed value indicates a slower AWB convergence speed, a narrower fluctuation range between frames, and increased stability when the illuminant is switched.
- When zone_sel is 0 or 255, a similar gray world algorithm is used. When zone_sel is other values, the AWB algorithm filters all blocks to improve the AWB precision.
- Upper/Lower limit of the color temperature for the AWB algorithm is in the unit of Kelvin.
The upper and lower limits are the maximum and minimum color temperatures supported by the AWB algorithm. If the actual color temperature is greater than the upper limit or less than the lower limit, the AWB cannot be completely restored, and the image color is close to the illuminant color (that is, the image has a yellow cast at a low color temperature and has a blue cast at a high color temperature).
Note: The error of color temperature calculation is large in the high and low color temperature ranges. When the upper limit of the color temperature is less than 1000K, the color temperature may increase or decrease with the parameter value, and the color effect is not smooth.
- shift_limit_en determines whether the AWB gain is mapped on the Planckian curve. shift_limit is used to control the white block range. A smaller value indicates a narrower range of the supported illuminants and a higher precision, and vice versa. shift_limit_en controls only whether the AWB gain is mapped on the Planckian curve. No matter shift_limit_en is enabled or disabled, the change of shift_limit affects the AWB result. The color temperature of the illuminant for correcting the static WB coefficient must fall within the upper and lower limits for the color temperature configured by the AWB algorithm.
- When gain_norm_en is enabled, the RGB channel gain is limited to improve the SNR at a low color temperature in a low-illuminance scenario.
- If natural_cast_en is enabled, the AWB reserves the illuminant colors at low color temperatures, and the image colors are more natural. Note that if the ISO is extremely high, the intermediate value for calculating the RGB channel gain coefficient is truncated internally. As a result, after natural_cast_en is enabled, it has no influence on the final AWB environment color temperature calculation and RGB channel gain coefficient result. Similar cases also occur in scenarios such as HI_ISP_AWB_ALG_LOWCOST and HI_ISP_AWB_ALG_ADVANCE switching.
- The mapping between the weight table and AWB statistical zones is as follows:
− In non-stitching mode, the number of AWB statistical zones is 32x32. zone_wt[0] corresponds to the first column of the first row. zone_wt[1] corresponds to the second column of the first row. zone_wt[31] corresponds to column 32 of the first row. zone_wt[32] corresponds to the first column of the second row, and so on.
− The AWB statistical weight cannot be configured in stitching mode.
- After awb_zone_wt_en is enabled for a specific application, you can set the weight table to change the weight of each zone to optimize the AWB performance. When the shading is severe, you can increase the weight of the central zone to restore accurate AWB and reduce the impact of shading on AWB. For dash cams, ROI is generally lower than the center of the image. You can increase the weight of the ROI to reduce the interference of regions, such as the sky and trees, to the AWB.