# Detection of Logos of Moving Vehicles under Complex Lighting Conditions
## 3 Methodology
### Adaptive Image Enhancement  
This study proposed an adaptive gamma correction method, which can adaptively process logo images at different illumination levels [34]. Firstly, images are converted to HSV color space; then, the V channel is handled by adaptive gamma processing to adjust the image brightness; and finally, the images are converted to RGB color space for subsequent detection. The image intensity transformation function for image processing used in adaptive gamma correction is as follows (Equation (1)):  
\[S=kR^{\gamma} \tag{1}\]  
where \(s\) is the intensity of the output image, \(R\) is the intensity of the input image, \(\gamma\) is the parameter controlling the input-output curve, and \(k\) is the correction coefficient.  
\[I_{cls}=\left\{\begin{array}{l}I_{L},4\sigma\leqslant p\\ I_{H},others\end{array}\right. \tag{2}\]  
The standard deviation of the image reflects the dispersion degree of the pixel value and mean value. The larger the standard deviation is, the better the image quality is. Equation (2), \(\sigma\) is the standard deviation of an image, and \(p\) is the contrast coefficient. \(I_{L}\) refers to images with low contrast, while \(I_{H}\) refers to images with medium and high contrast. According to the experimental results, \(p=0.25\) can be used as the criterion for classifying images with different contrast.  
The intensity mean of the image reflects the brightness of the image. The larger the mean value is, the higher the brightness of the image is. In this paper, the intensity mean of the image is represented by \(\lambda\). Multiple experiments found that when the intensity mean of the image is less than 0.5, the brightness is low, and when it is greater than or equal to 0.5, the brightness is high. Therefore, in this paper, \(\lambda=0.5\) is the threshold to distinguish the brightness of the image. The final image classification category is shown in Table 1.  
For the value of coefficient \(k\), different \(k\) values are used for images with different contrast (Equation (3)):  
\[k=\left\{\begin{array}{l}\frac{1}{1+(R_{\gamma}+(1-R_{\gamma})\times\lambda \gamma)},0.5-\lambda>1\\ 1\hskip 28.452756 pt,\hskip 28.452756 pt0.5-\lambda\leqslant 0\end{array}\right. \tag{3}\]  
Images in Category \(I_{L}\) have a smaller \(\sigma\) value, and most pixels in the image have similar intensity and cluster in a small pixel range. For such images, it is necessary to expand the pixel distribution to a larger range to improve the contrast. In Gamma correction, the larger the \(\gamma\) value is, the higher the image intensity and contrast is. Images in Category \(I_{H}\) have a larger \(\sigma\) value, and the pixel value is in the dispersed distribution in a dynamic range. Instead of enhancing the contrast, it is more important to adjust the brightness. The slope of the input-output curve is controlled by the \(\gamma\) value. The larger the \(\gamma\) value is, the higher the image contrast is. For the adaptive Gamma correction proposed in this paper, the following formula is used to calculate the \(\gamma\) value for images in Category \(I_{L}\) and \(I_{H}\) (Equation (4)):  
\[\gamma=\left\{\begin{array}{l}-\log 2(\sigma),\ I_{L}\\ e^{\frac{1-(k+\sigma)}{2}},\ I_{H}\end{array}\right. \tag{4}\]