# GS-AGC: An Adaptive Glare Suppression Algorithm Based on Regional Brightness Perception
## 3 An Adaptive Glare Suppression ALGORITHM Based on Regional Brightness Perception
### Gs-Agc
The luminance region division was based on Igray to carry out, on the overall gray range [0, 255] of the image, the gray value 0, 255, and the four luminance thresholds, \(\tau_{t1},\tau_{t2},\tau_{t3},\tau_{t4}\), will directly divide the image grayscale into four regions, which are the luminance region of the image I. They included the dark light region (T\({}_{0}\), \(\left(\frac{T_{0}+\tau_{t1}}{2}\right)\)), the halo region(\(\left(\frac{\tau_{t2}+\tau_{t3}}{2}\right)\), \(\tau_{t4}\)), and the glare region (\(\left(\frac{\tau_{t3}+\tau_{t28}}{2}\right)\), T\({}_{255}\)), respectively, and the other regions excluding the dark light, halo, and glare regions(\(\left(\frac{T_{0}+\tau_{t1}}{2}\right)\), \(\left(\frac{\tau_{t2}+\tau_{t3}}{2}\right)\)), (\(\tau_{t4}\),\(\left(\frac{\tau_{t4}+T_{255}}{2}\right)\)). To enhance the visual effect of low-illumination images with a narrow grayscale range, a nonlinear grayscale transformation was performed. This was necessary due to the limited visual distinction and high spatial correlation among adjacent pixels in such images. By adjusting the grayscale values, the image's brightness range was expanded within a range more suitable for human eye observation. This process involved the following pixel-level operations:  
\[G_{halo}=\left[\log\left(\frac{\tau_{t2}+\tau_{t3}}{2}\right)/\log\tau_{t4} \right]^{R_{3}} \tag{8}\]  
where \(R_{1}=2\), \(\tau_{t1}\) is a dark light region threshold parameter, \(\tau_{t2}\) is a medium-bright scene threshold parameter, \(\tau_{t3}\) is a bright scene threshold parameter, T\({}_{0}\) is a gray-level value of 0, and its dark light enhancement function \(G_{\text{dark}}\) indicates that the gray scale image pixels are stretched from the dark light region \(\log\left(\frac{T_{0}+\tau_{t1}}{2}\right)\) by stretching a narrow gray range to the medium-bright scene \(\log\left(\frac{\tau_{t2}+\tau_{t3}}{2}\right)\), and that all the corresponding Gamma values between the \(G_{\text{dark}}\) regions (T\({}_{0}\),\(\left(\frac{T_{0}+\tau_{t1}}{2}\right)\)) are less than 1. In the image visual region in addition to focusing on the dark light region part, the high gray value of the region also needs to inhibit the halo, so that the brightness of the image is maintained in the same range, retaining the image with more information on the halo region for the processing:  
\[G_{halo}=\left[\log\left(\frac{\tau_{t2}+\tau_{t3}}{2}\right)/\log\tau_{t4} \right]^{R_{3}} \tag{9}\]  
wherein \(R_{3}=3\), \(\tau_{t4}\) is a highlight scene threshold parameter whose halo suppression \(G_{\text{halo}}\) function indicates that the gray scale image pixels are lowered from the highlight scene \(\log\tau_{t4}\) to the mid-brightness scene \(\log\left(\frac{\tau_{t2}+\tau_{t3}}{2}\right)\), and the high gray scale values are corrected by the \(G_{\text{halo}}\) function to make the corresponding Gamma value of the region between the highlight scene threshold parameter and the mid-brightness scene threshold parameter \(\left(\left(\frac{\tau_{t2}+\tau_{t3}}{2}\right),\tau_{t4}\right)\) both greater than 1. Uneven distribution of brightness in images is primarily caused by glare, a phenomenon that occurs in various forms and can be complex in real-life scenarios. Glare imposes a tremendous level of visual burden due to the significant increase in brightness, making glare inhibition a core issue for us to solve. Therefore, it is particularly important to consider the size and number of gray values that span the pixel values of the glare region.