# Highlight Removal Emphasizing Detail Restoration
## 3 Method of This Article
### Detail Restoration  
After improving the method in this paper to repair highlight regions, there was often a severe loss of details in these areas. This had a significant impact on weld seam detection. Therefore, the paper introduces global detail and minor detail restoration. Firstly, in the HSV color space, the V channel of the repaired image is decomposed using guided filtering [29] (\(V=V_{s}+V_{t}\)). Subsequently, based on the texture layer \(V_{t}\), weight parameters are applied to the structural layer \(V_{s}\) for global detail enhancement to correct global detail issues. The paper improves the Laplacian global image enhancement operator, refining image sharpness to enhance the overall detail information and achieve global detail enhancement. The formula is as follows:  
\[ \begin{array}{l}\frac{\partial^{2}V_{s}(x,y)}{\partial x^{2}}=\left[\gamma (V_{s}(x+1,y)-2V_{s}(x,y)+V_{s}(x-1,y))\right]^{\Gamma}\\ \frac{\partial^{2}V_{s}(x,y)}{\partial y^{2}}=\left[\gamma(V_{s}(x,y+1)-2V_{s }(x,y)+V_{s}(x,y-1))\right]^{\Gamma}\end{array}  \tag{9}\]  
In the above formula, \(V_{s}(x,y)\) represents the position of the image's structural layer at the corresponding pixel. \(\gamma\) and \(\Lambda\) are two adjustable parameters with default values of 0.1 and 0.75, where the parameter \(\gamma\) can better control sharpness, and \(\Lambda\) can better restore the brightness of edges. In the final Laplacian operator, this paper introduces a weight \(\Lambda\) to control visual sharpness (this parameter requires \(\Lambda>1\)), and the higher the value of \(\Lambda\), the clearer the result. The final formula is as follows:  
\[\
abla^{2}V_{s}(x,y)=\Lambda[\frac{\partial^{2}V_{s}(x,y)}{\partial x^{2}}+ \frac{\partial^{2}V_{s}(x,y)}{\partial y^{2}}] \tag{10}\]  
To adapt to images in different scenes, this paper proposes an adaptive weight \(\Lambda\) to meet the sharpening effects of various scene images. The formula is as follows, where \(V_{t}(x,y)\) represents the position of the image's texture layer at the corresponding pixel:  
\[\Lambda=\frac{20}{1+\exp^{(-0.1\cdot V_{t}(x,y))}} \tag{11}\]  
After applying global optimization, there were still missing details in the highlight removal area. Therefore, this paper uses the method of maximum gradient fusion [30] to restore the tiny details of the image. In this paper, the horizontal gradient \(G_{x}\) is obtained through convolution, and its formula is \(G_{x}=S_{x}\otimes V\), where \(\otimes\) represents convolution, \(V\) represents the target image, and \(S_{x}\) represents the Sobel operator. Similarly, using the transpose of \(S_{x}\), the paper calculates the vertical gradient \(G_{y}\) with the specific formula \(G_{y}=S_{y}\otimes V\), where \(S_{y}=S_{y}T\). After obtaining the magnitudes of horizontal and vertical gradients, the image gradient can be defined as:  
\[T(x,y)=\sqrt{G_{x}(x,y)^{2}+G_{y}(x,y)^{2}} \tag{12}\]  
Figure 3: Performance metrics before and after compensation. where \(G_{x}(x,y)\) and \(G_{y}(x,y)\) are the positions of the pixels in the horizontal and vertical gradient maps, respectively. Through the above equations, the gradient information of the original image and the image detected and repaired in the previous section can be obtained separately. The visibility of the image details is closely related to the magnitude of gradients, so this paper extracts the maximum gradient value \(G_{\text{max}}(x,y)\) from each image.