21. Gamma

21.1. Function Overview

Because the human eye is more sensitive to low brightness, it does nonlinear conversion of the brightness of the image, compresses the bright area and stretches the dark area to make the overall brightness feel better.

21.2. API Reference

21.2.1. CVI_ISP_SetGammaAttr

【Description】

  • Set the gamma attribute parameter

【Syntax】

CVI_S32 CVI_ISP_SetGammaAttr(VI_PIPE ViPipe, const ISP_GAMMA_ATTR_S *pstGammaAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstGammaAttr

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】

21.2.2. CVI_ISP_GetGammaAttr

【Description】

Get the gamma attribute parameter

【Syntax】

CVI_S32 CVI_ISP_GetGammaAttr(VI_PIPE ViPipe, ISP_GAMMA_ATTR_S *pstGammaAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstGammaAttr

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】

21.2.3. CVI_ISP_GetGammaCurveByType

【Description】

  • Get Gamma curve information

【Syntax】

CVI_S32 CVI_ISP_GetGammaCurveByType(VI_PIPE ViPipe, ISP_GAMMA_ATTR_S *pstGammaAttr, const ISP_GAMMA_CURVE_TYPE_E curveType);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstGammaAttr

Gamma property parameter

Output

curveType

Gamma Curve Type

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】

21.2.4. CVI_ISP_SetAutoGammaAttr

【Description】

Set Auto Gamma attribute parameters

【Syntax】

CVI_S32 CVI_ISP_SetAutoGammaAttr(VI_PIPE ViPipe, const ISP_AUTO_GAMMA_ATTR_S *pstGammaAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstGammaAttr

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

21.2.5. CVI_ISP_GetAutoGammaAttr

【Description】

  • Get Auto Gamma attribute parameters

【Syntax】

CVI_S32 CVI_ISP_GetAutoGammaAttr(VI_PIPE ViPipe, ISP_AUTO_GAMMA_ATTR_S *pstGammaAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstGammaAttr

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

21.3. Data Types

21.3.1. ISP_GAMMA_CURVE_TYPE_E

【Description】

Auto Gamma curve parameters

【Syntax】

 typedef enum _ISP_GAMMA_CURVE_TYPE_E {
  ISP_GAMMA_CURVE_DEFAULT,
  ISP_GAMMA_CURVE_SRGB,
  ISP_GAMMA_CURVE_USER_DEFINE,
  ISP_GAMMA_CURVE_AUTO,
  ISP_GAMMA_CURVE_MAX
} ISP_GAMMA_CURVE_TYPE_E;

【Member】

Member

Description

ISP_GAMMA_CURVE_DEFAULT

default curve

ISP_GAMMA_CURVE_SRGB

SRGB curve

ISP_GAMMA_CURVE_USER_DEFINE

user defined curve

ISP_GAMMA_CURVE_AUTO

Adaptive curve please refer to CVI_ISP_SetAutoGammaAttr CVI_ISP_GetAutoGammaAttr

ISP_GAMMA_CURVE_MAX

【Note】

None.

【Related Data Type and Interface】

21.3.2. ISP_GAMMA_ATTR_S

【Description】

Gamma attribute parameter

【Syntax】

 typedef struct _ISP_GAMMA_ATTR_S {
  CVI_BOOL Enable;
  CVI_U8 UpdateInterval;
  CVI_U16 Table[GAMMA_NODE_NUM];
  ISP_GAMMA_CURVE_TYPE_E enCurveType;
} ISP_GAMMA_ATTR_S;

【Member】

Member

Description

Enable

The Gamma function is enabled.

0: off.

1: Enabled.

Value range: [0, 1]

Data type: CVI_BOOL

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

Table[GAMMA_NODE_NUM]

Gamma curve node value

Value range: [0x0, 0xfff]

Data type: CVI_U16

enCurveType

Gamma Curve Type

【Note】

GAMMA_NODE_NUM = 256

【Related Data Type and Interface】

21.3.3. ISP_GAMMA_CURVE_ATTR_S

【Description】

Gamma attribute parameter

【Syntax】

 typedef struct _ISP_GAMMA_CURVE_ATTR_S {
  CVI_S16 Lv;
  CVI_U16 Tbl[GAMMA_NODE_NUM];
} ISP_GAMMA_CURVE_ATTR_S;

【Member】

Member

Description

Lv

Gamma curve corresponds to Lv range

Value range: [-500, 1500]

Data type: CVI_S16

Tbl[GAMMA_NODE_NUM]

Gamma curve node value

Value range: [0x0, 0xfff]

Data type: CVI_U16

【Note】

GAMMA_NODE_NUM = 256

【Related Data Type and Interface】

21.3.4. ISP_AUTO_GAMMA_ATTR_S

【Description】

Auto Gamma attribute parameter

【Syntax】

 typedef struct _ISP_AUTO_GAMMA_ATTR_S {
  CVI_U8 GammaTabNum;
  ISP_GAMMA_CURVE_ATTR_S
  GammaTab[GAMMA_MAX_INTERPOLATION_NUM];
} ISP_AUTO_GAMMA_ATTR_S;

【Member】

Member

Description

GammaTabNum

Number of Adaptive Gamma Curves

Value range: [0, 5]

Data type: CVI_U8

GammaTab[GAMMA_MAX_INTERPOLATION_NUM]

Adaptive Gamma Curve Information

【Note】

GAMMA_MAX_INTERPOLATION_NUM=5

【Related Data Type and Interface】