# High-Brightness Image Enhancement Algorithm
## 3 Proposed Method  
We propose a window algorithm based on tone mapping, which improves the visual effect of the overexposed area in an image by compressing the image's dynamic range and restoring the information in the exposed area. In this section, we introduce our algorithm in detail. First, the input image is linearized, and the RGB channel of the image is reconstructed; this is a simple preprocessing step. Then, a local gamma correction is performed on the image, and the local contrast of the image is further improved by color compression. The image passes through the previously set window frame, including a series of operations such as guided filtering, after which the final image is output. The algorithmic flow chart is shown in Figure 1:  
The algorithm process mainly involves the following steps: (1) image input; (2) channel reconstruction; (3) gamma correction; (4) generating the guidance map \(c\) according to Equation (14); (5) restoring the RGB channels \(l_{k}^{l}\) in the tone mapped result by Equation (12); (6) resulted image output. Figure 1: Algorithmic structure of the proposed method. The first step of linearizing the image is crucial. The main reason for operating on the image in linear space is that this provides greater control and predictability regarding the brightness and color domain expansion. In an unknown area, it is difficult to predict how the expansion process will behave. In addition, to recover the scene attributes, such as the mean, geometric average, and standard deviation, we need to estimate the radiance of the scene accurately. For an input image \(I^{l}=f\Big{(}I^{h}\Big{)}\), \(I^{h}\) is the radiance map of the image. \(f(\cdot)\) represents the operator. \(I^{l}\) represents the radiance map of the image after the operation is completed. In short, the core idea of our algorithm is to increase smaller amplitudes and decrease larger amplitudes, this processing step should be conducted in a small area to meet the requirements of amplitude mapping in each pixel neighborhood. The linear function of window \(w_{i}\), centered on pixel \(i\) is expressed as follows:  
\[I^{l}(j)=m_{i}I^{h}(j)+n_{i,j}\in w_{i} \tag{1}\]  
Formula (1) is a complete representation satisfying local constraints. The coefficients \(m\) and \(n\) directly affect the local contrast, and \(m\) represents the slope of the linear function. When \(m>1\), the local contrast is enhanced so that the dark areas in the image are brightened; when \(0<m<1\), the high-brightness areas in the image are improved. In the overlapping windows with multiple pixels, similar smoothing constraints are enforced in the neighborhood of the center pixel in the smooth area. The contrast is maintained reasonably in the area with abrupt amplitude changes, so there is no need to add constraints. The defined local linear equation is applied to the window \(w_{i}\), and the image is processed by minimizing the solution:  
\[\sum_{i}\sum_{j\in w_{i}}\Big{[}I^{l}(j)-m_{i}I^{h}(j)-n_{i}\Big{]}^{2} \tag{2}\]  
Because of the existence of a trivial solution, we need to add a constraint term to the above formula to make the minimization Formula (2) feasible. According to Formula (1), the coefficient m directly affects the local contrast of the image. We propose guiding its value in each small window to reduce the global contrast while maintaining the image's information. We support the final objective function as follows:  
\[f=\sum_{i}\Bigg{\{}\sum_{j\in w_{i}}\Big{[}I^{l}(j)-m_{i}I^{h}(j)-n_{i}\Big{]} ^{2}+\varepsilon c_{i}^{-2}(m_{i}-c_{i})^{2}\Bigg{\}} \tag{3}\]  
where \(c_{i}\) is the default positive number, which is used to guide the processing of the local contrast. The collective \(c_{i}\) in the image space form the guidance map. By setting an appropriate value for this map, the contrast of the local area can be adjusted correctly (weakening the strong-contrast areas and enhancing the low-contrast areas). The term \(\varepsilon c_{i}^{-2}(m_{i}-c_{i})^{2}\) is the squared relative error from the guidance map.