20. PreSharpen¶
20.1. Function Overview¶
This module is used to enhance image sharpness, pre-3DNR, and focuses on sharpening directional edges and detailed textures in images.
20.2. API Reference¶
CVI_ISP_SetPreSharpenAttr : Sets the sharpening attribute parameter
CVI_ISP_GetPreSharpenAttr : Obtains the sharpening attribute parameter
20.2.1. CVI_ISP_SetPreSharpenAttr¶
【Description】
Sets the sharpening attribute parameter
【Syntax】
CVI_S32 CVI_ISP_SetPreSharpenAttr(VI_PIPE ViPipe, const ISP_PRESHARPEN_ATTR_S * pstPreSharpenAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
ViPipe |
VI_PIPE number |
Input |
pstPreSharpenAttr |
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】
20.2.2. CVI_ISP_GetPreSharpenAttr¶
【Description】
Obtains the sharpening attribute parameter
【Syntax】
CVI_S32 CVI_ISP_GetPreSharpenAttr(VI_PIPE ViPipe, ISP_PRESHARPEN_ATTR_S *pstPreSharpenAttr);
【Parameter】
Parameter |
Description |
Input/Output |
---|---|---|
ViPipe |
VI_PIPE number |
Input |
pstPreSharpenAttr |
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】
20.3. Data Types¶
ISP_PRESHARPEN_MANUAL_ATTR_S : sharpening attribute manual parameter
ISP_PRESHARPEN_AUTO_ATTR_S : sharpening attribute automatic parameter
ISP_PRESHARPEN_ATTR_S : sharpening attribute parameter
20.3.1. ISP_PRESHARPEN_MANUAL_ATTR_S¶
【Description】
sharpening attribute manual parameter
【Syntax】
typedef struct _ISP_PRESHARPEN_MANUAL_ATTR_S {
CVI_U8 LumaAdpGain[SHARPEN_LUT_NUM]; /*RW; Range:[0x0, 0x3f]*/
CVI_U8 DeltaAdpGain[SHARPEN_LUT_NUM]; /*RW; Range:[0x0, 0x3f]*/
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_PRESHARPEN_MANUAL_ATTR_S;
【Member】
Member |
Description |
---|---|
EdgeGain |
Edge Enhancement parameters The larger the value, the greater the edge sharpening strength Value range: [0x0, 0x3f] Data type: CVI_U8 |
TextureGain |
Enhancement parameters for detail textures The larger the value, the greater the detail texture sharpening intensity Value range: [0x0, 0x3ff] Data type: CVI_U16 |
EdgeFreq |
Image Directional Edge Band Control Value range: [0x0, 0x4] Data type: CVI_U8 |
TextureFreq |
Image non-directional detail texture band control Value range: [0x0, 0x4] Data type: CVI_U8 |
LumaAdpCoring[33] |
Luminance sharpening noise values, detail texture or edge enhancement will exclude the enhancement contributed by this tolerance value. The smaller the value, the more obvious the effect of sharpening, but the easier it is to sharpen the noise. The larger the value is, the less likely it is to sharpen the noise, but the sharpening effect is less obvious Value range: [0x0, 0x3ff] Data type: CVI_U16 |
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, 0xff] Data type: CVI_U8 |
GlobalGain |
Global sharpening weight Value range: [0x0, 0xff] 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 |
OverShootGain |
The magnification of the upper limit of white edge sharpening. (1x = 16) Value range: [0x0, 0x3f] 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 |
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 |
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, 0xff] Data type: CVI_U8 |
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】
20.3.2. ISP_PRESHARPEN_AUTO_ATTR_S¶
【Description】
sharpening attribute automatic parameter
【Syntax】
typedef struct _ISP_PRESHARPEN_AUTO_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]; /*RW; Range:[0x0, 0x3f]*/
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]*/
} ISP_PRESHARPEN_AUTO_ATTR_S;
【Member】
Member |
Description |
---|---|
EdgeGain |
Edge Enhancement parameters The larger the value, the greater the edge sharpening strength Value range: [0x0, 0x3f] 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 |
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 |
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, 0xff] Data type: CVI_U8 |
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】
20.3.3. ISP_PRESHARPEN_ATTR_S¶
【Description】
sharpening attribute parameter
【Syntax】
typedef struct _ISP_PRESHARPEN_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_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_PRESHARPEN_MANUAL_ATTR_S stManual;
ISP_PRESHARPEN_AUTO_ATTR_S stAuto;
} ISP_PRESHARPEN_ATTR_S;
【Member】
Member |
Description |
---|---|
Enable |
Y Sharpen module enabled 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 |
TuningModeLevelShift |
Auxiliary Tuning parameter Gain for TuningMode 1, 2, and 3 Value range: [0x0, 0x8] Data type: CVI_U8 |
FilterCoefByISOFuncEn |
Dynamic filter coefficient enable Value range: [0, 1] Data type: CVI_BOOL |
FilterCoefByISOLowThd |
The lower threshold of the dynamic filter coefficient, below this value, it is preferred to use the directional filter coefficient Value range: [0, 0xffffffff] Data type: CVI_U32 |
FilterCoefByISOHighThd |
The upper threshold of the dynamic filter coefficient, below this value it is preferred to use the undirected filter coefficient Value range: [0, 0xffffffff] Data type: CVI_U32 |
FilterCoefNonDirType |
Dynamic filter coefficient category Value range: [0, 0xff] Data type: CVI_U32 |
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 enabled Value range: [0, 1] Data type: CVI_BOOL |
WdrCoringCompensationEn |
Luminance sharpening noise value compensation is enabled in wdr mode. Value range: [0, 1] Data type: CVI_BOOL |
WdrCoringCompensationMode |
Compensation mode for luminance sharpening noise value in wdr mode. 0: Compensate luminance sharpening noise according to WdrCoringHighThrd and WdrCoringLowthd. 1: Automatically compensate luminance sharpening noise according to DRC tone mapping curve. Value range: [0, 1] Data type: CVI_BOOL |
WdrCoringToleranceLevel |
Tolerance value for luma sharpening noise compensation in wdr mode. The smaller the value, the more obvious the effect of sharpening, but the easier it is to sharpen the noise. The larger the value is, the less likely it is to sharpen the noise, but the sharpening effect is less obvious. Value range: [0x0, 0x1ff] Data type: CVI_U16 |
WdrCoringHighThr |
High threshold for luma sharpening noise wdr mode compensation. Noise compensation is not performed for brightness below this threshold. If the brightness is higher than this critical value, noise compensation will be performed according to the value of WdrCoringToleranceLevel. Brightness between WdrCoringLowThrd and WdrCoringHighThrd is compensated proportionally. Value range: [0x0, 0xff] Data type: CVI_U8 |
WdrCoringLowThr |
Low threshold for luma sharpening noise wdr mode compensation. Noise compensation is not performed for brightness below this threshold. If the brightness is higher than this critical value, noise compensation will be performed according to the value of WdrCoringToleranceLevel. Brightness between WdrCoringLowThrd and WdrCoringHighThrd is compensated proportionally. Value range: [0x0, 0xff] Data type: CVI_U8 |
NoiseSuppressEnable |
Enhanced denoising enabled. For the edge detection image, do pre-processing to strengthen denoising and then do edge enhancement. Value range: [0, 1] Data type: CVI_BOOL |
stManual |
Manual Mode parameter Properties |
stAuto |
Auto Mode parameter Properties |
【Note】
None.
【Related Data Type and Interface】