---
title: hi_isp_local_cac_attr
description: "紫边检测校正属性。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/others/ispdevug/ispdevapi_0316.html
sourcePath: /source/zh/canncommercial/900/others/ispdevug/ispdevapi_0316.html
indexId: fdf2ad64c6e613a7c0bd368fc9ba0d8585b494ed660865bc14d5a8588b3784d765
---
# hi_isp_local_cac_attr

#### 说明

紫边检测校正属性。


#### 定义

```
typedef struct {
hi_bool
enable;
hi_u16
purple_detect_range;
hi_u16
var_threshold;
hi_u16
r_detect_threshold[HI_ISP_LCAC_DET_NUM];
hi_u16
g_detect_threshold[HI_ISP_LCAC_DET_NUM];
hi_u16
b_detect_threshold[HI_ISP_LCAC_DET_NUM];
hi_u16
luma_detect_threshold[HI_ISP_LCAC_DET_NUM];
hi_s16
cb_cr_ratio[HI_ISP_LCAC_DET_NUM];
hi_op_mode
op_type;
hi_isp_depurplestr_manual_attr
manual_attr;
hi_isp_depurplestr_auto_attr
auto_attr;
} hi_isp_local_cac_attr;
```


#### 成员

| 成员名称 | 描述 |
| --- | --- |
| enable | 紫边校正使能。 取值范围：HI\_FALSE：禁止；HI\_TRUE：使能。 |
| purple\_detect\_range | 紫色检测的范围，该值控制的是r\_detect\_threshold，g\_detect\_threshold，b\_detect\_threshold，Iuma\_detect\_threshold，cb\_cr\_ratio这几个参数的生效情况。值越大，越多非高亮区域的紫色被界定为紫边区域。 purple\_detect\_range可能会引入紫边去除不平滑的问题，可以检查r\_detect\_threshold，g\_detect\_threshold， b\_detect\_threshold，Iuma\_detect\_threshold，cb\_cr\_ratio这几个参数的配置。 取值范围：[0,410]。 |
| var\_threshold | 边缘检测阈值。 取值范围：[0, 4095]。 |
| r\_detect\_threshold[HI\_ISP\_LCAC\_DET\_NUM] | 它分了3段，每一段的值表示高亮检测模块里面R分量阈值。 实际中生效的值取决于purple\_detect\_range这个参数的大小。purple\_detect\_range越小，越倾向于r\_detect\_threshold第一段的值，purple\_detect\_range越大，越倾向于r\_detect\_threshold第3段的值。 取值范围：[0, 4095]。 \#define HI\_ISP\_LCAC\_DET\_NUM 3 |
| g\_detect\_threshold[HI\_ISP\_LCAC\_DET\_NUM] | 它分了3段，每一段的值表示高亮检测模块里面G分量阈值。 实际中生效的值取决于purple\_detect\_range这个参数的大小。purple\_detect\_range越小，越倾向于g\_detect\_threshold第一段的值，purple\_detect\_range越大，越倾向于g\_detect\_threshold第3段的值。 取值范围：[0, 4095]。 |
| b\_detect\_threshold[HI\_ISP\_LCAC\_DET\_NUM] | 它分了 3 段，每一段的值表示高亮检测模块里面B分量阈值。 实际中生效的值取决于purple\_detect\_range这个参数的大小。purple\_detect\_range越小，越倾向于b\_detect\_threshold第一段的值，purple\_detect\_range越大，越倾向于b\_detect\_threshold第3段的值。 取值范围：[0, 4095]。 |
| luma\_detect\_threshold[HI\_ISP\_LCAC\_DET\_NUM] | 它分了3段，每一段的值表示高亮检测模块里面Luma分量阈值。实际中生效的值取决于purple\_detect\_range这个参数的大小。purple\_detect\_range越小，越倾向于luma\_detect\_threshold第一段的值，purple\_detect\_range越大，越倾向于luma\_detect\_threshold第3段的值。 取值范围：[0, 4095] |
| cb\_cr\_ratio[HI\_ISP\_LCAC\_DET\_NUM] | 它分了3段，每一段的值表示紫色检测模块蓝色程度。实际中生效的值取决于purple\_detect\_range这个参数的大小。 purple\_detect\_range越小，越倾向于cb\_cr\_ratio第一段的值，purple\_detect\_range越大，越倾向于cb\_cr\_ratio第3段的值。 取值范围：[\-2048, 2047]。 |
| op\_type | 紫边校正工作模式。 HI\_OP\_MODE\_AUTO：自动 ； HI\_OP\_MODE\_MANUAL：手动。 |
| manual\_attr | 手动模式下配置紫边校正强度参数。 |
| auto\_attr | 自动模式下配置紫边校正强度参数。 |


#### 注意事项

- 由于算法设计，LocalCAC矫正强度会受到Demosaic结果影响。因此将LocalCAC强度设为最小时依然会保留一定去紫边能力，对高光处紫边表现有一定影响。如果想完全关闭LocalCAC效果需直接将使能开关enable置为HI_FALSE。

- 在紫边很宽的时候，若cb_cr_ratio的值未达到完全检测出紫边，会导致部分紫边去除，部分紫边残留而形成锯齿。
- 有一些紫边比较严重的场景，R或者B容易出现饱和的情况，这时，b_detect_threshold或者r_detect_threshold在最大值附近有去除紫边不平滑的现象。需要跟de_purple_cr_str和de_purple_cb_str联合调整。
