# Joint Luminance Adjustment and Color Correction for Low-Light Image Enhancement Network
## 3 Method
### Loss Functions  
In image quality enhancement, content loss and perceptual loss are the most commonly used loss functions. Content loss focuses on the similarity between the corresponding pixels in the two images, and perceived loss focuses on the semantic similarity of features. Both of these loss functions constrain the overall content of the image. However, many existing low-light enhancement methods often generate enhanced images with issues such as color distortion and weak contrast. Color features are volatile visual features that are easily affected by lighting changes. Inspired by the theory of color constancy, eliminating the influence of lighting on image color and obtaining color attributes on object surfaces that are independent of lighting can provide computer vision systems with a perception function of color constancy similar to that of human vision systems. This article designs a color loss function that helps automatically adjust the image's contrast to the optimal state while performing color correction. Specifically, we extract color-related features from the image, including color and lighting, to form a 14-dimensional feature vector. The color moment feature can globally reflect the color distribution of images. Compared with the commonly used color histogram, it does not need to quantify the color and has the advantage of being simple and effective. The first-order moment of the image color distribution is the mean, which reflects the overall sensitivity of the image. The larger the value, the brighter the image. The second-order moment is the standard deviation, which reflects the color distribution range of the image. The larger the value, the more comprehensive the color distribution range. The third moment is the deviation, which is the cube root of the center distance, reflecting the deviation of the image color distribution. In the RGB color space, the calculation formulas of the color moments of an image are presented in Equations (2)-(4):  
\[\mu_{i}=\frac{1}{N}\sum_{j=1}^{N}p_{i,j} \tag{2}\]  
\[\sigma_{i}=(\frac{1}{N}\sum_{j=1}^{N}(p_{i,j}-\mu_{i})^{2})^{\frac{1}{2}} \tag{3}\]  
\[s_{i}=(\frac{1}{N}\sum_{j=1}^{N}(p_{i,j}-\mu_{i})^{3})^{\frac{1}{3}}, \tag{4}\]  
where \(p_{i,j}\) represents the \(i\)-th color component of the \(j\)-th pixel of the color image, and \(N\) represents the number of pixels in the image. Color cast indices can more accurately reflect the distribution characteristics of image colors. The calculation should be performed in a color space with independent luminance and chrominance components. We chose to perform the calculation in the RLAB color space. First, calculate the mean \(\mu_{a}\), \(\mu_{bR}\) and variance \(\sigma_{a^{R}}^{2}\), \(\sigma_{pk}^{2}\) of the two image color components \(a^{R}\) and \(b^{R}\) in the RLAB color space. Then, calculate the three color cast indices \(\sigma\), \(D\), and \(D_{\sigma}\) separately:  
\[\sigma=\sqrt{\sigma_{a^{R}}^{2}+\sigma_{b^{R}}^{2}} \tag{5}\]  
\[D=|\mu-\sigma| \tag{6}\]  
\[D_{\sigma}=\frac{D}{\sigma}, \tag{7}\]where \(\mu=\sqrt{\mu_{a^{R}}^{2}+\mu_{b^{R}}^{2}}\). Chroma reflects the depth of color and corresponds to a component of the RLAB color space in cylindrical coordinates. The higher the chroma value, the more intense the color. The average chroma is calculated as in Equation (8):  
\[\mu_{c^{R}}=\frac{1}{N}\sum_{x,y}c^{R}(x,y), \tag{8}\]  
where \(c^{R}=\sqrt{(a^{R})^{2}+(b^{R})^{2}}\). The average lighting value reflects the overall brightness of the image. We choose to calculate the illumination average from the RLAB perceived color space, taking the average of its illumination component \(L^{R}\) as in Equation (9):  
\[\mu_{L^{R}}=\frac{1}{N}\sum_{x,y}L^{R}(x,y). \tag{9}\]  
Then, we denote the concatenation of these 14-dimensional color-related features as \(C\), which is the guide feature for color loss.