注意:这篇文章上次更新于2029天前,文章内容可能已经过时。
This article was last updated2029 days ago, the content may be outdated.
这也许是我复现的所有论文中效果最好的了吧这也许是我见过最好用的低照度图片了吧🦄

This is probably the best result I’ve reproduced from all the papersThis is probably the best low-light image enhancement I’ve ever seen🦄

开始之前,背景音乐先安排上。
Before we start, let’s get some background music going.
这篇博客介绍一下论文中的方法,目的不是让除了我以外的人能看懂,因为我也做不到让别人能读懂😓,大概就算是阅读笔记吧。欲知方法细节,查看论文原文.
方法简介
流程图

算法共分为以下几个步骤:
- 提取 Y 通道。
- 根据 Y 通道图的直方图分布情况分别求出两个 ,使其分别有效作用于暗区和亮区域。
- 使用 DoG 函数对伽马校正结果图进行局部对比度增强。
- 对增强结果进行自适应的线性加权融合。
- 利用 Y 通道的融合结果对图像进行色彩校正得到最终的结果图。
提取 Y 通道
对 Y 通道进行对数归一化:
其中:
自适应伽马校正
首先,以 0.5 为阈值将对数归一化后的 Y 通道分为亮区域和暗区域两个部分,即大于 0.5 的像素值被划分在亮区域,小于或等于 0.5 的像素被划分在暗区域。
分别根据亮区域和暗区域的标准差来计算 期望中位数,再通过全局搜索的方式寻找两个 使得经过伽马校正后的图像最接近期望中位数。
以下为暗区和亮区期望中位数的计算方法:
其中:L 下标表示暗区;H 下标表示亮区。
两个 的全局搜索方法如下:
其中: 是中位数算子。 表示的是 的像素值。
分别使用以上两个 对输入图像进行伽马校正,得到亮区结果和暗区结果。
局部对比度增强
使用 DoG 模型分别作用于亮区校正结果图和暗区校正结果图,实现图像的对比度增强。具体方法为:
自适应融合
这里使用一种依赖于亮度的自适应线性加权融合方法。
其权重的计算方式为:
此处设置 。
融合方法为:
另外,此处对输出结果进行了一步线性归一化操作。
自适应的色彩恢复
此处依然是一种亮度依赖的自适应方法。
This blog post introduces the method in the paper. The purpose is not to make it understandable to anyone but me, because I can’t make others understand it anyway😓. It’s basically reading notes. For method details, see the original paper.
Method Overview
Flowchart

The algorithm consists of the following steps:
- Extract the Y channel.
- Based on the histogram distribution of the Y channel image, compute two values respectively, making them work effectively on the dark and bright regions.
- Use the DoG function for local contrast enhancement on the gamma-corrected result image.
- Perform adaptive linear weighted fusion on the enhanced results.
- Use the fused result of the Y channel for color correction to obtain the final result image.
Extracting the Y Channel
Log-normalize the Y channel:
where:
Adaptive Gamma Correction
First, using 0.5 as the threshold, the log-normalized Y channel is divided into two parts: the bright region and the dark region. Pixels greater than 0.5 are classified into the bright region, and pixels less than or equal to 0.5 are classified into the dark region.
The expected median is computed from the standard deviations of the bright and dark regions respectively, and then two values are found by global search so that the gamma-corrected image is closest to the expected median.
The expected medians for the dark and bright regions are computed as follows:
where the subscript L denotes the dark region and the subscript H denotes the bright region.
The global search for the two values is as follows:
where is the median operator, and denotes the pixel values with .
Use the two values above to apply gamma correction to the input image, obtaining the bright-region result and the dark-region result.
Local Contrast Enhancement
Apply the DoG model to both the bright-region corrected result image and the dark-region corrected result image to enhance image contrast. Specifically:
Adaptive Fusion
Here, an adaptive linear weighted fusion method that depends on brightness is used.
The weight is computed as follows:
Here is set.
The fusion method is:
In addition, a linear normalization step is applied to the output here.
Adaptive Color Restoration
This is again a brightness-dependent adaptive method.
Matlab Implementation
Partitioning
The partitioning operation only needs to record the values of the bright and dark pixels, so the image is traversed and each pixel is judged: if it is greater than 0.5, it is added to the bright array; otherwise, it is added to the dark array.
1 | function [Ld,Lb] = fen_qu(Lin) |
The DoG Operator
The DoG operator is actually the difference of two Gaussian functions, so a 2D Gaussian function is implemented first.
A 2D Gaussian function can also be implemented with the built-in Matlab function fspecial.
1 | function gaussFun = GaussFun2D(hsize) |
DoG 算子的实现如下:
The implementation of the DoG operator is as follows:
1 | function outImg = DoG(Img,rr_RF,rr_IF,m_qA1,m_qA2,antImg) |
1 | function [outputs] = Normalization(arg) |
Other Operations
Finally, the remaining operations are written in the main function; see the code comments for details.
1 | function outputs = main(input) |

















