## 2 Methods
### Scratch Defect Capture on Textured Material Surface Based on Optimized Photometric Stereo Vision
Given that the photometric stereo algorithm adopted herein necessitates binarized grayscale processing for acquired images, we carried out preliminary investigations, leading us to conclude that the impact of light color temperature on image quality can be largely disregarded. According to the principles of photometric stereo algorithms, at least three images from different lighting angles need to be captured. Our analysis, as illustrated in Figure 4, elucidates the influence of varying numbers of light sources on image quality. We have presented the Albedo images synthesized using the photometric stereo algorithm under different numbers of light sources, along with the Computational Time and the Detection Area Rate of scratches that can be observed. To better illustrate the impact of varying numbers of light sources on image quality, we introduced 3D Illuminated Grayscale Images to evaluate the uniformity of surface illumination. A gradual shift towards bluer colors in the images indicates lower heights, aiding in distinguishing scratches from background textures. A reduced number of light sources markedly expedites computational processes; however, this comes at the cost of uneven illumination, which may obscure certain scratch areas, thereby compromising the quality of the synthesized images. Conversely, augmenting the number of light sources offers enhanced cues for accurate reconstruction, albeit at the expense of decreased computational efficiency. In pursuit of an equilibrium between image quality and computational time, while concurrently striving to mitigate the uneven illumination issues inherent to photometric stereo lighting, this paper has judiciously selected eight light sources positioned at angles of \(0^{\circ}\), \(45^{\circ}\), \(90^{\circ}\), \(135^{\circ}\), \(180^{\circ}\), \(-135^{\circ}\), \(-90^{\circ}\), and \(-45^{\circ}\). These sources are sequentially activated in strict accordance with their angular arrangement via the computer interface, thereby ensuring consistent and uniform lighting across every image captured. Figure 3: Light-source-selective image acquisition device based on photometric stereo vision: (**A**) presents the principle of photometric stereo vision, and (**B**) presents the principle of application based on photometric stereo vision. Owing to the stringent alignment of the design configuration, the locations of both the camera and the point light source remain stationary, enabling the acquisition of quantifiable angular data. An 8-light source, arranged in a circular pattern with a 45\({}^{\circ}\) angular spread, was selected for illumination. Drawing upon the principles of photometric stereo vision, for a pixel residing at any given point on the material's surface, we can deduce the lighting conditions resulting from the eight distinct angles of incidence. \[ \begin{cases}I_{1}=\rho L_{1}N\\ I_{2}=\rho L_{2}N\\ I_{3}=\rho L_{3}N\\...\\ I_{8}=\rho L_{8}N\end{cases}  \tag{1}\]  
Each of these angles contributes unique information about the surface properties, facilitating the reconstruction of surface normal and, by extension, the topography of the material under scrutiny. This composite-enhanced method allows for the precise determination of surface characteristics, essential for the detection and analysis of subtle defects or variations in texture. \(I\) represents the intensity of the measured pixel; \(N\) denotes the unit normal vector of the measured pixel point; \(\rho\) denotes the diffuse reflectance value of the material surface; and \(L_{I}\) denotes the unit direction vector of the point light source in the 3D direction, which can be expressed as \(L_{1}=L_{X}^{1},L_{Y}^{1},L_{Z}^{1}\). Equation (1) can be written as  
\[ \begin{bmatrix}I_{1}\\ I_{2}\\ I_{3}\\...\\ I_{8}\end{bmatrix} =\rho \begin{bmatrix}L_{X}^{1},L_{Y}^{1},L_{Z}^{1}\\ L_{X}^{2},L_{Y}^{2},L_{Z}^{2}\\ L_{X}^{3},L_{Y}^{1},L_{Z}^{2}\\...\\ L_{X}^{8},L_{Y}^{8},L_{Z}^{8}\end{bmatrix}\begin{bmatrix}N_{X}\\ N_{Y}\\ N_{Z}\end{bmatrix}