27. CAC

27.1. Function Overview

Color distortion correction: Due to the different light refractive index of different colors, purple edges are easy to form around the objects at the junction of the highlighted area and the low-lit area. This module can realize the function of removing purple edges in the image and improve the purple edge phenomenon in the image edge.

27.2. API Reference

27.2.1. CVI_ISP_SetCacAttr

【Description】

Set gamma attribute parameters

【Syntax】

CVI_S32 CVI_ISP_SetCacAttr(VI_PIPE ViPipe, const ISP_CacAttr_ATTR_S *pstCacAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstCacAttr

Gamma 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】

None.

【Related Topic】

27.2.2. CVI_ISP_GetCacAttr

【Description】

Get gamma attribute parameters

【Syntax】

CVI_S32 CVI_ISP_GetCacAttr(VI_PIPE ViPipe, ISP_CacAttr_ATTR_S *pstCacAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstCacAttr

Gamma 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】

27.3. Data Types

27.3.1. ISP_CAC_MANUAL_ATTR_S

【Description】

Gamma attribute manual parameter

【Syntax】

 typedef struct _ISP_CAC_MANUAL_ATTR_S {
  CVI_U8 DePurpleStr; /*RW; Range:[0x0, 0xFF]*/
  CVI_U8 EdgeGlobalGain; /*RW; Range:[0x0, 0xFF]*/
  CVI_U8 EdgeCoring; /*RW; Range:[0x0, 0xFF]*/
  CVI_U8 EdgeStrMin; /*RW; Range:[0x0, 0xFF]*/
  CVI_U8 EdgeStrMax; /*RW; Range:[0x0, 0xFF]*/
  CVI_U8 DePurpleCbStr; /*RW; Range:[0x0, 0x8]*/
  CVI_U8 DePurpleCrStr; /*RW; Range:[0x0, 0x8]*/
  CVI_U8 DePurpleStrMaxRatio; /*RW; Range:[0x0, 0x40]*/
  CVI_U8 DePurpleStrMinRatio; /*RW; Range:[0x0, 0x40]*/
} ISP_CAC_MANUAL_ATTR_S;

【Member】

Member

Description

DePurpleStr

Depurple fringing intensity. The larger the value, the less purple fringing

Value range: [0x0, 0xff]

Data type: CVI_U8

EdgeGlobalGain

Intensity total gain for edge detection

Value range: [0x0, 0xff]

Data type: CVI_U8

EdgeCoring

Noise Suppression Control for Edge Detection

Value range: [0x0, 0xff]

Data type: CVI_U8

EdgeStrMin

Intensity lower limit for edge detection

Value range: [0x0, 0xff]

Data type: CVI_U8

EdgeStrMax

Strength limit for edge detection

Value range: [0x0, 0xff]

Data type: CVI_U8

DePurpleCbStr

B channel purple fringing corrected edge intensity. The larger the value, the less purple fringing

Value range: [0x0, 0x8]

Data type: CVI_U8

DePurpleCrStr

R channel purple fringing corrected edge intensity. The larger the value, the less purple fringing

Value range: [0x0, 0x8]

Data type: CVI_U8

DePurpleStrMaxRatio

The maximum allowable gain for defrringing intensity

Value range: [0x0, 0x40]

Data type: CVI_U8

DePurpleStrMinRatio

Minimum allowable gain for defrringing intensity

Value range: [0x0, 0x40]

Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

27.3.2. ISP_CAC_AUTO_ATTR_S

【Description】

Gamma attribute automatic parameter

【Syntax】

 typedef struct _ISP_CAC_AUTO_ATTR_S {
  CVI_U8 DePurpleStr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 EdgeGlobalGain[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 EdgeCoring[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 EdgeStrMin[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 EdgeStrMax[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 DePurpleCbStr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 DePurpleCrStr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 DePurpleStrMaxRatio[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 DePurpleStrMinRatio[ISP_AUTO_ISO_STRENGTH_NUM];
} ISP_CAC_AUTO_ATTR_S;

【Member】

Member

Description

DePurpleStr

Depurple fringing intensity. The larger the value, the less purple fringing

Value range: [0x0, 0xff]

Data type: CVI_U8

EdgeGlobalGain

Intensity total gain for edge detection

Value range: [0x0, 0xff]

Data type: CVI_U8

EdgeCoring

Noise Suppression Control for Edge Detection

Value range: [0x0, 0xff]

Data type: CVI_U8

EdgeStrMin

Intensity lower limit for edge detection

Value range: [0x0, 0xff]

Data type: CVI_U8

EdgeStrMax

Strength limit for edge detection

Value range: [0x0, 0xff]

Data type: CVI_U8

DePurpleCbStr

B channel purple fringing corrected edge intensity. The larger the value, the less purple fringing

Value range: [0x0, 0x8]

Data type: CVI_U8

DePurpleCrStr

R channel purple fringing corrected edge intensity. The larger the value, the less purple fringing

Value range: [0x0, 0x8]

Data type: CVI_U8

DePurpleStrMaxRatio

The maximum allowable gain for defrringing intensity

Value range: [0x0, 0x40]

Data type: CVI_U8

DePurpleStrMinRatio

Minimum allowable gain for defrringing intensity

Value range: [0x0, 0x40]

Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

27.3.3. ISP_CAC_ATTR_S

【Description】

Gamma attribute parameter

【Syntax】

 typedef struct _ISP_CAC_ATTR_S {
  CVI_BOOL Enable;
  ISP_OP_TYPE_E enOpType;
  CVI_U8 UpdateInterval;
  CVI_U8 PurpleDetRange;
  CVI_U8 PurpleCb;
  CVI_U8 PurpleCr;
  CVI_U8 PurpleCb2;
  CVI_U8 PurpleCr2;
  CVI_U8 PurpleCb3;
  CVI_U8 PurpleCr3;
  CVI_U8 GreenCb;
  CVI_U8 GreenCr;
  CVI_U8 TuningMode;
  CVI_U8 EdgeGainIn[3];
  CVI_U8 EdgeGainOut[3];
  ISP_CAC_MANUAL_ATTR_S stManual;
  ISP_CAC_AUTO_ATTR_S stAuto;
} ISP_CAC_ATTR_S;

【Member】

Member

Description

Enable

CAC module enable

Value range: [0, 1]

Data type: CVI_BOOL

enOpType

job type

OP_TYPE_AUTO: automatic mode

OP_TYPE_MANUAL: manual mode

UpdateInterval

Affects the parameter update interval, the larger the value, the slower the screen changes and the better the performance

Value range: [0x0, 0xff]

Data type: CVI_U8

PurpleDetRange

Threshold for purple fringing detection. The larger the value, the more areas are judged as purple fringing

Value range: [0x0, 0x80]

Data type: CVI_U8

PurpleCb

The coordinates of purple in Cb domain

Value range: [0x0, 0xff]

Data type: CVI_U8

PurpleCr

The coordinates of purple in Cr domain

Value range: [0x0, 0xff]

Data type: CVI_U8

PurpleCb2

The coordinates of purple 2 in Cb domain

Value range: [0x0, 0xff]

Data type: CVI_U8

PurpleCr2

The coordinates of purple 2 in the Cr domain

Value range: [0x0, 0xff]

Data type: CVI_U8

PurpleCb3

The coordinates of purple 3 in the Cb domain.

Value range: [0x0, 0xff]

Data type: CVI_U8

PurpleCr3

The coordinates of purple 3 in the Cr domain

Value range: [0x0, 0xff]

Data type: CVI_U8

GreenCb

Coordinates of green in Cb domain

Value range: [0x0, 0xff]

Data type: CVI_U8

GreenCr

Coordinates of green in Cr domain

Value range: [0x0, 0xff]

Data type: CVI_U8

TuningMode

Output debug strategy to assist in adjusting parameters.

0: CAC image result.

1: Edge detection image result.

2: The value range of purple fringe detection image results: [0x0, 0x2]

Data type: CVI_U8

EdgeGainIn[3]

An array of four numeric values. Define the edge strength level, the larger the value, the stronger the edge strength

Value range: [0x0, 0x20]

Data type: CVI_U8

EdgeGainOut[3]

An array of four numeric values. Define the edge strength gain, the larger the value, the stronger the output edge strength

Value range: [0x0, 0x20]

Data type: CVI_U8

stManual

Manual Mode parameter Properties

stAuto

Auto Mode parameter Properties

【Note】

None.

【Related Data Type and Interface】