Skip to content

CLAHE 改编

来源:https://cloud.tencent.com/developer/article/1011944

链接的文章对 CLAHE 有以下改进:

1. 子块直方图和全局直方图融合:

做子块直方图之后,加一步:

# HistB 是子块直方图,HistgramB 是全局直方图;L 是 RGB 转的亮度
HistB[Index] = (HistB[Index] * Adaptation + (100 - Adaptation) * HistgramB[Index]) / 100;
HistG[Index] = (HistG[Index] * Adaptation + (100 - Adaptation) * HistgramG[Index]) / 100;
HistR[Index] = (HistR[Index] * Adaptation + (100 - Adaptation) * HistgramR[Index]) / 100;
HistL[Index] = (HistL[Index] * Adaptation + (100 - Adaptation) * HistgramL[Index]) / 100;

其中 Adaptation 为融合因子,其有效范围为[0,100],当取值越小时,全局直方图其主导作用,效果越接近普通的直方图均衡。

2. 如果是彩色图像,可以单独做也可以一起做,链接的文章是这样改进的:

HistB[Index] = (HistB[Index] * Correction + (100 - Correction) * HistL[Index]) / 100;
HistG[Index] = (HistG[Index] * Correction + (100 - Correction) * HistL[Index]) / 100;
HistR[Index] = (HistR[Index] * Correction + (100 - Correction) * HistL[Index]) / 100;

其中 Correction 为颜色校正因子,其有效范围为[0,100],当取值越大时,各通道之间越独立,效果越接近普通的直方图均衡。

Comments