24. Dehaze¶
24.1. Function Overview¶
Calculate the concentration of fog to automatically adjust the contrast and saturation and achieve the effect of dehazing.
24.2. API Reference¶
CVI_ISP_SetDehazeAttr : Set dehaze attribute parameters
CVI_ISP_GetDehazeAttr : Get dehaze attribute parameters
24.2.1. CVI_ISP_SetDehazeAttr¶
【Description】
Set dehaze attribute parameters
【Syntax】
CVI_S32 CVI_ISP_SetDehazeAttr(VI_PIPE ViPipe, const ISP_DEHAZE_ATTR_S *pstDehazeAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
ViPipe |
VI_PIPE number |
Input |
pstDehazeAttr |
Dehaze attribute parameters |
Input |
【Return Value】
Return value |
Description |
---|---|
0 |
Success |
Non 0 |
Failure. An error code is returned. For details, see chapter Error Codes. |
【Requirement】
Header files: cvi_isp.h, cvi_comm_isp.h
Library files: libisp.so
【Note】
None.
【Example】
// Enable Dehaze and set strength as 100
VI_PIPE ViPipe = 0;
ISP_DEHAZE_ATTR_S attr;
CVI_ISP_GetDehazeAttr(ViPipe, &attr);
attr.Enable = CVI_TRUE;
attr.enOpType = OP_TYPE_AUTO;
attr. stAuto.Strength[0 /*ISO 100*/] = 100; // Strength=0-100
attr. stAuto.Strength[1 /*ISO 200*/] = 100; // Strength=0-100
...
attr. stAuto.Strength[15 /*ISO 3276800*/] = 100; // Strength=0-100
CVI_ISP_SetDehazeAttr(ViPipe, &attr);
【Related topic】
24.2.2. CVI_ISP_GetDehazeAttr¶
【Description】
Get dehaze attribute parameters
【Syntax】
CVI_S32 CVI_ISP_GetDehazeAttr(VI_PIPE ViPipe, ISP_DEHAZE_ATTR_S *pstDehazeAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
ViPipe |
VI_PIPE number |
Input |
pstDehazeAttr |
Dehaze attribute parameters |
Output |
【Return Value】
Return value |
Description |
---|---|
0 |
Success |
Non 0 |
Failure. An error code is returned. For details, see chapter Error Codes. |
【Requirement】
Header files: cvi_isp.h, cvi_comm_isp.h
Library files: libisp.so
【Note】
None.
【Example】
None.
【Related topic】
24.3. Data Types¶
ISP_DEHAZE_MANUAL_ATTR_S : Dehaze attribute manual parameters
ISP_DEHAZE_AUTO_ATTR_S : Dehaze attribute automatic parameters
ISP_DEHAZE_ATTR_S : Dehaze attribute parameters
24.3.1. ISP_DEHAZE_MANUAL_ATTR_S¶
【Description】
Dehaze attribute manual parameters
【Syntax】
typedef struct _ISP_DEHAZE_MANUAL_ATTR_S {
CVI_U8 Strength;
} ISP_DEHAZE_MANUAL_ATTR_S;
【Member】
Member |
Description |
---|---|
Strength |
Used to control the intensity of dehaze. The larger the value, the stronger the dehazing intensity. Value range : [0x0, 0x64] Data type: CVI_U8 |
【Note】
None.
【Related Data Type and Interface】
24.3.2. ISP_DEHAZE_AUTO_ATTR_S¶
【Description】
Dehaze attribute automatic parameters
【Syntax】
typedef struct _ISP_DEHAZE_AUTO_ATTR_S {
CVI_U8 Strength[ISP_AUTO_ISO_STRENGTH_NUM];
} ISP_DEHAZE_AUTO_ATTR_S;
【Member】
Member |
Description |
---|---|
Strength |
Used to control the intensity of dehaze. The larger the value, the stronger the dehazing intensity.
Data type: CVI_U8 |
【Note】
None.
【Related Data Type and Interface】
24.3.3. ISP_DEHAZE_ATTR_S¶
【Description】
Dehaze attribute parameters
【Syntax】
typedef struct _ISP_DEHAZE_ATTR_S {
CVI_BOOL Enable; /*RW; Range:[0, 1]*/
ISP_OP_TYPE_E enOpType;
CVI_U8 UpdateInterval; /*RW; Range:[0x1, 0xFF]*/
CVI_U16 CumulativeThr; /*RW; Range:[0x0, 0x3fff]*/
CVI_U16 MinTransMapValue; /*RW; Range:[0x0, 0x1fff]*/
CVI_BOOL DehazeLumaEnable; /*RW; Range:[0, 1]*/
CVI_BOOL DehazeSkinEnable; /*RW; Range:[0, 1]*/
CVI_U8 AirLightMixWgt; /*RW; Range:[0x0, 0x20]*/
CVI_U8 DehazeWgt; /*RW; Range:[0x0, 0x20]*/
CVI_U8 TransMapScale; /*RW; Range:[0x0, 0xff]*/
CVI_U8 AirlightDiffWgt; /*RW; Range:[0x0, 0x10]*/
CVI_U16 AirLightMax; /*RW; Range:[0x0, 0xfff]*/
CVI_U16 AirLightMin; /*RW; Range:[0x0, 0xfff]*/
CVI_U8 SkinCb; /*RW; Range:[0x0, 0xff]*/
CVI_U8 SkinCr; /*RW; Range:[0x0, 0xff]*/
CVI_U16 DehazeLumaCOEFFI; /*RW; Range:[0x0, 0x7d0]*/
CVI_U16 DehazeSkinCOEFFI; /*RW; Range:[0x0, 0x7d0]*/
CVI_U8 TransMapWgtWgt; /*RW; Range:[0x0, 0x80]*/
CVI_U8 TransMapWgtSigma; /*RW; Range:[0x0, 0xff]*/
ISP_DEHAZE_MANUAL_ATTR_S stManual;
ISP_DEHAZE_AUTO_ATTR_S stAuto;
} ISP_DEHAZE_ATTR_S;
【Member】
Member |
Description |
---|---|
Enable |
Enable the Dehaze function Value range: [0x0, 0x1] Data type: CVI_BOOL |
enOpType |
job type OP_TYPE_AUTO: automatic mode OP_TYPE_MANUAL: manual mode |
UpdateInterval |
Affects the parameter update terval, the larger the value, the slower the screen changes and the better the performance Value range: [0x0, 0xff] Data type: CVI_U8 |
CumulativeThr |
Computes the statistical threshold for fog density. The default value is about 0.05% of the total number of images in the original image Value range: [0x0, 0x3fff] Data type: CVI_U16 |
MinTransMapValue |
The minimum allowable transmission coefficient Value range: [0x0, 0x1fff] Data type: CVI_U16 |
DehazeLumaEnable |
“Adjust the defogging intensity function according to the brightness to enable Value range: [0x0, 0x1] Data type: CVI_BOOL |
DehazeSkinEnable |
“Adjust the defogging intensity function according to the skin color to enable Value range: [0x0, 0x1] Data type: CVI_BOOL |
AirLightMixWgt |
Airlight Blend Weights Value range: [0x0, 0x20] Data type: CVI_U8 |
DehazeWgt |
Dehaze output blend weights Value range: [0x0, 0x20] Data type: CVI_U8 |
TransMapScale |
Transmission coefficient gain Value range: [0x0, 0xff] Data type: CVI_U8 |
AirlightDiffWgt |
Airlight Value range: [0x0, 0x10] Data type: CVI_U8 |
AirLightMax |
Maximum value allowed by Airlight Value range: [0x0, 0xfff] Data type: CVI_U16 |
AirLightMin |
Minimum value allowed by Airlight Value range: [0x0, 0xfff] Data type: CVI_U16 |
SkinCb |
The coordinates of the custom skin color on the Cb domain Value range: [0x0, 0xff] Data type: CVI_U8 |
SkinCr |
The coordinates of the custom skin color on the Cr domain Value range: [0x0, 0xff] Data type: CVI_U8 |
DehazeLumaCOEFFI |
According to the brightness control defogging intensity curve, the brightness is divided into 16 levels. The larger the value, the stronger the defogging strength Value range: [0x0, 0x7d0] Data type: CVI_U16 |
DehazeSkinCOEFFI |
Control the defogging intensity curve according to the skin tone, and divide the brightness into 16 levels. The larger the value, the stronger the defogging strength Value range: [0x0, 0x7d0] Data type: CVI_U16 |
TransMapWgtWgt |
Transmission coefficient gain control, which determines the weight curve of the Dehaze result and the original image fusion Value range: [0x0, 0x80] Data type: CVI_U8 |
TransMapWgtSigma |
Transmission coefficient gain control, which determines the weight curve of the Dehaze result and the original image fusion Value range: [0x0, 0xff] Data type: CVI_U8 |
stManual |
Manual Mode parameter Properties |
stAuto |
Auto Mode parameter Properties |
【Note】
None.
【Related Data Type and Interface】