Printed part defect detection method and system based on machine vision
By constructing a multi-scale gradient pyramid and adaptive binarization processing, combining texture feature extraction and laser engraving compensation path generation, the accuracy problem of machine vision detection under complex surfaces and diverse defect types is solved, and precise positioning and efficient repair of printing defects is achieved.
Patent Information
- Application Number
- CN202510821173.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-06-19
AI Technical Summary
The existing machine vision detection technology has insufficient detection accuracy under complex surfaces and diverse defect types, making it difficult to adaptively process multi-scale image features, and lacks effective descriptions of blurred edges and complex texture defect areas, affecting the precise identification and repair of printing defects.
By constructing a multi-scale gradient pyramid, calculating the mutual information value of the gradient direction histogram, determining the optimal detection scale, performing defect area segmentation and adaptive binarization processing, extracting defect edge contour points, combining texture feature extraction and classification, generating a laser carving compensation path point sequence to realize three-dimensional compensation processing.
It improves the accuracy and robustness of printing defect detection, realizes the precise positioning and classification of surface printing defects of automobile parts, improves the quality of defect repair, and reduces product defect rate.
Smart Images

Figure CN120334236B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to machine vision technology, and in particular to a method and system for detecting defects in printed parts based on machine vision. Background Art
[0002] As the automotive manufacturing industry continues to increase its requirements for part surface quality, the detection and repair of printing defects has become a critical process. Existing manual inspection methods suffer from low efficiency and poor consistency. While automated inspection technology based on machine vision has been applied, its accuracy in detecting complex surfaces and diverse defect types still needs to be improved.
[0003] Currently, machine vision inspection primarily relies on single-scale image processing and fixed-threshold defect segmentation methods, making them incapable of adapting to printing defects of varying sizes and shapes. Furthermore, traditional defect feature extraction methods are ineffective in identifying defect areas with blurred edges and complex textures, and lack an effective description of the spatial distribution of defects, impacting the accuracy of subsequent repair processes.
[0004] Therefore, there is an urgent need for a printed part defect detection method that can adaptively process multi-scale image features, accurately extract defect edge contours, accurately identify defect types and generate compensation processing trajectories. Summary of the Invention
[0005] The embodiments of the present invention provide a method and system for detecting defects in printed parts based on machine vision, which can solve the problems in the prior art.
[0006] According to a first aspect of an embodiment of the present invention, a method for detecting defects in printed parts based on machine vision is provided, comprising:
[0007] The original image of the printed area on the surface of the automotive part to be inspected is collected by an industrial camera and image enhancement processing is performed to obtain an enhanced inspection image;
[0008] A multi-scale gradient pyramid is constructed for the enhanced detection image. The gradient direction histogram at each scale is extracted. The mutual information value of the gradient direction histograms between adjacent scales is calculated to determine the optimal detection scale. The defect area is segmented at the optimal detection scale to obtain candidate defect areas.
[0009] Adaptively binarize the candidate defect areas, extract the defect edge contour points, calculate the curvature values of the defect edge contour points, and use the contour points with curvature values greater than the preset curvature threshold as key points. Based on the spatial distribution characteristics of the key points, the defect shape is identified to obtain the defect area. The texture features of the defect area are extracted and classified to obtain the defect type.
[0010] Based on the key point distribution of the defect area, the coordinates of the defect center of gravity are calculated as the origin, and a polar coordinate system is established. The angle-radius distribution of the defect boundary curve is calculated. According to the surface curvature characteristics of the automotive part, a laser engraving compensation path point sequence is generated, and the laser engraving compensation depth parameter is set according to the defect type. The laser engraving compensation path point sequence and the laser engraving compensation depth parameter are combined to generate three-dimensional compensation trajectory data, and layered compensation processing is performed on the printing defects on the surface of automotive parts.
[0011] In an optional embodiment,
[0012] A multi-scale gradient pyramid is constructed for the enhanced detection image. The gradient direction histogram at each scale is extracted. The mutual information value of the gradient direction histograms between adjacent scales is calculated to determine the optimal detection scale. The defect area is segmented at the optimal detection scale. The candidate defect areas obtained include:
[0013] The enhanced detection image is decomposed into multiple scales, and the image is convolved with a variable-scale Gaussian kernel function. The Gaussian kernel parameters are dynamically adjusted based on the inter-layer gradient consistency of the convolution result to construct a multi-scale gradient pyramid.
[0014] Calculating the horizontal gradient and vertical gradient of a pixel point at each scale layer of the multi-scale gradient pyramid, determining the gradient magnitude and direction, dividing the gradient direction space into a plurality of intervals, and counting the number of gradient points in each interval to construct a gradient direction histogram;
[0015] Constructing a joint probability distribution matrix, normalizing the joint probability distribution matrix, calculating the mutual information value of the gradient direction histogram of adjacent scale layers based on the normalized joint probability, analyzing the trend curve of the mutual information value changing with scale, extracting the location of the mutation point of the trend curve, and determining the scale layer with the largest mutual information mutation as the optimal detection scale;
[0016] On the image layer corresponding to the optimal detection scale, the local gradient amplitude of the image pixel points is calculated, and the pixel points with gradient amplitude greater than the preset gradient threshold are used as seed points. A local detection window is constructed with the seed points as the center, and the gradient covariance matrix within the local detection window is calculated. The growth threshold is determined, and regional growth is performed on the seed points according to the growth threshold to obtain the candidate defect area.
[0017] In an optional embodiment,
[0018] Analyze the trend curve of mutual information value changing with scale, extract the mutation point position of the trend curve, and determine the scale layer with the largest mutual information mutation as the optimal detection scale.
[0019] Constructing a trend curve of mutual information value varying with scale, constructing a structure tensor for the local structure of the trend curve, adaptively determining a weight coefficient based on the eigenvalue distribution of the structure tensor, and performing nonlinear local weighting on the trend curve to obtain an enhanced trend curve;
[0020] The normalized difference of the enhanced trend curve at adjacent scale layers is calculated, and an adaptive threshold is constructed based on the local gradient density distribution. The mutation characteristics of the trend curve are extracted based on the adaptive threshold. At the same time, the enhanced trend curve is subjected to wavelet decomposition to extract the curvature coefficient at different scales. A mutation point detection operator is constructed based on the multi-scale response of the curvature coefficient.
[0021] Adaptively fusing the mutation feature with a mutation point detection operator to construct a mutation point evaluation function, analyzing the time-frequency characteristics of the mutation point evaluation function, extracting the main frequency component of the feature response, determining a set of candidate mutation points of a trend curve based on the main frequency component, constructing a local phase consistency map at each scale layer of the candidate mutation point set, and calculating complementary texture features of the local phase consistency map and the gradient direction field;
[0022] The reliability of the candidate mutation points is verified based on the complementary texture features, and the scale layer with the maximum mutual information mutation is selected as the optimal detection scale.
[0023] In an optional embodiment,
[0024] Adaptive binarization is performed on the candidate defect area to extract the defect edge contour points, calculate the curvature value of the defect edge contour points, and use the contour points with curvature values greater than the preset curvature threshold as key points. The defect shape is identified based on the spatial distribution characteristics of the key points. The defect area includes:
[0025] Constructing a multi-directional filter bank for the candidate defect area, calculating the response intensity in each direction, extracting the maximum response direction from the response intensity as the main direction, and adaptively enhancing the neighborhood of the main direction. Based on the enhanced response intensity, constructing a binarization threshold function, and adaptively binarizing the candidate defect area to obtain a binarized image.
[0026] A dual boundary tracking operator is constructed and used to track boundaries in a binarized image to extract candidate contour points with dual boundary responses. The candidate contour points are screened based on the continuity of the main direction, and the candidate contour points whose main direction continuity meets a preset continuity condition are determined as defect edge contour points. An annular neighborhood that changes with the main direction is constructed with the defect edge contour point as the center, and the curvature value of the contour point is calculated within the annular neighborhood;
[0027] A dynamic curvature threshold is set according to the continuity of the main direction, and contour points whose curvature values exceed the dynamic curvature threshold are marked as key points;
[0028] The spatial position sequence of the key points is extracted, the polar coordinate parameters between adjacent key points are calculated based on the main direction, a shape feature vector including distance ratio and angle difference is constructed, and the shape feature vector is used to distinguish the defect shape and obtain the defect area.
[0029] In an optional embodiment,
[0030] Texture feature extraction and classification of defect areas are performed, and the defect types obtained include:
[0031] The edge features of the directional gradient histogram are extracted from the defect area at multiple scales, and the gradient amplitude is used for weighting. The local texture features are constructed through non-uniform sampling and adaptive binarization to obtain the edge texture feature vector.
[0032] The gray level co-occurrence matrix of the defect area is calculated based on multiple angles and multiple distances, the window size is dynamically determined according to the regional complexity to extract contrast and correlation information, and weighted processing is performed in combination with the local variance distribution to obtain a statistical texture feature vector;
[0033] Tracking and locating the boundary of the defect area and calculating the edge curvature distribution, constructing the defect skeleton structure and extracting branch connectivity information, and generating a shape feature vector in combination with regional distance transformation;
[0034] Normalizing the edge texture feature vector, the statistical texture feature vector, and the shape feature vector, calculating the ratio of the inter-class distance between features to the intra-class variance as a weight coefficient, selecting and combining features according to the weight coefficient to obtain a combined feature vector;
[0035] The defect area is divided into linear defect area and block defect area using the shape feature vector, and the type of the divided defect area is identified by combining the combined feature vector. At the same time, a spatial association matrix of the defect area is constructed to optimize the defect type identification results. The identification results with identification confidence less than a preset confidence threshold are subjected to feature cross-validation, and the defect type is output.
[0036] In an optional embodiment,
[0037] Based on the key point distribution of the defect area, the coordinates of the defect center of gravity are calculated as the origin, a polar coordinate system is established, and the angle-radius distribution of the defect boundary curve is calculated. According to the surface curvature characteristics of the automotive parts, a laser engraving compensation path point sequence is generated, including:
[0038] Calculating the local density contribution values of key points within the defect area at multiple Gaussian kernel scales, performing nonlinear mapping on the density contribution values to obtain key point importance scores, and using the importance scores as weight coefficients to calculate the coordinates of the defect center of gravity through iterative weighted least squares method;
[0039] A polar coordinate system is established with the coordinates of the defect center of gravity as the origin, the angle sampling interval is dynamically adjusted based on the local curvature value of the defect boundary contour point, the curvature variance of adjacent sampling points is calculated, and the curvature variance is used as a weight coefficient to perform weighted calculation on the radial distance of the boundary point to generate the angle-radius distribution of the defect boundary curve;
[0040] The moving least squares method is used to calculate the normal vector change rate of the automobile part surface around the defect area. The curvature feature area is divided according to the normal vector change rate. A compensation function is constructed in each curvature feature area to deform the angle-radius distribution and generate a laser engraving compensation path point sequence.
[0041] In an optional embodiment,
[0042] Combining the laser engraving compensation path point sequence and the laser engraving compensation depth parameters to generate three-dimensional compensation trajectory data, and performing layered compensation processing on the printing defects on the surface of automotive parts includes:
[0043] Calculating the cutting force distribution of the laser engraving compensation path point sequence during the machining process, obtaining a heat accumulation value of the cutting process, dividing the laser engraving compensation path point sequence into a plurality of machining units, and determining a cooling time interval for each machining unit based on the heat accumulation value;
[0044] Determine the total number of processing layers according to the material removal characteristics, distribute the laser engraving compensation depth parameter according to the number of processing layers, calculate the material removal amount of each layer, and generate a layered processing sequence;
[0045] Combined with the cooling time interval, the feed rate of each processing unit is calculated, the laser engraving compensation path point sequence is converted into a motion trajectory with feed rate, and waiting nodes are inserted between adjacent reciprocating paths;
[0046] Synchronously combining the layered machining sequence with the motion trajectory with feed speed to generate rough machining trajectory data containing timing information, adding tool lift and cutter position to the rough machining trajectory data, planning the inter-layer transition path, and establishing a complete tool motion trajectory;
[0047] The complete tool motion trajectory is converted into three-dimensional compensation trajectory data executable by a machine tool, which is used for layered compensation processing of printing defects on the surface of automobile parts.
[0048] A second aspect of an embodiment of the present invention provides a printed part defect detection system based on machine vision, comprising:
[0049] The first unit is used to collect the original image of the printed area on the surface of the automobile part to be inspected through an industrial camera and perform image enhancement processing to obtain an enhanced inspection image;
[0050] The second unit is used to construct a multi-scale gradient pyramid for the enhanced detection image, extract the gradient direction histogram at each scale, calculate the mutual information value of the gradient direction histograms between adjacent scales, determine the optimal detection scale, and perform defect area segmentation at the optimal detection scale to obtain candidate defect areas;
[0051] The third unit is used to perform adaptive binarization processing on the candidate defect area, extract the defect edge contour points, calculate the curvature value of the defect edge contour points, use the contour points with curvature values greater than a preset curvature threshold as key points, perform defect shape discrimination based on the spatial distribution characteristics of the key points, obtain the defect area, extract and classify the texture features of the defect area, and obtain the defect type;
[0052] The fourth unit is used to calculate the coordinates of the defect center of gravity as the origin based on the key point distribution of the defect area, establish a polar coordinate system, calculate the angle-radius distribution of the defect boundary curve, generate a laser engraving compensation path point sequence according to the surface curvature characteristics of the automobile part, and set the laser engraving compensation depth parameter according to the defect type. The laser engraving compensation path point sequence and the laser engraving compensation depth parameter are combined to generate three-dimensional compensation trajectory data, and perform layered compensation processing on the printing defects on the surface of automobile parts.
[0053] According to a third aspect of an embodiment of the present invention, an electronic device is provided, including:
[0054] processor;
[0055] a memory for storing processor-executable instructions;
[0056] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0057] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.
[0058] In this embodiment, the machine vision-based printed part defect detection method constructs a multi-scale gradient pyramid and calculates the mutual information value to determine the optimal detection scale. It can adaptively process defect features at different scales, improve detection accuracy and robustness, and reduce detection error rates. Curvature features are used to extract key points and identify defect shapes, and texture features are combined to classify defect types. This allows for precise positioning and classification of printed defects on the surface of automotive parts, distinguishing between different types of printing defects and providing accurate defect information for subsequent compensation. A polar coordinate system is established based on defect features and a laser engraving compensation path is generated. Compensation depth parameters are adaptively set according to the defect type to form three-dimensional compensation trajectory data. This allows for precise layered compensation processing based on the curvature features of the automotive part surface, effectively improving the quality of repair of printed defects and reducing product defect rates. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 Schematic diagram of the process of a method for detecting defects in printed parts based on machine vision according to an embodiment of the present invention;
[0060] Figure 2 This is a schematic diagram comparing the performance of different technical means in different scenarios;
[0061] Figure 3 Schematic diagram of defect center of gravity calculation iteration and key point importance distribution; DETAILED DESCRIPTION
[0062] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0063] The following specific embodiments are used to describe the technical solution of the present invention in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0064] Figure 1 FIG. 1 is a flow chart of a method for detecting defects in printed parts based on machine vision according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0065] The original image of the printed area on the surface of the automotive part to be inspected is collected by an industrial camera and image enhancement processing is performed to obtain an enhanced inspection image;
[0066] A multi-scale gradient pyramid is constructed for the enhanced detection image. The gradient direction histogram at each scale is extracted. The mutual information value of the gradient direction histograms between adjacent scales is calculated to determine the optimal detection scale. The defect area is segmented at the optimal detection scale to obtain candidate defect areas.
[0067] Adaptively binarize the candidate defect areas, extract the defect edge contour points, calculate the curvature values of the defect edge contour points, and use the contour points with curvature values greater than the preset curvature threshold as key points. Based on the spatial distribution characteristics of the key points, the defect shape is identified to obtain the defect area. The texture features of the defect area are extracted and classified to obtain the defect type.
[0068] Based on the key point distribution of the defect area, the coordinates of the defect center of gravity are calculated as the origin, and a polar coordinate system is established. The angle-radius distribution of the defect boundary curve is calculated. According to the surface curvature characteristics of the automotive part, a laser engraving compensation path point sequence is generated, and the laser engraving compensation depth parameter is set according to the defect type. The laser engraving compensation path point sequence and the laser engraving compensation depth parameter are combined to generate three-dimensional compensation trajectory data, and layered compensation processing is performed on the printing defects on the surface of automotive parts.
[0069] For example, during defect inspection and laser engraving compensation for printed areas on the surface of automotive parts, an industrial camera is first used to capture raw images of the printed area. The industrial camera should have high resolution and a wide dynamic range to ensure stable acquisition of surface image information under varying lighting conditions. During the acquisition process, the industrial camera is fixedly mounted perpendicular to the surface being inspected. An automated transmission line drives the workpiece into the capture area, and a flexible fill light device is used to achieve uniform illumination, preventing reflections from the printed surface from affecting image quality.
[0070] After image acquisition, image enhancement processing is performed on the original image to improve the accuracy and robustness of subsequent image analysis. Image enhancement mainly includes contrast enhancement, noise suppression, and multi-directional filtering. Specifically, a multi-scale enhancement algorithm based on the Retinex principle is used to perform local brightness correction on the image to make the grayscale contrast between the printed texture area and the background in the image more obvious. At the same time, a bilateral filtering method is combined to perform noise smoothing processing, retaining edge features while removing high-frequency noise. To further highlight the characteristics of printing defects in the texture direction, a multi-directional Gabor filter is used to convolve the image, and the filter response maps in the four directions of 0 degrees, 45 degrees, 90 degrees, and 135 degrees are selected for fusion to obtain the enhanced detection image.
[0071] In an optional embodiment, a multi-scale gradient pyramid is constructed for the enhanced detection image, the gradient direction histogram at each scale is extracted, the mutual information value of the gradient direction histograms between adjacent scales is calculated, the optimal detection scale is determined, and the defect area is segmented at the optimal detection scale. The candidate defect areas obtained include:
[0072] The enhanced detection image is decomposed into multiple scales, and the image is convolved with a variable-scale Gaussian kernel function. The Gaussian kernel parameters are dynamically adjusted based on the inter-layer gradient consistency of the convolution result to construct a multi-scale gradient pyramid.
[0073] Calculating the horizontal gradient and vertical gradient of a pixel point at each scale layer of the multi-scale gradient pyramid, determining the gradient magnitude and direction, dividing the gradient direction space into a plurality of intervals, and counting the number of gradient points in each interval to construct a gradient direction histogram;
[0074] Constructing a joint probability distribution matrix, normalizing the joint probability distribution matrix, calculating the mutual information value of the gradient direction histogram of adjacent scale layers based on the normalized joint probability, analyzing the trend curve of the mutual information value changing with scale, extracting the location of the mutation point of the trend curve, and determining the scale layer with the largest mutual information mutation as the optimal detection scale;
[0075] On the image layer corresponding to the optimal detection scale, the local gradient amplitude of the image pixel points is calculated, and the pixel points with gradient amplitude greater than the preset gradient threshold are used as seed points. A local detection window is constructed with the seed points as the center, and the gradient covariance matrix within the local detection window is calculated. The growth threshold is determined, and regional growth is performed on the seed points according to the growth threshold to obtain the candidate defect area.
[0076] This embodiment discloses a defect detection method based on a multi-scale gradient pyramid. The method first constructs a multi-scale gradient pyramid for the enhanced detection image, then extracts the gradient direction histogram at each scale, calculates the mutual information value of the gradient direction histograms between adjacent scales, determines the optimal detection scale, and performs defect area segmentation at the optimal detection scale to obtain candidate defect areas.
[0077] During the multi-scale gradient pyramid construction phase, the enhanced inspection image is convolved with a variable-scale Gaussian kernel function. Specifically, the initial Gaussian kernel parameters are set to σ = 1.0, the scale factor k = 1.2, and five scale layers are constructed. After each convolution, the gradient vector angle between adjacent layers is calculated. If the average angle is greater than 30°, the scale factor k is reduced by 0.9 times the original value; if the average angle is less than 10°, the scale factor k is increased by 1.1 times the original value. This dynamic adjustment mechanism ensures that the multi-scale decomposition can adapt to the complexity of the inspection image. For example, for a 512×512 pixel aluminum plate surface image, after dynamic adjustment, the final scale sequence may be σ = {1.0, 1.16, 1.35, 1.57, 1.82}. This adaptive adjustment can better capture defect characteristics at different scales.
[0078] At each scale level, the horizontal and vertical gradients of each pixel are calculated. The horizontal gradient is obtained by performing a horizontal difference operation on the image, while the vertical gradient is obtained by performing a vertical difference operation on the image. For a pixel at position (x, y), the gradient magnitude is calculated as the square root of the sum of the squares of the horizontal and vertical gradients, and the gradient direction is calculated as the inverse tangent of the vertical and horizontal gradients. The gradient direction space is divided into 12 bins, each with a width of 30°. The number of gradient points within each bin is counted to construct a gradient direction histogram. To improve statistical stability, only pixels with gradient magnitudes greater than 20% of the image average gradient magnitude are considered. For example, the gradient direction histogram for the first scale level might be [320, 560, 980, 1240, 890, 450, 230, 180, 290, 520, 730, 610], representing the gradient distribution in different direction bins.
[0079] For the gradient direction histograms of adjacent scale layers, a joint probability distribution matrix P is constructed with dimensions of 12×12. Each element P(i, j) represents the probability of co-occurring in direction interval i of the first scale layer and in direction interval j of the second scale layer. By normalizing the gradient direction histograms, the marginal probability distributions P1 and P2 for each scale layer are obtained. Based on these probability distributions, the mutual information value is calculated. A larger mutual information value indicates more similar information between the two scale layers. By analyzing the trend curve of the mutual information value as it changes with scale, the locations of the mutation points are extracted. For example, for five scale layers, four mutual information values [0.85, 0.78, 0.42, 0.39] may be obtained. The mutual information value between the second and third scale layers decreases most significantly, by 0.36. This indicates that the third scale layer (σ = 1.35) captures significantly different image structure. Therefore, the third scale layer is determined to be the optimal detection scale.
[0080] After determining the optimal detection scale, the defect area is segmented on this scale layer. First, the local gradient amplitude of the image pixel is calculated. The local gradient amplitude is defined as the average gradient amplitude within a 3×3 neighborhood. The preset gradient threshold is set to 2 times the average gradient amplitude of the image, and the pixels with a gradient amplitude greater than the threshold are used as seed points. For each seed point, an 11×11 local detection window is constructed, and the covariance matrix of the gradient vector of the pixel point in the window is calculated. The eigenvalue decomposition of the covariance matrix obtains two eigenvalues λ1 and λ2 (λ1≥λ2), and the eigenvalue ratio r=λ1 / λ2 is used to determine the growth threshold. If r>4, it indicates that there is a strong directional structure in the local area, and the growth threshold is set to 0.6 times the gradient amplitude of the seed point; if r≤4, the growth threshold is set to 0.8 times the gradient amplitude of the seed point.
[0081] The region growing process starts from the seed point and checks its 8 neighboring pixels. If the gradient amplitude of the neighboring pixel is greater than the growth threshold and the gradient direction differs from the gradient direction of the seed point by less than 45 degrees, the pixel is added to the current region and used as a new expansion point. This process is repeated until no new pixels can be added. In order to reduce the influence of noise, the growth results are morphologically processed, including opening operations to remove small areas and closing operations to fill holes. The size of the structural element is set to 3×3. The connected area finally obtained is the candidate defect area. For example, in an image of a metal surface containing a scratch defect, the above method can successfully segment a scratch area of about 60 pixels long and 3 pixels wide, while the traditional single-scale-based method may miss or misdetect it.
[0082] In this embodiment, by constructing a multi-scale gradient pyramid and dynamically adjusting Gaussian kernel parameters, we effectively represent image features at different scales, enhancing the detection of small and blurred defects. By calculating the gradient direction histogram and its mutual information value at each scale, we adaptively select the optimal detection scale that contains the richest structural information, thereby improving detection accuracy and robustness. Furthermore, by combining local gradient amplitude screening with a region growing algorithm, we can accurately locate potential defect areas, enhance the boundary consistency and integrity of candidate regions, and facilitate the efficient execution of subsequent classification, identification, and compensation processing.
[0083] In an optional embodiment, analyzing a trend curve of mutual information values varying with scale, extracting mutation points of the trend curve, and determining a scale layer with a maximum mutual information mutation as the optimal detection scale includes:
[0084] Constructing a trend curve of mutual information value varying with scale, constructing a structure tensor for the local structure of the trend curve, adaptively determining a weight coefficient based on the eigenvalue distribution of the structure tensor, and performing nonlinear local weighting on the trend curve to obtain an enhanced trend curve;
[0085] The normalized difference of the enhanced trend curve at adjacent scale layers is calculated, and an adaptive threshold is constructed based on the local gradient density distribution. The mutation characteristics of the trend curve are extracted based on the adaptive threshold. At the same time, the enhanced trend curve is subjected to wavelet decomposition to extract the curvature coefficient at different scales. A mutation point detection operator is constructed based on the multi-scale response of the curvature coefficient.
[0086] Adaptively fusing the mutation feature with a mutation point detection operator to construct a mutation point evaluation function, analyzing the time-frequency characteristics of the mutation point evaluation function, extracting the main frequency component of the feature response, determining a set of candidate mutation points of a trend curve based on the main frequency component, constructing a local phase consistency map at each scale layer of the candidate mutation point set, and calculating complementary texture features of the local phase consistency map and the gradient direction field;
[0087] The reliability of the candidate mutation points is verified based on the complementary texture features, and the scale layer with the maximum mutual information mutation is selected as the optimal detection scale.
[0088] For example, it is first necessary to analyze the trend curve of the mutual information value changing with scale, and enhance the local structural features of the trend curve by constructing a structural tensor. Specifically, for a given multi-scale gradient direction histogram sequence, the mutual information value between adjacent scale layers is calculated. Taking the broken line defect on the surface of the printed part as an example, after collecting the original image of 1024×1024 pixels, a 5-layer pyramid structure is constructed, and the sampling interval of each scale is 2, resulting in a multi-scale image sequence of 512×512, 256×256, 128×128, and 64×64 pixels. The gradient direction histogram is calculated for each scale image, and the gradient direction is divided into 36 uniform intervals to obtain a 36-dimensional feature vector. The mutual information value of the feature vectors between adjacent scales is calculated to form a trend curve of 4 data points.
[0089] To extract the local structural features of the trend curve, a structure tensor is constructed within the neighborhood of each data point. This structure tensor is a 2×2 real symmetric matrix whose elements are calculated from the first-order partial derivatives of the trend curve at that point. Specifically, a 5×5 neighborhood window is taken around the data point, and the horizontal and vertical gradients are calculated. The outer products of the gradients are summed as the elements of the structure tensor. By performing eigenvalue decomposition on the structure tensor, larger eigenvalues represent the primary direction of the local structure at that point, while smaller eigenvalues represent secondary directions.
[0090] An adaptive weighting strategy is used to determine the weight coefficient based on the eigenvalue distribution of the structural tensor. The weight coefficient calculation considers two factors: the eigenvalue ratio, which reflects the degree of anisotropy in the local structure; and the sum of the eigenvalues, which reflects the significance of the local structure. The weight coefficient increases with the eigenvalue ratio and the sum of the eigenvalues, and is mapped using a sigmoid function. For the example of a broken wire defect, a larger weight coefficient is obtained at the inflection point of the trend curve due to the significant local structure, while a smaller weight coefficient is obtained in the flat region.
[0091] Apply nonlinear local weighting to the trend curve using a defined weight coefficient. Within the neighborhood of each data point, the original data value is multiplied by the weight coefficient to enhance the local structure. This process emphasizes sudden changes in the trend curve and suppresses noise. In this example, after weighting, the trend curve exhibits more pronounced jumps at critical points of scale change.
[0092] Calculate the normalized differences of the enhanced trend curve at adjacent scale levels. First, normalize the curve, mapping the numerical range to the interval [0, 1]. Then, calculate the differences between adjacent data points to obtain a difference sequence. Simultaneously, analyze the local gradient distribution of the curve and calculate the gradient density within the neighborhood of each data point. A larger gradient density indicates a more dramatic change in that area. Based on the gradient density, an adaptive threshold is constructed. The threshold decreases as the gradient density increases, allowing for a smaller threshold to be used for mutation feature extraction in areas of dramatic change.
[0093] The enhanced trend curve is subjected to wavelet decomposition, using Haar wavelets as the basis function, and a three-layer decomposition is performed. Detail coefficients are extracted at each decomposition layer. These coefficients reflect the local variation characteristics of the curve at different scales. The distribution of detail coefficients is analyzed to calculate the curvature coefficient at each data point. The calculation of the curvature coefficient considers the degree of curvature of the curve segment formed by the point and its adjacent points. Based on the curvature coefficients at different scales, a mutation point detection operator is constructed. This operator integrates responses at multiple scales and can effectively identify mutation points in the curve.
[0094] The resulting mutation features are adaptively fused with the mutation point detection operator. The fusion process uses a weighted averaging strategy, with the weight coefficients dynamically adjusted based on the reliability of each feature. Reliability assessment is based on the local consistency of features, with features with greater consistency receiving greater weights. After fusion, a mutation point evaluation function is constructed, which has a larger response value at potential mutation point locations.
[0095] A time-frequency analysis is performed on the mutation point evaluation function, using short-time Fourier transforms to extract local spectral features. Frequency components with concentrated energy are searched in the frequency domain. These components correspond to the main variation patterns in the evaluation function. The frequency component with the highest energy is considered the dominant frequency component, which guides the location of the mutation point. In this example, the dominant frequency component corresponds to the location of the most significant scale change in the trend curve.
[0096] A set of candidate mutation points is determined at the local maximum of the evaluation function. For each mutation point in the set, a local phase congruency map is constructed at the corresponding scale layer. The phase congruency map characterizes the reliability of edge features by analyzing the consistency of the local gradient direction of the image. The gradient direction field at this scale layer is simultaneously calculated to extract complementary texture features. These features can reflect the distinction between defect areas and background.
[0097] The reliability of candidate breakpoints is verified based on complementary texture features. This verification process considers the following factors: gradient consistency in the breakpoint neighborhood, the significance of edge responses, and the degree of correlation with adjacent scales. By comprehensively evaluating these factors, the most reliable breakpoints are selected. For the broken wire defect in the example, the 256×256 pixel scale exhibits the most significant feature response, so this scale is selected as the optimal detection scale.
[0098] Existing techniques often use fixed or empirically determined scales for image feature extraction and mutation point analysis, making them difficult to adapt to variations in image structure and information complexity. This results in sensitivity to scale selection, insufficient accuracy, and insufficient stability. To address these issues, this application constructs a trend curve of mutual information values as they vary with scale and analyzes their mutation behavior. A structural tensor is introduced to model the local variation patterns of the trend curve, and weighting coefficients are adaptively assigned based on the eigenvalues. This enhances mutation features while maintaining the original variation trend. Furthermore, wavelet decomposition is used to extract multi-scale curvature characteristics, constructing a detection operator responsive to local mutations. Mutation features are then integrated into an evaluation function, and the dominant frequency response is extracted through frequency domain analysis to more accurately locate potential mutation regions. Furthermore, a local phase congruence map is introduced at the candidate scale layer, combined with the gradient direction field to construct complementary texture features, enabling further screening and verification of mutation points. This scheme significantly improves upon existing methods in terms of adaptive scale optimization, mutation detection sensitivity, and anti-interference capabilities, significantly enhancing the accuracy and robustness of extracting key structural information in complex image backgrounds.
[0099] Figure 2The following diagram compares the performance of different technical approaches in different scenarios, including scenario Alpha: detecting subtle print defects on instrument panel warning icons; scenario Beta: detecting minor line breaks on engine compartment labels; scenario Gamma: detecting print distortion and consistency of functional symbols on curved interior parts; and scenario Delta: detecting multi-scale defects on decorative strips with complex patterns. In all four test scenarios, the corresponding histogram heights (i.e., performance values, such as 92.3% in scenario Beta) for the proposed method generally outperform or are at least on par with those of the baseline method (e.g., 88.0% in scenario Beta) and comparative method A (e.g., 78.5% in scenario Beta). This demonstrates the significant advantages of the proposed method in improving defect detection performance. This advantage is primarily attributed to the unique technical approach employed by the proposed method: by constructing a trend curve of mutual information values as a function of scale, combined with a series of sophisticated steps including structural tensor enhancement, wavelet decomposition analysis, a mutation point evaluation function based on multi-feature fusion, and reliability verification of candidate mutation points based on local phase congruence and complementary texture features, the proposed method achieves adaptive and precise determination of the optimal detection scale for image analysis. This enables the present invention to extract key structural information more accurately and robustly under complex image backgrounds and variable defect morphologies, thereby improving overall detection efficiency and reliability.
[0100] In an optional embodiment, the candidate defect area is adaptively binarized, the defect edge contour points are extracted, the curvature values of the defect edge contour points are calculated, and the contour points with curvature values greater than a preset curvature threshold are used as key points. The defect shape is identified based on the spatial distribution characteristics of the key points, and the defect area obtained includes:
[0101] Constructing a multi-directional filter bank for the candidate defect area, calculating the response intensity in each direction, extracting the maximum response direction from the response intensity as the main direction, and adaptively enhancing the neighborhood of the main direction. Based on the enhanced response intensity, constructing a binarization threshold function, and adaptively binarizing the candidate defect area to obtain a binarized image.
[0102] A dual boundary tracking operator is constructed and used to track boundaries in a binarized image to extract candidate contour points with dual boundary responses. The candidate contour points are screened based on the continuity of the main direction, and the candidate contour points whose main direction continuity meets a preset continuity condition are determined as defect edge contour points. An annular neighborhood that changes with the main direction is constructed with the defect edge contour point as the center, and the curvature value of the contour point is calculated within the annular neighborhood;
[0103] A dynamic curvature threshold is set according to the continuity of the main direction, and contour points whose curvature values exceed the dynamic curvature threshold are marked as key points;
[0104] The spatial position sequence of the key points is extracted, the polar coordinate parameters between adjacent key points are calculated based on the main direction, a shape feature vector including distance ratio and angle difference is constructed, and the shape feature vector is used to distinguish the defect shape and obtain the defect area.
[0105] Exemplarily, for the input candidate defect area image, a multi-directional filter group is constructed to enhance the defect edge features. Specifically, a group of directional filters covering the range of 0° to 180° is designed, with an interval of 15°, for a total of 12 directions. Each directional filter uses a Gaussian first-order derivative kernel function with a size of 9×9 pixels and a standard deviation of 1.5. These directional filters are applied to the candidate defect area to calculate the response intensity of each pixel in each direction. For example, for a candidate defect area with a size of 256×256 pixels, a corresponding response map can be obtained in each direction. By comparing the response values of each pixel in each directional response map, the maximum response direction is determined as the main direction of the pixel. For the detected main direction, its neighborhood is further adaptively enhanced. With the main direction as the center, the directional response maps within 30° to the left and right are selected for weighted averaging, and the weight is proportional to the cosine value of the direction difference. This enhancement process ensures the continuity of the edge direction, so that weak edges can also be effectively extracted.
[0106] Based on the enhanced response intensity, a binarization threshold function is constructed to achieve adaptive binarization. The threshold function is designed as a function of the response intensity, specifically the mean response intensity within a 7×7 neighborhood around the current pixel plus 0.5 times the standard deviation. Pixels with response intensities above the threshold are marked as 1, while those with response intensities above the threshold are marked as 0, thus generating a binary image. For example, for a defect area with a weak edge response, the average response intensity of the local area may be 0.35, with a standard deviation of 0.12. Therefore, the binarization threshold for this area is 0.41.
[0107] After obtaining the binary image, a dual boundary tracking operator is constructed to extract the defect edge contour points. The dual boundary tracking operator is defined as a bidirectional detector in the direction perpendicular to the main direction, with a detection distance of 5 pixels. Starting from the edge starting point in the binary image, the changes in pixel values are detected on both sides of the direction perpendicular to the main direction. When a jump from 0 to 1 or from 1 to 0 is detected on both sides at the same time, the current position is marked as a candidate contour point. In order to improve the accuracy of the contour points, the candidate contour points are screened based on the continuity of the main direction. Specifically, the change in the main direction of adjacent pixel points is calculated. When the change is less than 20°, it is considered that the continuity condition is met, and the candidate point is determined as the defect edge contour point. For a typical crack defect, about 200-300 contour points can be extracted through this step.
[0108] To calculate the curvature value of the contour point, an annular neighborhood that changes with the main direction is constructed with each defect edge contour point as the center. The inner radius of the annular neighborhood is 3 pixels, the outer radius is 7 pixels, and the angle range is 60° on both sides of the main direction. Within this annular neighborhood, the curvature value of the contour point is calculated by analyzing the pixel intensity distribution. The specific calculation method is the second-order rate of change of the pixel intensity in the neighborhood along the main direction, which is numerically expressed as the rate of change of the pixel intensity difference on both sides of the main direction. For example, for a contour point located at the corner of a crack, its curvature value may reach 0.85, while the curvature value of a contour point located on a straight line segment is usually less than 0.3.
[0109] A dynamic curvature threshold is set based on the continuity of the main direction to adapt to the characteristics of different defect shapes. When the main direction changes significantly, the curvature threshold is lowered; when the main direction changes slightly, the curvature threshold is increased. Specifically, when the main direction of adjacent points changes by more than 15°, the curvature threshold is set to 0.5; when the change is between 5° and 15°, the curvature threshold is 0.6; and when the change is less than 5°, the curvature threshold is 0.7. Contour points whose curvature values exceed the dynamic curvature threshold are marked as key points. In this way, key feature points of the defect shape, such as corners and sharp corners, can be accurately captured.
[0110] The spatial position sequence of the marked key points is extracted and arranged in order along the contour. The polar coordinate parameters between adjacent key points, including distance and angle, are calculated based on the main direction. The distance is expressed as the Euclidean distance between two points, and the angle is expressed as the angle between the connecting line and the horizontal direction. Further, the distance ratio and angle difference are calculated to form a shape feature vector. The distance ratio is defined as the ratio of the lengths of two line segments formed by three adjacent key points, and the angle difference is defined as the angle between these two line segments. For example, for a typical L-shaped crack, the number of key points is about 4-6, the distance ratio of adjacent key points is close to 1.0, and the angle difference is close to 90° at a certain position. For different types of defects, a shape feature library is established, which contains feature vectors of typical shapes such as rectangular defects, triangular defects, and crack defects. By calculating the similarity between the shape feature vector of the defect to be detected and each type in the feature library, the defect shape is judged to obtain the type information of the defect area. When the similarity exceeds 0.85, it is determined to be a defect of the corresponding type; when the similarity is lower than 0.65, it is marked as an unknown type; when it is between the two, the type with the highest similarity is selected and marked with low credibility.
[0111] Existing techniques often use a global fixed threshold or single-directional filtering for defect region identification and edge extraction. These methods are susceptible to background noise interference or are insensitive to complex boundary deformations, resulting in low defect recognition accuracy and inaccurate boundary location. This application constructs a multi-directional filter bank to extract the principal direction information of candidate regions and adaptively enhances the response within the principal direction neighborhood, achieving sensitive perception of directional defects. The adaptive threshold function constructed based on the enhanced response can adapt to different background and texture intensities, significantly improving the robustness of the binarization effect. Furthermore, a dual boundary tracking operator is introduced to extract continuous contour points along the principal direction and, combined with the principal direction, a dynamic curvature calculation neighborhood is constructed to accurately capture the true boundary structure. Furthermore, key structural points are identified based on the curvature changes of the contour points, and polar coordinate shape features, consisting of distance ratios and angle differences, are constructed to accurately distinguish the defect shape. By modeling the directionality of boundary structure and identifying curvature key points, this solution overcomes the limitations of traditional methods that lack responsiveness to edge complexity. This effectively improves defect recognition accuracy and shape classification capabilities in the presence of weak boundaries and complex backgrounds, enhancing the system's adaptability and practicality.
[0112] In an optional embodiment, texture features are extracted and classified from the defect area to obtain defect types including:
[0113] The edge features of the directional gradient histogram are extracted from the defect area at multiple scales, and the gradient amplitude is used for weighting. The local texture features are constructed through non-uniform sampling and adaptive binarization to obtain the edge texture feature vector.
[0114] The gray level co-occurrence matrix of the defect area is calculated based on multiple angles and multiple distances, the window size is dynamically determined according to the regional complexity to extract contrast and correlation information, and weighted processing is performed in combination with the local variance distribution to obtain a statistical texture feature vector;
[0115] Tracking and locating the boundary of the defect area and calculating the edge curvature distribution, constructing the defect skeleton structure and extracting branch connectivity information, and generating a shape feature vector in combination with regional distance transformation;
[0116] Normalizing the edge texture feature vector, the statistical texture feature vector, and the shape feature vector, calculating the ratio of the inter-class distance between features to the intra-class variance as a weight coefficient, selecting and combining features according to the weight coefficient to obtain a combined feature vector;
[0117] The defect area is divided into linear defect area and block defect area using the shape feature vector, and the type of the divided defect area is identified by combining the combined feature vector. At the same time, a spatial association matrix of the defect area is constructed to optimize the defect type identification results. The identification results with identification confidence less than a preset confidence threshold are subjected to feature cross-validation, and the defect type is output.
[0118] For example, after acquiring an image of the workpiece to be inspected, the system performs edge feature extraction using a multi-scale directional gradient histogram on the detected defect area. The system selects three windows of different sizes (4×4 pixels, 8×8 pixels, and 16×16 pixels) to scan the defect area, calculating the pixel gradient direction and magnitude within each window. The directional angles are evenly divided into nine intervals (0°-20°, 20°-40°, ..., 160°-180°). Each pixel is assigned to a corresponding interval based on its gradient direction, and the gradient magnitude is used as a weight to construct a directional histogram. To enhance local texture features, the system employs a non-uniform sampling strategy, with the sampling density at the defect edge being twice that of the center area. During the adaptive binarization process, the threshold is set at 0.85 times the average grayscale value of the local window, generating a binary texture map and forming a 72-dimensional edge texture feature vector.
[0119] To extract statistical texture features, the system calculates a grayscale co-occurrence matrix for multiple angles and distances. Specifically, the matrix is calculated using a combination of four angles (0°, 45°, 90°, and 135°) and three distances (1 pixel, 3 pixels, and 5 pixels). The window size is dynamically determined based on the complexity of the defect area. Complexity is calculated using the variance of pixels within the area. A 32×32 window is used when the variance is greater than 100, while a 16×16 window is used otherwise. Contrast features are extracted from the co-occurrence matrix, calculating the degree of difference between pairs of grayscale values. Correlation features are also used to measure the linear correlation between the grayscale values of adjacent pixels. Local variance distribution is also introduced for weighting, assigning greater weight (a weight coefficient of 1.5) to regions with high variance values, while a weight coefficient of 0.8 is assigned to regions with low variance values, resulting in a 48-dimensional statistical texture feature vector.
[0120] For shape feature extraction, the system uses a boundary tracking algorithm to locate the defect boundary. Starting from any point on the boundary, the system performs an 8-neighborhood search in a clockwise direction to find the next boundary point until it returns to the starting point to complete the closed boundary. A curvature value is calculated for every 5 pixels along the boundary, and the curvature is represented by the rate of change of the angles of adjacent boundary points. The defect skeleton structure is generated by a morphological refinement algorithm, which retains the topological structure of the object, identifies endpoints and branch points on the skeleton, and records the number and length of branches. Branch connectivity information includes the angular distribution and density between branches. The system calculates the regional distance transformation to obtain the shortest distance from each point inside the defect to the boundary, and extracts features such as the maximum inscribed circle radius and slenderness ratio based on this, ultimately forming a 36-dimensional shape feature vector.
[0121] Feature normalization uses the min-max method to map each eigenvalue to the interval [0, 1]. Feature weights are assigned based on the ratio of inter-class distance to intra-class variance. The mean and variance of each feature across samples from different defect categories are calculated. The inter-class distance is the absolute value of the difference in the mean of features from different defect categories, and the intra-class variance is the dispersion of feature values within the same category. Features with a ratio greater than 1.5 are assigned a high weight (1.2), features with a ratio between 0.8 and 1.5 are assigned a weight of 1.0, and features with a ratio less than 0.8 are assigned a weight of 0.6. Through weight screening, the top 80% of important features are retained to form the combined feature vector after dimensionality reduction.
[0122] Defect classification begins with a preliminary classification of defects using shape feature vectors. The system calculates the defect's aspect ratio (ratio of the major axis to the minor axis). If the aspect ratio is greater than 3.5 and the maximum width is less than 1.8 times the average width of the defect area, the defect is classified as a linear defect; otherwise, it is classified as a block defect. For linear defects, the focus is on directionality and continuity; for block defects, the emphasis is on texture distribution and boundary regularity. The system uses a support vector machine classifier for defect type identification, using a radial basis kernel function with a kernel parameter γ set to 0.05 and a penalty coefficient C of 10. To optimize identification results, a spatial correlation matrix of the defect areas is constructed, recording the distances and relative positional relationships between defects. When adjacent defects (less than 50 pixels apart) are classified into different types with a probability difference of less than 0.15, the low-probability defect is reclassified as the same type as the high-probability defect. For identification results with a confidence level below 0.75, the system performs feature cross-validation, voting among classifiers constructed using different feature subsets to determine the final defect type output.
[0123] In this embodiment, by fusing multi-scale, multi-angle texture, statistical and shape features, the complex structure and detail changes of the defect area can be fully characterized, and the accuracy and robustness of defect type identification can be improved. Compared with the existing technology that relies on a single feature or a fixed threshold judgment, this solution introduces the directional gradient histogram, grayscale co-occurrence matrix and boundary skeleton information, dynamically constructs feature vectors and performs normalized fusion, which significantly enhances the separability of different types of defects. At the same time, the recognition results are optimized by the spatial correlation matrix, and the feature cross-validation mechanism is combined to process low-confidence outputs, effectively reducing the misjudgment rate. Overall, accurate identification and classification of defect types are achieved, the stability and adaptability of the system are improved, and it is suitable for defect detection tasks under a variety of complex backgrounds.
[0124] Table 1: Performance comparison of defect type identification methods:
[0125]
[0126] As shown in Table 1, the overall recognition accuracy of our method (94.6%) significantly surpasses that of existing methods A (78.5%) and B (85.2%), demonstrating its superior comprehensive recognition capabilities. Our method demonstrates superior accuracy for defects of varying macroscopic shapes, attributed to its initial classification strategy and targeted feature utilization. For difficult-to-detect micro-defects (such as 0.1mm wire breaks), our method's missed detection rate (3.2%) is significantly lower than that of other methods, demonstrating its ability to capture detailed features.
[0127] In an optional embodiment, the coordinates of the defect center of gravity are calculated as the origin based on the distribution of key points in the defect area, a polar coordinate system is established, the angle-radius distribution of the defect boundary curve is calculated, and a laser engraving compensation path point sequence is generated according to the surface curvature characteristics of the automobile part, including:
[0128] Calculating the local density contribution values of key points within the defect area at multiple Gaussian kernel scales, performing nonlinear mapping on the density contribution values to obtain key point importance scores, and using the importance scores as weight coefficients to calculate the coordinates of the defect center of gravity through iterative weighted least squares method;
[0129] A polar coordinate system is established with the coordinates of the defect center of gravity as the origin, the angle sampling interval is dynamically adjusted based on the local curvature value of the defect boundary contour point, the curvature variance of adjacent sampling points is calculated, and the curvature variance is used as a weight coefficient to perform weighted calculation on the radial distance of the boundary point to generate the angle-radius distribution of the defect boundary curve;
[0130] The moving least squares method is used to calculate the normal vector change rate of the automobile part surface around the defect area. The curvature feature area is divided according to the normal vector change rate. A compensation function is constructed in each curvature feature area to deform the angle-radius distribution and generate a laser engraving compensation path point sequence.
[0131] For example, when calculating the coordinates of the defect center of gravity, the defect area is first preprocessed, including image enhancement and segmentation, to obtain a clear defect outline. After image segmentation, the key point set P = {p1, p2, ..., p n}, where each key point p i Expressed as a two-dimensional coordinate (x i ,y i ). In order to calculate the local density contribution value of each key point, multiple Gaussian kernel scales σ = {5, 10, 15, 20} pixels are set. For each scale σ j And each key point p i , calculate its density contribution to other points in the defect area. For example, point p i At scale σ j The density contribution value D to other points ij It can be obtained by calculating the Gaussian kernel function value. In practical applications, when the distance between two points exceeds 30 pixels, the density contribution value can be approximated to zero to improve calculation efficiency.
[0132] Perform nonlinear mapping on the calculated density contribution value to obtain the key point importance score . The nonlinear mapping is implemented using a variant of the sigmoid function, so that the importance score is distributed between 0 and 1. In practical applications, for a defect area with an area of about 1200 square pixels, the number of key points is usually 100-150, of which about 15% of the key points obtain an importance score higher than 0.8, indicating that these points have a significant impact on determining the center of gravity of the defect. Using these importance scores as weight coefficients, the coordinates of the center of gravity of the defect are calculated by iterative weighted least squares method. During the iteration process, the weight coefficient will be dynamically adjusted according to the current estimated center of gravity position. Usually after 5-7 iterations, the calculation can be considered to have converged when the center of gravity position changes by less than 0.1 pixel.
[0133] The polar coordinate system is established with the calculated coordinates of the defect's center of gravity (x0, y0) as the origin. In actual application, an irregular concave defect is found on the surface of a car's front fender. The coordinates of its center of gravity are calculated to be (354.28, 216.93) pixels. Based on this center of gravity, the defect boundary contour point set B = {b1, b2, ..., b m} and convert it into polar coordinates (r i ,θ i ), where r irepresents the distance from the boundary point to the centroid, Indicates the corresponding polar angle.
[0134] In order to accurately describe the defect boundary shape, it is necessary to dynamically adjust the angle sampling interval. The local curvature value κ of the boundary point i Calculated by the inverse of the radius of the circle formed by three adjacent points. In the area with large curvature (κ i >0.05, the angle sampling interval is set to 2 degrees; in the area with moderate curvature (0.02≤κ i ≤0.05), set to 5 degrees; in the area with smaller curvature (κ i <0.02) and set it to 8 degrees. This dynamic adjustment strategy ensures a higher sampling density in areas with complex boundary shapes and a lower sampling density in smooth areas, improving computational efficiency and accuracy.
[0135] The curvature variance Vκ of adjacent sampling points is calculated as an indicator of the local complexity of the boundary. For the aforementioned car fender dent defect, the boundary perimeter is approximately 320 pixels, and a total of 62 boundary points were sampled. The maximum curvature variance was 0.0038, and the minimum was 0.0002. The curvature variance was used as a weighting factor to weight the radial distance between boundary points, generating a more accurate angle-radius distribution of the defect boundary curve.
[0136] To adapt to the curvature characteristics of the automotive part surface, the moving least squares method is used to calculate the rate of change of the normal vector of the automotive part surface around the defect area. The point cloud data within a range of 20mm outside the defect boundary is taken, and the local surface is fitted within a radius of 10mm around each point to calculate the normal vector. The rate of change of the normal vector is obtained by comparing the angles between the normal vectors of adjacent points. In practical applications, for the surface of the above-mentioned automobile fender, the rate of change of the normal vector is distributed between 0.002 and 0.058. Based on this distribution, the surface is divided into three types of curvature characteristic areas: flat area (rate of change <0.01), transition area (0.01-0.03) and high curvature area (>0.03).
[0137] Compensation functions are constructed within regions with varying curvature characteristics to deform the angle-radius distribution. In flat areas, the compensation coefficient is 1.05; in transitional regions, it's 1.12; and in regions of high curvature, it's 1.20. These compensation coefficients are used to adjust the angle-radius distribution of the original defect boundary, ultimately generating a sequence of laser engraving compensation path points. Actual tests have shown that laser engraving repairs using this compensation method significantly outperform traditional methods, achieving more natural edge transitions and maintaining a color difference between the repaired surface and the surrounding original surface within a range of ΔE ≤ 1.8, meeting the quality requirements for high-end automotive exterior appearance.
[0138] In this embodiment, the center of gravity of the defect is accurately calculated by weighting the density of key points, and the angular and radial changes of the defect boundary are dynamically modeled in the polar coordinate system, so that the representation of the defect contour is more consistent with its true morphological characteristics. Compared with the traditional method of constructing a compensation path based only on the geometric center or a fixed sampling method, this solution introduces a key point importance score and a curvature variance weighting mechanism, which effectively improves the ability to depict complex boundary structures. At the same time, the moving least squares method is combined to analyze the change of the surface normal vector of the part, construct a local curvature response area, and perform compensation function deformation in different areas, so that the laser engraving path is more in line with the surface morphology of the part, realizing refined and adaptive compensation planning, and significantly improving the accuracy and surface consistency of the laser engraving process.
[0139] Figure 3 This is a diagram of defect centroid calculation iterations and key point importance distribution. The scattered dots in the figure represent the key point sets extracted from the segmented defect area. These key points are divided into two types according to their importance scores:
[0140] Small light blue circles represent "normal keypoints." These keypoints have low importance scores (e.g., scores less than 0.8) after multi-scale Gaussian kernel density contribution calculation and nonlinear mapping (e.g., sigmoid function variants). Larger gold circles represent "high-importance keypoints." These keypoints have high importance scores (e.g., scores not less than 0.8). These typically correspond to regions of high density within the defect structure or that have a significant impact on morphology, and are therefore given greater weight in the center of gravity calculation.
[0141] The large green dot marks the coordinates of the "final defect center of gravity" obtained through the above iterative calculation convergence. This center of gravity will serve as the reference origin for subsequently establishing a polar coordinate system, analyzing the angle-radius distribution of the defect boundary, and generating a sequence of laser engraving compensation path points.
[0142] The center of gravity calculation method proposed in this paper goes beyond simply taking the geometric center. Instead, it fully accounts for the heterogeneous distribution of key points within the defect area. By assigning higher importance scores to high-density areas or structural key points and employing an iterative weighting approach, it effectively counteracts the influence of noisy key points, ensuring that the calculated center of gravity more closely matches the actual mass distribution center or structural core of the defect, laying a solid foundation for subsequent accurate defect morphology description and compensation path generation.
[0143] In an optional embodiment, combining the laser engraving compensation path point sequence and the laser engraving compensation depth parameter to generate three-dimensional compensation trajectory data, and performing layered compensation processing on the printing defects on the surface of automobile parts includes:
[0144] Calculating the cutting force distribution of the laser engraving compensation path point sequence during the machining process, obtaining a heat accumulation value of the cutting process, dividing the laser engraving compensation path point sequence into a plurality of machining units, and determining a cooling time interval for each machining unit based on the heat accumulation value;
[0145] Determine the total number of processing layers according to the material removal characteristics, distribute the laser engraving compensation depth parameter according to the number of processing layers, calculate the material removal amount of each layer, and generate a layered processing sequence;
[0146] Combined with the cooling time interval, the feed rate of each processing unit is calculated, the laser engraving compensation path point sequence is converted into a motion trajectory with feed rate, and waiting nodes are inserted between adjacent reciprocating paths;
[0147] Synchronously combining the layered machining sequence with the motion trajectory with feed speed to generate rough machining trajectory data containing timing information, adding tool lift and cutter position to the rough machining trajectory data, planning the inter-layer transition path, and establishing a complete tool motion trajectory;
[0148] The complete tool motion trajectory is converted into three-dimensional compensation trajectory data executable by a machine tool, which is used for layered compensation processing of printing defects on the surface of automobile parts.
[0149] This embodiment provides a method for generating three-dimensional compensation trajectory data by combining a laser engraving compensation path point sequence and a laser engraving compensation depth parameter to perform layered compensation processing on printed defects on the surface of automotive parts. The specific implementation process of this method is as follows:
[0150] Before performing compensation processing, the system first calculates the cutting force distribution of the laser engraving compensation path point sequence during the machining process. By establishing a finite element analysis model of the laser engraving processing area, the system converts the compensation path point sequence into discrete machining units. The cutting force of each unit is determined by the tool diameter, cutting depth, and feed rate. For example, for a cylindrical tool with a diameter of 0.2mm, a cutting depth of 0.05mm, and a feed rate of 100mm / min, the system calculates a cutting force of 4.8N per unit time.
[0151] Obtaining heat accumulation during the cutting process involves calculating heat generation and diffusion at each processing point. The system uses a heat conduction model, taking into account the material's thermal conductivity, specific heat capacity, and density, to calculate how heat propagates through the material. For example, aluminum alloy has a thermal conductivity of 237W / (m·K) and a specific heat capacity of 897J / (kg·K). Under standard cutting parameters, calculations show that approximately 3.2J of heat is generated per second, creating a heat accumulation zone with a diameter of approximately 0.8mm.
[0152] Based on thermal analysis, the system divides the laser engraving compensation path point sequence into multiple processing units. The principle of division is to ensure that the heat accumulation in each processing unit does not exceed the material's heat resistance threshold. Taking aluminum alloy surface processing as an example, when the surface temperature exceeds 120°C, the surface quality of the workpiece will deteriorate. The system divides the path point sequence into a processing unit every 5mm. Through thermal simulation analysis, aluminum alloy under this condition requires a cooling interval of 0.6 seconds to ensure that the temperature drops to a safe range.
[0153] The total number of processing layers is determined based on the material removal characteristics. The system determines the optimal layering strategy by analyzing the relationship between the material removal rate and the cutting parameters. For a coating material with a hardness of 80HRC, the maximum removal depth of a single layer is 0.08mm. If the total compensation depth is 0.4mm, it needs to be divided into 5 layers for processing. The system allocates the laser engraving compensation depth parameters according to the number of processing layers, using a decreasing strategy: the first layer removes 0.12mm, the second layer removes 0.1mm, the third layer removes 0.08mm, the fourth layer removes 0.06mm, and the fifth layer removes 0.04mm. This allocation method ensures that the processing accuracy is improved layer by layer.
[0154] The feed rate for each machining unit is calculated based on the cooling interval. This calculation method is based on a heat control model to ensure that heat accumulation does not exceed a threshold. Specifically, the feed rate is 80 mm / min for the first layer, and then increased to 90 mm / min, 100 mm / min, 110 mm / min, and 120 mm / min for each subsequent layer. This strategy controls heat accumulation during roughing and improves efficiency during finishing.
[0155] The laser engraving compensation path point sequence is converted into a motion trajectory with feed rate. For a 20mm x 15mm rectangular defect area, the system generates a reciprocating parallel scanning path with a 0.15mm spacing between adjacent paths, totaling 100 parallel paths. A 0.6-second wait time is inserted between adjacent reciprocating paths. This is achieved by adding G04 P0.6 commands at path turning points to ensure sufficient heat dissipation.
[0156] The layered machining sequence is synchronized with the motion trajectory with feed rate to generate roughing trajectory data containing timing information. For five-layer machining, the system inserts a 5-second interlayer cooling period after each layer and records the timestamp and corresponding Z-axis position of each layer. For example, the Z-axis position of the first layer is -0.12mm, with a start time of 0 seconds; the Z-axis position of the second layer is -0.22mm, with a start time of 126 seconds; and so on.
[0157] The tool lift and cutter position are added to the roughing trajectory data. Before each layer begins, the system raises the tool to a safe height of Z = 2mm, then quickly positions it to the starting point of that layer. The tool then cuts to the machining depth at a speed of 1mm / s. The inter-layer transition path uses a diagonal transition strategy at a 45-degree angle to ensure a smooth transition to the starting position of the next layer.
[0158] The system ultimately converts the complete tool motion trajectory into 3D-compensated trajectory data executable by the machine tool. For CNC machine tools, the system generates ISO-compliant G-code; for industrial robots, it generates motion instructions specific to the brand of controller. The generated trajectory includes XYZ coordinates, feed rates, dwell times, and cooling instructions.
[0159] In this embodiment, by fusing the laser engraving compensation path point sequence with the compensation depth parameters, three-dimensional compensation trajectory data is constructed, so that the compensation processing process has spatial and depth coordination and consistency. Compared with the existing technology that separates the path and depth and lacks a thermodynamic feedback mechanism, this solution introduces cutting force distribution and heat accumulation analysis to achieve dynamic cooling time control of the processing unit, effectively preventing thermal damage and contour deformation. Layered planning is carried out in combination with the material removal characteristics, and the feed speed and the insertion of waiting nodes are adjusted synchronously to improve the continuity of the path and the processing stability. In addition, through the complete tool trajectory generation and timing information integration, the machine tool can accurately perform layered compensation operations, significantly improving the processing accuracy of printing defects and the consistency of the finished product, which is suitable for high-demand automotive parts surface repair scenarios.
[0160] A second aspect of an embodiment of the present invention provides a printed part defect detection system based on machine vision, the system comprising:
[0161] The first unit is used to collect the original image of the printed area on the surface of the automobile part to be inspected through an industrial camera and perform image enhancement processing to obtain an enhanced inspection image;
[0162] The second unit is used to construct a multi-scale gradient pyramid for the enhanced detection image, extract the gradient direction histogram at each scale, calculate the mutual information value of the gradient direction histograms between adjacent scales, determine the optimal detection scale, and perform defect area segmentation at the optimal detection scale to obtain candidate defect areas;
[0163] The third unit is used to perform adaptive binarization processing on the candidate defect area, extract the defect edge contour points, calculate the curvature value of the defect edge contour points, use the contour points with curvature values greater than a preset curvature threshold as key points, perform defect shape discrimination based on the spatial distribution characteristics of the key points, obtain the defect area, extract and classify the texture features of the defect area, and obtain the defect type;
[0164] The fourth unit is used to calculate the coordinates of the defect center of gravity as the origin based on the key point distribution of the defect area, establish a polar coordinate system, calculate the angle-radius distribution of the defect boundary curve, generate a laser engraving compensation path point sequence according to the surface curvature characteristics of the automobile part, and set the laser engraving compensation depth parameter according to the defect type. The laser engraving compensation path point sequence and the laser engraving compensation depth parameter are combined to generate three-dimensional compensation trajectory data, and perform layered compensation processing on the printing defects on the surface of automobile parts.
[0165] According to a third aspect of an embodiment of the present invention, an electronic device is provided, including:
[0166] processor;
[0167] a memory for storing processor-executable instructions;
[0168] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0169] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.
[0170] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting defects in printed parts based on machine vision, characterized in that: include: The original image of the printed area on the surface of the automotive part to be inspected is collected by an industrial camera and image enhancement processing is performed to obtain an enhanced inspection image; A multi-scale gradient pyramid is constructed for the enhanced detection image. The gradient direction histogram at each scale is extracted. The mutual information value of the gradient direction histograms between adjacent scales is calculated to determine the optimal detection scale. The defect area is segmented at the optimal detection scale to obtain candidate defect areas. Adaptively binarize the candidate defect areas, extract the defect edge contour points, calculate the curvature values of the defect edge contour points, and use the contour points with curvature values greater than the preset curvature threshold as key points. Based on the spatial distribution characteristics of the key points, the defect shape is identified to obtain the defect area. The texture features of the defect area are extracted and classified to obtain the defect type. Based on the distribution of key points in the defect area, the coordinates of the defect center of gravity are calculated as the origin, and a polar coordinate system is established to calculate the angle-radius distribution of the defect boundary curve. A laser engraving compensation path point sequence is generated based on the curvature characteristics of the automotive part surface, and the laser engraving compensation depth parameter is set according to the defect type. The laser engraving compensation path point sequence and the laser engraving compensation depth parameter are combined to generate three-dimensional compensation trajectory data, and layered compensation processing is performed on the printed defects on the automotive part surface. A multi-scale gradient pyramid is constructed for the enhanced detection image. The gradient direction histogram at each scale is extracted. The mutual information value of the gradient direction histograms between adjacent scales is calculated to determine the optimal detection scale. The defect area is segmented at the optimal detection scale. The candidate defect areas obtained include: The enhanced detection image is decomposed into multiple scales, and the image is convolved with a variable-scale Gaussian kernel function. The Gaussian kernel parameters are dynamically adjusted based on the inter-layer gradient consistency of the convolution result to construct a multi-scale gradient pyramid. Calculating the horizontal gradient and vertical gradient of a pixel point at each scale layer of the multi-scale gradient pyramid, determining the gradient magnitude and direction, dividing the gradient direction space into a plurality of intervals, and counting the number of gradient points in each interval to construct a gradient direction histogram; Constructing a joint probability distribution matrix, normalizing the joint probability distribution matrix, calculating the mutual information value of the gradient direction histogram of adjacent scale layers based on the normalized joint probability, analyzing the trend curve of the mutual information value changing with scale, extracting the location of the mutation point of the trend curve, and determining the scale layer with the largest mutual information mutation as the optimal detection scale; On the image layer corresponding to the optimal detection scale, the local gradient amplitude of the image pixel points is calculated, and the pixel points with gradient amplitude greater than the preset gradient threshold are used as seed points. A local detection window is constructed with the seed points as the center, and the gradient covariance matrix within the local detection window is calculated. The growth threshold is determined, and region growth is performed on the seed points according to the growth threshold to obtain the candidate defect area; Analyze the trend curve of mutual information value changing with scale, extract the mutation point position of the trend curve, and determine the scale layer with the largest mutual information mutation as the optimal detection scale. Constructing a trend curve of mutual information value varying with scale, constructing a structure tensor for the local structure of the trend curve, adaptively determining a weight coefficient based on the eigenvalue distribution of the structure tensor, and performing nonlinear local weighting on the trend curve to obtain an enhanced trend curve; The normalized difference of the enhanced trend curve at adjacent scale layers is calculated, and an adaptive threshold is constructed based on the local gradient density distribution. The mutation characteristics of the trend curve are extracted based on the adaptive threshold. At the same time, the enhanced trend curve is subjected to wavelet decomposition to extract the curvature coefficient at different scales. A mutation point detection operator is constructed based on the multi-scale response of the curvature coefficient. Adaptively fusing the mutation feature with a mutation point detection operator to construct a mutation point evaluation function, analyzing the time-frequency characteristics of the mutation point evaluation function, extracting the main frequency component of the feature response, determining a set of candidate mutation points of a trend curve based on the main frequency component, constructing a local phase consistency map at each scale layer of the candidate mutation point set, and calculating complementary texture features of the local phase consistency map and the gradient direction field; The reliability of the candidate mutation points is verified based on the complementary texture features, and the scale layer with the maximum mutual information mutation is selected as the optimal detection scale.
2. The method according to claim 1, characterized in that Adaptive binarization is performed on the candidate defect area to extract the defect edge contour points, calculate the curvature value of the defect edge contour points, and use the contour points with curvature values greater than the preset curvature threshold as key points. The defect shape is identified based on the spatial distribution characteristics of the key points. The defect area includes: Constructing a multi-directional filter bank for the candidate defect area, calculating the response intensity in each direction, extracting the maximum response direction from the response intensity as the main direction, and adaptively enhancing the neighborhood of the main direction. Based on the enhanced response intensity, constructing a binarization threshold function, and adaptively binarizing the candidate defect area to obtain a binarized image. A dual boundary tracking operator is constructed and used to track boundaries in a binarized image to extract candidate contour points with dual boundary responses. The candidate contour points are screened based on the continuity of the main direction, and the candidate contour points whose main direction continuity meets a preset continuity condition are determined as defect edge contour points. An annular neighborhood that changes with the main direction is constructed with the defect edge contour point as the center, and the curvature value of the contour point is calculated within the annular neighborhood; A dynamic curvature threshold is set according to the continuity of the main direction, and contour points whose curvature values exceed the dynamic curvature threshold are marked as key points; The spatial position sequence of the key points is extracted, the polar coordinate parameters between adjacent key points are calculated based on the main direction, a shape feature vector including distance ratio and angle difference is constructed, and the shape feature vector is used to distinguish the defect shape and obtain the defect area.
3. The method according to claim 1, characterized in that Texture feature extraction and classification of defect areas are performed, and the defect types obtained include: The edge features of the directional gradient histogram are extracted from the defect area at multiple scales, and the gradient amplitude is used for weighting. The local texture features are constructed through non-uniform sampling and adaptive binarization to obtain the edge texture feature vector. The gray level co-occurrence matrix of the defect area is calculated based on multiple angles and multiple distances, the window size is dynamically determined according to the regional complexity to extract contrast and correlation information, and weighted processing is performed in combination with the local variance distribution to obtain a statistical texture feature vector; Tracking and locating the boundary of the defect area and calculating the edge curvature distribution, constructing the defect skeleton structure and extracting branch connectivity information, and generating a shape feature vector in combination with regional distance transformation; Normalizing the edge texture feature vector, the statistical texture feature vector, and the shape feature vector, calculating the ratio of the inter-class distance between features to the intra-class variance as a weight coefficient, selecting and combining features according to the weight coefficient to obtain a combined feature vector; The defect area is divided into linear defect area and block defect area using the shape feature vector, and the type of the divided defect area is identified by combining the combined feature vector. At the same time, a spatial association matrix of the defect area is constructed to optimize the defect type identification results. The identification results with identification confidence less than a preset confidence threshold are subjected to feature cross-validation, and the defect type is output.
4. The method according to claim 1, wherein Based on the key point distribution of the defect area, the coordinates of the defect center of gravity are calculated as the origin, a polar coordinate system is established, and the angle-radius distribution of the defect boundary curve is calculated. According to the surface curvature characteristics of the automotive parts, a laser engraving compensation path point sequence is generated, including: Calculating the local density contribution values of key points within the defect area at multiple Gaussian kernel scales, performing nonlinear mapping on the density contribution values to obtain key point importance scores, and using the importance scores as weight coefficients to calculate the coordinates of the defect center of gravity through iterative weighted least squares method; A polar coordinate system is established with the coordinates of the defect center of gravity as the origin, the angle sampling interval is dynamically adjusted based on the local curvature value of the defect boundary contour point, the curvature variance of adjacent sampling points is calculated, and the curvature variance is used as a weight coefficient to perform weighted calculation on the radial distance of the boundary point to generate the angle-radius distribution of the defect boundary curve; The moving least squares method is used to calculate the normal vector change rate of the automobile part surface around the defect area. The curvature feature area is divided according to the normal vector change rate. A compensation function is constructed in each curvature feature area to deform the angle-radius distribution and generate a laser engraving compensation path point sequence.
5. The method according to claim 1, wherein Combining the laser engraving compensation path point sequence and the laser engraving compensation depth parameters to generate three-dimensional compensation trajectory data, and performing layered compensation processing on the printing defects on the surface of automotive parts includes: Calculating the cutting force distribution of the laser engraving compensation path point sequence during the machining process, obtaining a heat accumulation value of the cutting process, dividing the laser engraving compensation path point sequence into a plurality of machining units, and determining a cooling time interval for each machining unit based on the heat accumulation value; Determine the total number of processing layers according to the material removal characteristics, distribute the laser engraving compensation depth parameter according to the number of processing layers, calculate the material removal amount of each layer, and generate a layered processing sequence; Combined with the cooling time interval, the feed rate of each processing unit is calculated, the laser engraving compensation path point sequence is converted into a motion trajectory with feed rate, and waiting nodes are inserted between adjacent reciprocating paths; Synchronously combining the layered machining sequence with the motion trajectory with feed speed to generate rough machining trajectory data containing timing information, adding tool lift and cutter position to the rough machining trajectory data, planning the inter-layer transition path, and establishing a complete tool motion trajectory; The complete tool motion trajectory is converted into three-dimensional compensation trajectory data executable by a machine tool, which is used for layered compensation processing of printing defects on the surface of automobile parts.
6. A printed part defect detection system based on machine vision, used to implement the method according to any one of claims 1 to 5, characterized in that: include: The first unit is used to collect the original image of the printed area on the surface of the automobile part to be inspected through an industrial camera and perform image enhancement processing to obtain an enhanced inspection image; The second unit is used to construct a multi-scale gradient pyramid for the enhanced detection image, extract the gradient direction histogram at each scale, calculate the mutual information value of the gradient direction histograms between adjacent scales, determine the optimal detection scale, and perform defect area segmentation at the optimal detection scale to obtain candidate defect areas; The third unit is used to perform adaptive binarization processing on the candidate defect area, extract the defect edge contour points, calculate the curvature value of the defect edge contour points, use the contour points with curvature values greater than a preset curvature threshold as key points, perform defect shape discrimination based on the spatial distribution characteristics of the key points, obtain the defect area, extract and classify the texture features of the defect area, and obtain the defect type; The fourth unit is used to calculate the coordinates of the defect center of gravity as the origin based on the key point distribution of the defect area, establish a polar coordinate system, calculate the angle-radius distribution of the defect boundary curve, generate a laser engraving compensation path point sequence according to the surface curvature characteristics of the automobile part, and set the laser engraving compensation depth parameter according to the defect type. The laser engraving compensation path point sequence and the laser engraving compensation depth parameter are combined to generate three-dimensional compensation trajectory data, and perform layered compensation processing on the printing defects on the surface of automobile parts.
7. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Watch shell surface detection system and method based on machine vision
CN118032789A
Knitted fabric defect detection method and system based on machine vision
CN119228805A