19. Sharpen

19.1. Function Overview

This module is used to enhance image clarity, after 3DNR, it mainly sharpens the large edges in the image.

19.2. API reference

19.2.1. CVI_ISP_SetSharpenAttr

【Description】

Set sharpening property parameters

【Syntax】

CVI_S32 CVI_ISP_SetSharpenAttr(VI_PIPE ViPipe, const ISP_SHARPEN_ATTR_S *pstDRCAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstSharpenAttr

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

19.2.2. CVI_ISP_GetSharpenAttr

【Description】

Get sharpening property parameters

【Syntax】

CVI_S32 CVI_ISP_GetSharpenAttr(VI_PIPE ViPipe, ISP_SHARPEN_ATTR_S *pstDRCAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstSharpenAttr

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

19.3. Data Type

19.3.1. ISP_SHARPEN_MANUAL_ATTR_S

【Description】

Demosaic Sharpening Properties Manual parameters

【Syntax】

 typedef struct _ISP_SHARPEN_MANUAL_ATTR_S {
  CVI_U8 LumaAdpGain[SHARPEN_LUT_NUM]; /*RW; Range:[0x0, 0x3f]*/
  CVI_U8 DeltaAdpGain[SHARPEN_LUT_NUM];
  CVI_U8 LumaCorLutIn[EE_LUT_NODE]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 LumaCorLutOut[EE_LUT_NODE]; /*RW; Range:[0x0, 0x20]*/
  CVI_U8 MotionCorLutIn[EE_LUT_NODE]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MotionCorLutOut[EE_LUT_NODE]; /*RW; Range:[0x0, 0x20]*/
  CVI_U8 MotionCorWgtLutIn[EE_LUT_NODE]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MotionCorWgtLutOut[EE_LUT_NODE]; /*RW; Range:[0x0, 0x80]*/
  CVI_U8 GlobalGain; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 OverShootGain; /*RW; Range:[0x0, 0x3f]*/
  CVI_U8 UnderShootGain; /*RW; Range:[0x0, 0x3f]*/
  CVI_U8 HFBlendWgt; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MFBlendWgt; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 OverShootThr; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 UnderShootThr; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 OverShootThrMax; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 UnderShootThrMin; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MotionShtGainIn[EE_LUT_NODE]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MotionShtGainOut[EE_LUT_NODE]; /*RW; Range:[0x0, 0x80]*/
  CVI_U8 HueShtCtrl[SHARPEN_LUT_NUM]; /*RW; Range:[0x0, 0x3f]*/
  CVI_U8 SatShtGainIn[EE_LUT_NODE]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 SatShtGainOut[EE_LUT_NODE]; /*RW; Range:[0x0, 0x80]*/
} ISP_SHARPEN_MANUAL_ATTR_S;

【Member】

Member

Description

LumaAdpGain[33]

Brightness Sharpening Weight

Value range: [0x0, 0x3f]

Data type: CVI_U8

LumaCorLutIn[EE_LUT_NODE]

Based on luma coring, this is the input node, input luma

Value range: [0x0, 0xff]

Data type: CVI_U8

LumaCorLutOut[EE_LUT_NODE]

Based on luma’s coring, this is the output node, and the output corresponds to the coring value

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionCorLutIn[EE_LUT_NODE]

Motion-based coring, this is the input node, the input is motion

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionCorLutOut[EE_LUT_NODE]

Motion-based coring, this is the output node, output the corresponding coring value

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionCorWgtLutIn[EE_LUT_NODE]

Adjust the weight of luma coring and motion coring based on motion, this is the input node, input the size of motion

Value range: [0x0, 0xff] Data type: CVI_U8

MotionCorWgtLutOut[EE_LUT_NODE]

Adjust the weight of luma coring and motion coring based on motion, this is the output node, output the weight of motion coring. (max = 128)

Value range: [0x0, 0x80]

Data type: CVI_U8

GlobalGain

Global sharpening weight

Value range: [0x0, 0xff]

Data type: CVI_U8

OverShootGain

White edge sharpening weight

Value range: [0x0, 0x3f]

Data type: CVI_U8

UnderShootGain

Black edge sharpening weight

Value range: [0x0, 0x3f]

Data type: CVI_U8

EdgeGlobalGain

Global edge sharpening weights

Value range: [0x0, 0x3f]

Data type: CVI_U8

DeltaShtCtrl[33]

Define the degree of edge enhancement according to the result of edge detection

Value range: [0x0, 0x3f]

Data type: CVI_U8

DeltaShtCtrlUnit

Intensity control for edge detection

Value range: [0x0, 0x3]

Data type: CVI_U8

YNoiseLevel

Luminance sharpening noise value magnification, one time is 64. The larger the value, the more brightness sharpening noise is amplified, and vice versa

Value range: [0x0, 0xff]

Data type: CVI_U8

HFBlendWgt

Weights for high-frequency edge enhancement

Value range: [0x0, 0xff]

Data type: CVI_U8

MFBlendWgt

Weights for Mid-Frequency Edge Enhancement

Value range: [0x0, 0xff]

Data type: CVI_U8

OverShootThr

White edge sharpening upper limit

Value range: [0x0, 0xff]

Data type: CVI_U8

UnderShootThr

Lower limit of black edge sharpening

Value range: [0x0, 0xff]

Data type: CVI_U8

OverShootThrMax

White edge sharpening maximum upper limit range

Value range: [0x0, 0xff]

Data type: CVI_U8

UnderShootThrMin

Black edge sharpening maximum and minimum range

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionShtGainIn[4]

For the LUT that determines the degree of edge enhancement in the motion area, this is a horizontal node, and the input value is the motion value

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionShtGainOut[4]

For the LUT that determines the degree of edge enhancement in the motion area, this is a vertical node, and the output value is the enhancement strength corresponding to the motion

Value range: [0x0, 0x80]

Data type: CVI_U8

NoiseSuppressMode

Enhance the filter mode of denoising, set 1 to use a smoother filter

Value range: [0x0, 0x1]

Data type: CVI_BOOL

HueShtCtrl[SHARPEN_LUT_NUM]

Edge enhancement based on specified color

Value range: [0x0, 0x3f]

Data type: CVI_U8

SatShtGainIn[EE_LUT_NODE]

Edge enhancement based on the specified saturation, this is the input node, input saturation

Value range: [0x0, 0xff]

Data type: CVI_U8

SatShtGainOut[EE_LUT_NODE]

Edge enhancement based on the specified saturation, this is the output node, which outputs the edge strength corresponding to the saturation. (max = 128)

Value range: [0x0, 0xff]

Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

19.3.2. ISP_SHARPEN_AUTO_ATTR_S

【Description】

Demosaic sharpening attribute automatic parameters

【Syntax】

 typedef struct _ISP_SHARPEN_MANUAL_ATTR_S {
  CVI_U8 LumaAdpGain[SHARPEN_LUT_NUM][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x3f]*/
  CVI_U8 DeltaAdpGain[SHARPEN_LUT_NUM][ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 LumaCorLutIn[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 LumaCorLutOut[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x20]*/
  CVI_U8 MotionCorLutIn[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MotionCorLutOut[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x20]*/
  CVI_U8 MotionCorWgtLutIn[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MotionCorWgtLutOut[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x80]*/
  CVI_U8 GlobalGain[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 OverShootGain[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x3f]*/
  CVI_U8 UnderShootGain[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x3f]*/
  CVI_U8 HFBlendWgt[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MFBlendWgt[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 OverShootThr[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 UnderShootThr[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 OverShootThrMax[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 UnderShootThrMin[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MotionShtGainIn[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 MotionShtGainOut[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x80]*/
  CVI_U8 HueShtCtrl[SHARPEN_LUT_NUM][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x3f]*/
  CVI_U8 SatShtGainIn[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 SatShtGainOut[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x80]*/
  CVI_U8 SatShtGainOut[EE_LUT_NODE][ISP_AUTO_ISO_STRENGTH_NUM]; /*RW; Range:[0x0, 0x80]*/
} ISP_SHARPEN_AUTO_ATTR_S;

【Member】

Member

Description

LumaAdpGain[33]

Brightness Sharpening Weight

Value range: [0x0, 0x3f]

Data type: CVI_U8

LumaCorLutIn[EE_LUT_NODE]

Based on luma coring, this is the input node, input luma

Value range: [0x0, 0xff]

Data type: CVI_U8

LumaCorLutOut[EE_LUT_NODE]

Based on luma’s coring, this is the output node, and the output corresponds to the coring value

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionCorLutIn[EE_LUT_NODE]

Motion-based coring, this is the input node, the input is motion

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionCorLutOut[EE_LUT_NODE]

Motion-based coring, this is the output node, output the corresponding coring value

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionCorWgtLutIn[EE_LUT_NODE]

Adjust the weight of luma coring and motion coring based on motion, this is the input node, input the size of motion

Value range: [0x0, 0xff] Data type: CVI_U8

MotionCorWgtLutOut[EE_LUT_NODE]

Adjust the weight of luma coring and motion coring based on motion, this is the output node, output the weight of motion coring. (max = 128)

Value range: [0x0, 0x80]

Data type: CVI_U8

GlobalGain

Global sharpening weight

Value range: [0x0, 0xff]

Data type: CVI_U8

OverShootGain

White edge sharpening weight

Value range: [0x0, 0x3f]

Data type: CVI_U8

UnderShootGain

Black edge sharpening weight

Value range: [0x0, 0x3f]

Data type: CVI_U8

EdgeGlobalGain

Global edge sharpening weights

Value range: [0x0, 0x3f]

Data type: CVI_U8

DeltaShtCtrl[33]

Define the degree of edge enhancement according to the result of edge detection

Value range: [0x0, 0x3f]

Data type: CVI_U8

DeltaShtCtrlUnit

Intensity control for edge detection

Value range: [0x0, 0x3]

Data type: CVI_U8

YNoiseLevel

Luminance sharpening noise value magnification, one time is 64. The larger the value, the more brightness sharpening noise is amplified, and vice versa

Value range: [0x0, 0xff]

Data type: CVI_U8

HFBlendWgt

Weights for high-frequency edge enhancement

Value range: [0x0, 0xff]

Data type: CVI_U8

MFBlendWgt

Weights for Mid-Frequency Edge Enhancement

Value range: [0x0, 0xff]

Data type: CVI_U8

OverShootThr

White edge sharpening upper limit

Value range: [0x0, 0xff]

Data type: CVI_U8

UnderShootThr

Lower limit of black edge sharpening

Value range: [0x0, 0xff]

Data type: CVI_U8

OverShootThrMax

White edge sharpening maximum upper limit range

Value range: [0x0, 0xff]

Data type: CVI_U8

UnderShootThrMin

Black edge sharpening maximum and minimum range

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionShtGainIn[4]

For the LUT that determines the degree of edge enhancement in the motion area, this is a horizontal node, and the input value is the motion value

Value range: [0x0, 0xff]

Data type: CVI_U8

MotionShtGainOut[4]

For the LUT that determines the degree of edge enhancement in the motion area, this is a vertical node, and the output value is the enhancement strength corresponding to the motion

Value range: [0x0, 0x80]

Data type: CVI_U8

NoiseSuppressMode

Enhance the filter mode of denoising, set 1 to use a smoother filter

Value range: [0x0, 0x1]

Data type: CVI_BOOL

HueShtCtrl[SHARPEN_LUT_NUM]

Edge enhancement based on specified color

Value range: [0x0, 0x3f]

Data type: CVI_U8

SatShtGainIn[EE_LUT_NODE]

Edge enhancement based on the specified saturation, this is the input node, input saturation

Value range: [0x0, 0xff]

Data type: CVI_U8

SatShtGainOut[EE_LUT_NODE]

Edge enhancement based on the specified saturation, this is the output node, which outputs the edge strength corresponding to the saturation. (max = 128)

Value range: [0x0, 0xff]

Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

19.3.3. ISP_SHARPEN_ATTR_S

【Description】

Demosaic Sharpening Attribute parameters

【Syntax】

 typedef struct _ISP_SHARPEN_ATTR_S {
  CVI_BOOL Enable; /*RW; Range:[0x0, 0x1]*/
  ISP_OP_TYPE_E enOpType;
  CVI_U8 UpdateInterval; /*RW; Range:[0x1, 0xFF]*/
  CVI_U8 TuningMode; /*RW; Range:[0x0, 0xb]*/
  CVI_BOOL LumaAdpGainEn; /*RW; Range:[0x0, 0x1]*/
  CVI_BOOL DeltaAdpGainEn; /*RW; Range:[0x0, 0x1]*/
  CVI_U8 DeltaAdpGain[SHARPEN_LUT_NUM]; /*RW; Range:[0x0, 0x3f]*/
  CVI_BOOL NoiseSuppressEnable; /*RW; Range:[0, 1]*/
  CVI_BOOL SatShtCtrlEn; /*RW; Range:[0, 1]*/
  CVI_BOOL SoftClampEnable; /*RW; Range:[0x0, 0x1]*/
  CVI_U8 SoftClampUB; /*RW; Range:[0x0, 0xff]*/
  CVI_U8 SoftClampLB; /*RW; Range:[0x0, 0xff]*/
  ISP_SHARPEN_MANUAL_ATTR_S stManual;
  ISP_SHARPEN_AUTO_ATTR_S stAuto;
} ISP_SHARPEN_ATTR_S;

【Member】

Member

Description

Enable

Y Sharpen 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 terval, the larger the value, the slower the screen changes and the better the performance

Value range: [0x0, 0xff]

Data type: CVI_U8

TuningMode

Output debug strategy, auxiliary adjustment parameters

Value range: [0x0, 0xb]

Data type: CVI_U8

LumaAdpCoringEn

Automatic Luminance Noise Rejection Threshold Switch

Value range: [0, 1]

Data type: CVI_BOOL

LumaAdpGainEn

Brightness sharpening weights enabled

Value range: [0, 1]

Data type: CVI_BOOL

DeltaAdpGainEn

sharpen weights enable

Value range: [0, 1]

Data type: CVI_BOOL

DeltaAdpGain[SHARPEN_LUT_NUM]

sharpening weight

Value range: [0x0, 0x3f]

Data type: CVI_U8

NoiseSuppressEnable

Enhanced denoising enable. For edge detection images, do pre-processing to strengthen denoising and then do edge enhancement

Value range: [0, 1]

Data type: CVI_BOOL

SatShtCtrlEn

Enablement of edge enhancement adjusted by saturation enable

Value range: [0, 1]

Data type: CVI_BOOL

SoftClampEnable

Smooth Processing Edge Enhancement

Value range: [0, 1]

Data type: CVI_BOOL

SoftClampUB

The upper bound of edge enhancement for smooth processing. The larger the value is, the more continuous the edge enhancement will be, but the weaker the enhancement effect will be.

Value range: [0, 0xff]

Data type: CVI_U8

SoftClampLB

The lower bound of edge enhancement for smooth processing. The larger the value is, the more continuous the edge enhancement will be, but the weaker the enhancement effect will be.

Value range: [0, 0xff]

Data type: CVI_U8

stManual

Manual Mode parameter Properties

stAuto

Auto Mode parameter Properties

【Note】

None.

【Related Data Type and Interface】