Workpiece surface defect detection method and system based on optical technology
Through the detection method based on optical technology, the light source and focal length are dynamically adjusted, combined with geometric compensation and image fusion technology, the efficiency and accuracy problems of traditional detection methods in areas with large curvature are solved, and high-precision workpiece surface defect detection is achieved.
Patent Information
- Application Number
- CN202411509843.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional workpiece surface defect detection methods are inefficient and difficult to achieve high-precision and high-efficiency detection. Especially in areas with large curvature, existing optical detection technologies have problems of image distortion and information loss.
Using detection methods based on optical technology, the geometric profile data and curvature model of the workpiece are obtained through low-resolution optical scanning, dynamically adjust the illumination angle and focal length of the light source to ensure that the light rays evenly cover areas with large curvature changes, and perform multi-angle imaging acquisition. Curvature models perform geometric compensation and image fusion, extract and classify defect features.
It significantly improves the efficiency and accuracy of workpiece surface defect detection, reduces the occurrence of image distortion, realizes clear imaging on complex surfaces and high-precision defect feature extraction, and improves production efficiency and product quality.
Smart Images

Figure CN119413802A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of optical detection technology, and in particular to a workpiece surface defect detection method and system based on optical technology. Background Art
[0002] In modern manufacturing, the quality of workpiece surface directly affects the performance and service life of the product. Traditional surface defect detection methods mostly rely on manual inspection or mechanical contact measurement, which are not only inefficient but also easily affected by the operator's experience, resulting in inconsistent detection results. In addition, with the diversification of materials and the complexity of surface shapes, especially on workpiece surfaces with large curvatures, the limitations of traditional detection technology have become more and more obvious, making it difficult to achieve high-precision and high-efficiency detection. This makes it extremely difficult to identify and classify surface defects during the production process, thereby increasing the rework rate and material waste of products and affecting production efficiency.
[0003] Although existing optical inspection technologies have improved the automation and accuracy of inspections to a certain extent, they still face many challenges. For example, when dealing with complex geometric shapes and areas with large curvature changes, existing technologies often cannot effectively avoid image distortion and information loss, resulting in inaccurate extraction of defect features. In addition, the unevenness of light source illumination and insufficient focus adjustment also seriously affect the imaging quality.
[0004] Therefore, there is an urgent need for a new workpiece surface defect detection method and system based on optical technology to solve the above problems. Summary of the invention
[0005] Based on the above objectives, the present invention provides a method and system for detecting workpiece surface defects based on optical technology.
[0006] A method for detecting surface defects of a workpiece based on optical technology comprises the following steps:
[0007] S1: Perform low-resolution optical scanning on the workpiece surface to obtain its geometric profile data, extract the curvature change area through calculation, and generate a curvature model of the workpiece;
[0008] S2: According to the curvature model of S1, the irradiation angle and spot shape of the light source are dynamically adjusted, and multi-angle irradiation is adopted to ensure that the light can evenly cover the area with large curvature changes;
[0009] S3: Based on the light source adjustment of S2, the focal length of the inspection equipment is adjusted in real time, and the focus is automatically adjusted according to the curvature change of the workpiece, so that different curvature areas can be clearly imaged;
[0010] S4: The workpiece is imaged and collected from multiple angles simultaneously to obtain multi-view image data;
[0011] S5: Based on the multi-view image data obtained in S4, the curvature model is used for geometric compensation to correct the image distortion caused by the change of surface curvature, and the multi-angle images are fused into a high-precision workpiece surface image;
[0012] S6: Extract the defect features on the workpiece surface from the image corrected in S5, classify the defects and mark their locations, and generate a defect detection report.
[0013] Optionally, the S1 specifically includes:
[0014] S11: Use laser scanning or structured light scanning technology to scan the surface of the workpiece to generate three-dimensional point cloud data with low resolution;
[0015] S12: Processing the three-dimensional point cloud data obtained in S11, specifically applying a data filtering algorithm to remove noise points, and using an interpolation algorithm to reconstruct the surface geometry, thereby generating geometric contour data of the workpiece;
[0016] S13: according to the geometric contour data obtained in S12, a curvature calculation algorithm is used to calculate the curvature value of each point, and a region with a large curvature change is identified and extracted by setting a threshold, and then the region with a large change is marked as a curvature change region;
[0017] S14: Processing the curvature change area data extracted in S13, and constructing a curvature model of the workpiece using surface fitting technology.
[0018] Optionally, the S14 specifically includes:
[0019] S141: Obtain all marked points from the curvature change area data extracted in S13, and extract the three-dimensional coordinate information of the corresponding points;
[0020] S142: Selecting a least squares surface fitting algorithm to minimize the gap between the fitted surface and the actual measurement data;
[0021] S143: defining the form of the surface function according to actual needs, specifically using a quadratic surface model to describe the shape of the workpiece surface through a plurality of preset coefficients to reflect the relationship between different points;
[0022] S144: Analyzing the error to find the optimal surface coefficient;
[0023] S145: Using the coefficients obtained by the solution, the curvature modulus of the workpiece is constructed.
[0024] Optionally, the S2 specifically includes:
[0025] S21: extract curvature information from the curvature model generated by S1, and obtain the curvature value of each point and the corresponding spatial coordinates;
[0026] S22: according to the geometric features of the workpiece and the preset light source position, the initial irradiation angle and spot shape are set, and the initial parameters are used as the basis for dynamic adjustment;
[0027] S23: analyzing the curvature change area, identifying the area with a large change in the curvature model, determining the area that needs to be focused on, and calculating the optimal irradiation angle for the focused area;
[0028] S24: According to the calculated optimal irradiation angle, the irradiation angle of the light source is adjusted so that the contact angle between the light and the surface of the workpiece reaches the optimal angle;
[0029] S25: According to the adjustment result of the irradiation angle, the light spot shape is changed, and the divergence angle and the beam shape of the light source are controlled to ensure that the light is evenly distributed in different curvature areas.
[0030] Optionally, the S3 specifically includes:
[0031] S31: first extract the curvature value of each point and its corresponding spatial coordinates from the curvature model generated by S1;
[0032] S32: Analyze the optical characteristics of each point according to the curvature value extracted from the curvature model, and determine the parameters for focal length adjustment;
[0033] S33: Calculate the optimal focal length f using a preset focal length adjustment formula, the formula is: Where d is the initial distance from the light source to the detection device, C is the curvature value, and n is the refractive index of the material;
[0034] S34: adjusting the focus position of the detection device in real time according to the calculated optimal focal length.
[0035] Optionally, the S4 specifically includes:
[0036] S41: Multiple imaging devices, including cameras and optical sensors, are arranged around the workpiece from multiple preset angles to ensure coverage of all viewing angles;
[0037] S42: Control the synchronous triggering of multiple imaging devices to ensure that all devices acquire images at the same time to avoid image distortion caused by time difference;
[0038] S43: transmitting the real-time collected image data to the central processing unit via a high-speed transmission protocol for storage;
[0039] S44: geometrically calibrate the collected multi-view images to ensure that images from different viewpoints are accurately aligned to obtain multi-view image data.
[0040] Optionally, the S5 specifically includes:
[0041] S51: using the curvature model generated in S1, analyzing the imaging distortion of each image, and using the inverse transformation method to perform image correction according to the characteristics of different curvature regions;
[0042] S52: After image correction is completed, an image fusion algorithm is used to fuse the corrected multi-view images to generate a high-precision workpiece surface image. Specifically, a weighted average method is used to synthesize multiple images at the same position.
[0043] S53: Output the fused high-precision workpiece surface image for subsequent defect detection and analysis.
[0044] Optionally, the S6 specifically includes:
[0045] S61: preprocessing the high-precision image corrected by S5, including noise removal and contrast enhancement;
[0046] S62: Use Canny edge detection algorithm to extract edge features of the workpiece surface;
[0047] S63: Apply morphological analysis to the extracted edge features to identify different defect areas, including cracks, dents, and scratches;
[0048] S64: Use machine learning algorithms to classify and label the extracted defect features and generate a defect detection report.
[0049] Optionally, the machine learning algorithm includes a support vector machine or a convolutional neural network; the defect detection report includes defect type, location and size information.
[0050] A workpiece surface defect detection system based on optical technology, used to implement the above-mentioned workpiece surface defect detection method based on optical technology, includes the following modules:
[0051] Geometric profile data acquisition module: Use low-resolution optical scanning equipment to perform preliminary scanning on the workpiece surface to obtain geometric profile data, and remove noise through data filtering algorithm to generate geometric profile data containing the spatial coordinate information of each point;
[0052] Curvature analysis module: Based on the geometric contour data, the curvature value of each point is calculated, and the area with large curvature changes is identified by setting a threshold, and the curvature model of the workpiece is generated;
[0053] Light source adjustment module: dynamically adjusts the illumination angle and spot shape of the light source according to the curvature model to ensure that the light evenly covers the area with large curvature changes;
[0054] Focus adjustment module: used to adjust the focus of the detection equipment in real time so that different curvature areas can be clearly imaged;
[0055] Image acquisition module: used to simultaneously acquire images of the workpiece from multiple angles to obtain multi-view image data;
[0056] Image correction and fusion module: Based on multi-view image data, the curvature model is used for geometric compensation to correct image distortion caused by surface curvature changes, and multi-angle images are fused into a high-precision workpiece surface image;
[0057] Defect detection and reporting module: Based on the corrected image, the defect features on the workpiece surface are extracted, and the defects are classified and marked through machine learning algorithms to generate a defect detection report.
[0058] Beneficial effects of the present invention:
[0059] The present invention can significantly improve the efficiency and accuracy of workpiece surface defect detection by adopting a detection method based on optical technology. The method ensures uniform light coverage in different curvature areas by dynamically adjusting the illumination angle and focal length of the light source, thereby effectively reducing image distortion caused by uneven illumination. The application of this technology enables clear imaging even on complex surfaces, thereby improving the accuracy of defect feature extraction.
[0060] The present invention can efficiently correct image distortion caused by curvature changes through geometric compensation and image fusion technology to ensure the reliability of detection results. At the same time, it adopts machine learning algorithms to classify and mark defects, which not only improves the automation level of detection, but also provides strong data support for subsequent quality control, thereby further improving production efficiency and product quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0062] Figure 1 A schematic diagram of a workpiece surface defect detection method according to an embodiment of the present invention;
[0063] Figure 2 Schematic diagram of a workpiece surface defect detection system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. At the same time, it is explained here that in order to make the embodiments more detailed, the following embodiments are the best and preferred embodiments, and those skilled in the art may also adopt other alternatives to implement some known technologies; and the accompanying drawings are only for more specific description of the embodiments, and are not intended to specifically limit the present invention.
[0065] It should be noted that the references to "one embodiment", "an embodiment", "an exemplary embodiment", "some embodiments" and the like in the specification indicate that the embodiments described may include specific features, structures or characteristics, but not every embodiment may include the specific features, structures or characteristics. In addition, when a specific feature, structure or characteristic is described in conjunction with an embodiment, it should be within the knowledge of a person skilled in the art to implement such feature, structure or characteristic in conjunction with other embodiments (whether or not explicitly described).
[0066] In general, a term can be understood, at least in part, from its use in context. For example, depending, at least in part, on the context, the term "one or more" as used herein can be used to describe any feature, structure, or characteristic in the singular sense, or can be used to describe a combination of features, structures, or characteristics in the plural sense. Additionally, the term "based on" can be understood as not necessarily intended to convey an exclusive set of factors, but can instead, depending, at least in part, on the context, allow for the presence of other factors that are not necessarily explicitly described.
[0067] like Figure 1 As shown, a method for detecting surface defects of a workpiece based on optical technology comprises the following steps:
[0068] S1: Perform low-resolution optical scanning on the workpiece surface to obtain its geometric profile data, extract the curvature change area through calculation, and generate the curvature model of the workpiece as the basis for subsequent light source adjustment and focal length adjustment;
[0069] S2: According to the curvature model of S1, the illumination angle and spot shape of the light source are dynamically adjusted, and multi-angle illumination is adopted to ensure that the light can evenly cover the area with large curvature changes, so as to avoid uneven light affecting subsequent image acquisition;
[0070] S3: Based on the light source adjustment of S2, the focal length of the inspection equipment is adjusted in real time, and the focus is automatically adjusted according to the curvature change of the workpiece, so that different curvature areas can be clearly imaged;
[0071] S4: The workpiece is imaged and collected from multiple angles simultaneously to ensure that the focal length and light source adjusted by S3 can fully cover every curved surface area of the workpiece and obtain multi-view image data;
[0072] S5: Based on the multi-view image data obtained in S4, the curvature model is used for geometric compensation to correct the image distortion caused by the change of surface curvature, and the multi-angle images are fused into a high-precision workpiece surface image;
[0073] S6: Extract the defect features on the workpiece surface from the image corrected in S5, classify the defects and mark their locations, and generate a defect detection report.
[0074] S1 specifically includes:
[0075] S11: Use laser scanning or structured light scanning technology to scan the surface of the workpiece to generate low-resolution three-dimensional point cloud data. The scanning process uses light emitted by a laser or light source to illuminate the surface of the workpiece and capture the reflected light through a receiver to form a corresponding surface point cloud;
[0076] S12: Processing the three-dimensional point cloud data obtained in S11, specifically applying a data filtering algorithm to remove noise points, and using an interpolation algorithm to reconstruct the surface geometry, thereby generating geometric contour data of the workpiece, which includes spatial coordinate information of each point;
[0077] The calculation steps for generating the geometric contour data of the workpiece are as follows:
[0078] First, the median filter algorithm is used to preprocess the 3D point cloud data. The formula of median filter is: i =Median(P i-1 , P i , P i+1 ), where P i is the coordinate of the current point; P i-1 and P i+1 are the coordinates of the adjacent points before and after the current point respectively; Median(x1,x2,x3) represents the function of performing median operation on the three values of x1, x2, and x3;
[0079] Next, a threshold T is set to judge the outliers in the point cloud. The formula is as follows: |P i -μ|>T, where μ is the mean of the point cloud data, calculated as: Where N is the total number of points in the point cloud; if a point P i If the difference from the mean μ exceeds the threshold T, the point is marked as noise and filtered out;
[0080] Then, after removing the noise, the surface geometry is reconstructed using an interpolation algorithm. Cubic spline interpolation can be used, and the interpolation function expression is: S(x) = a i +b i (xx i )+ci (xx i ) 2 +d i (xx i ) 3 , where S(x) is the interpolation function, a i ,b i ,c i ,d i is the unknown coefficient, x i is the horizontal coordinate of the control point. By solving these coefficients, a smooth surface can be generated and the geometric contour of the workpiece can be obtained;
[0081] Finally, the point cloud data processed in the above steps is combined to generate geometric contour data containing the spatial coordinate information of each point to ensure the integrity and accuracy of the data.
[0082] S13: according to the geometric contour data obtained in S12, a curvature calculation algorithm is used to calculate the curvature value of each point, and a region with a large curvature change is identified and extracted by setting a threshold, and then the region with a large change is marked as a curvature change region;
[0083] The steps to calculate the curvature value of each point are as follows:
[0084] Application of curvature calculation algorithm: According to the geometric contour data obtained in step S12, the curvature value of each point is calculated using the discrete point curvature calculation formula. Specifically, for any point P i , curvature K i The calculation formula is: K i Among them, K i For point P i The curvature value of For point P i The normal vector gradient, f(x,y) is the function describing the surface, is the modulus of its gradient;
[0085] Calculation of curvature value: Calculate the normal vector N of each point based on the obtained geometric contour data i and its gradient, obtained by solving the rate of change of the normal vector Specifically through the neighborhood point P j Calculate the normal vector N i , the formula is: Among them, P j and P k P i Neighboring points, calculate the curvature K of each point i And save it into an array;
[0086] Set a threshold to extract the curvature area: Set a curvature threshold T k, which is used to determine which points have significant changes in curvature, and to identify areas with large changes in curvature using the following formula: in, is the mean of all curvature values, calculated as: Where N is the total number of curvature values;
[0087] Extract the curvature change area and mark it: traverse the curvature array and select the curvature threshold T k The judgment conditions are used to identify points with large curvature changes and mark them as curvature change areas. This can be done by storing all points that meet the conditions in a list for subsequent processing. The expression for identification is: Among them, R is the point set of the curvature change area.
[0088] S14: Process the curvature change area data extracted in S13, and use surface fitting technology to construct a curvature model of the workpiece to ensure that the model can accurately reflect the curvature characteristics of the workpiece surface, providing a reliable basis for subsequent light source adjustment and focal length adjustment; through the above steps, the geometric contour data obtained by the low-resolution optical scanning technology and the generated curvature model can effectively identify the curvature changes on the workpiece surface, ensuring the accuracy and reliability of subsequent defect detection.
[0089] The curvature model of the workpiece constructed in S14 specifically includes:
[0090] S141: Obtain all marked points from the curvature change area data extracted in S13, and extract the three-dimensional coordinate information of the corresponding points, which will be used in the subsequent surface fitting process;
[0091] S142: Selecting a surface fitting algorithm of the least square method to minimize the gap between the fitted surface and the actual measured data, the algorithm evaluates the accuracy of the fitting by calculating the error;
[0092] S143: defining the form of the surface function according to actual needs, specifically using a quadratic surface model to describe the shape of the workpiece surface through a plurality of preset coefficients to reflect the relationship between different points;
[0093] S144: Analyzing the error to solve the optimal surface coefficient. This process involves calculating the partial derivative of the error to determine the optimal value of each coefficient, thereby achieving the best match between the surface and the data.
[0094] S145: Using the coefficients obtained by the solution, the curvature model of the workpiece is constructed. The model can accurately describe the curvature change of the workpiece surface. Through the above steps, the surface fitting technology can effectively construct the curvature model of the workpiece, provide accurate geometric information, and lay the foundation for subsequent defect detection and analysis.
[0095] The calculation steps for constructing the curvature model of the workpiece are as follows:
[0096] Data preparation: First, obtain all points P marked as curvature change areas from the curvature change area data R extracted in step S13 i , and extract its three-dimensional coordinates, which will be used for subsequent surface fitting;
[0097] Selection of surface fitting algorithm: Select an appropriate surface fitting algorithm. Commonly used algorithms include least squares fitting and B-spline surface fitting. Taking the least squares method as an example, its goal is to minimize the following error function: Among them, E is the fitting error, which indicates the gap between the fitting surface and the actual data; N is the total number of points in the curvature change area, which indicates the number of points involved in the fitting; i is the actual height value of the i-th point; f(x i ,y i ) is the surface function to be fitted, indicating that at point (x i ,y i ) at the fitting height;
[0098] Definition of surface function: Select the appropriate surface function form according to the actual situation. The commonly used form is quadratic surface, expressed as: f(x, y) = Ax 2 +By 2 +Cxy+Dx+Ey+F, where A is x 2 The coefficient of the term, B is y 2 The coefficient of the term, C is the coefficient of the xy term, D is the coefficient of the x term, E is the coefficient of the y term, and F is the constant term;
[0099] Solving the fitting coefficients: Solve the partial derivatives of the error function E to obtain the optimal fitting coefficients, and set the partial derivative of each coefficient to zero, expressed as: in, is the partial derivative of the error function with respect to the coefficient A; other partial derivatives are similar, representing the partial derivatives with respect to the corresponding coefficients; by solving these equations, the optimal fitting coefficients A, B, C, D, E, F are obtained;
[0100] Finally, the surface function f(x, y) is substituted into the curvature model of the workpiece using the coefficients obtained. The model will accurately reflect the curvature change of the workpiece in the form of: Where: K(x,y) is the curvature value at the point (x,y); is the gradient modulus of the function f(x, y), and its calculation formula is: in, is the partial derivative of function f with respect to x; is the partial derivative of the function f with respect to y.
[0101] S2 specifically includes:
[0102] S21: extracting curvature information from the curvature model generated by S1, obtaining the curvature value of each point and the corresponding spatial coordinates, which will be used for subsequent light source adjustment;
[0103] S22: according to the geometric features of the workpiece and the preset light source position, the initial irradiation angle and spot shape are set, and the initial parameters are used as the basis for dynamic adjustment;
[0104] S23: Analyze the curvature change area, identify the area with large changes in the curvature model, determine the area that needs to be irradiated, and calculate the best irradiation angle for the area that needs to be irradiated. Specifically, the curvature value of each point is calculated to distinguish. The formula is: Among them, z represents the height of the workpiece surface, and x and y are the plane coordinates of the workpiece respectively. By setting a threshold, the area with a large curvature change is identified, that is, when the curvature value C is greater than the set threshold, the point is marked as a change area. Next, the optimal irradiation angle is calculated, and the following formula is used according to the relationship between the incident angle of light and the curvature: Among them, arctan is the inverse tangent function, θ represents the optimal irradiation angle, and d is the distance from the light source to the workpiece surface. Through these calculations, the area that needs to be focused on and the optimal irradiation angle are determined. By calculating this angle, it can be ensured that the light is irradiated to the workpiece surface at the optimal angle, thereby improving the irradiation effect of the light and the subsequent image acquisition quality;
[0105] S24: According to the calculated optimal irradiation angle, the irradiation angle of the light source is adjusted to optimize the contact angle between the light and the workpiece surface, and by changing the relative position between the light source and the workpiece, it is ensured that the light is more fully irradiated in the area with a large curvature change;
[0106] S25: According to the adjustment result of the irradiation angle, the light spot shape is changed, and the divergence angle and the beam shape of the light source are controlled to ensure that the light is evenly distributed in different curvature areas, thereby avoiding image acquisition problems caused by uneven light.
[0107] S3 specifically includes:
[0108] S31: first extract the curvature value of each point and its corresponding spatial coordinates from the curvature model generated by S1, and these data will be used to determine the optimal focus position;
[0109] S32: Analyze the optical characteristics of each point according to the curvature value extracted from the curvature model and determine the parameters for focal length adjustment. This process takes into account the change of curvature to ensure that the dynamic adjustment of the focal length can adapt to the imaging requirements of different curvature areas.
[0110] S33: Calculate the optimal focal length f using a preset focal length adjustment formula, the formula is: Among them, d is the initial distance from the light source to the detection device, C is the curvature value, and n is the refractive index of the material. Through this formula, the optimal focal length suitable for different curvature areas can be calculated in real time;
[0111] S34: Adjust the focus position of the detection equipment in real time according to the calculated optimal focal length, and ensure that the focus is on different curvature areas of the workpiece by controlling the focusing mechanism of the equipment, so that clear imaging can be achieved during the image acquisition process.
[0112] S4 specifically includes:
[0113] S41: Multiple imaging devices, including cameras and optical sensors, are arranged around the workpiece from multiple preset angles to ensure coverage of all viewing angles, thereby fully capturing the geometric features of the workpiece;
[0114] S42: Control the synchronous triggering of multiple imaging devices to ensure that all devices collect images at the same time, avoid image distortion caused by time difference, and ensure the consistency of acquired data;
[0115] S43: transmitting the real-time collected image data to the central processing unit through a high-speed transmission protocol for storage, ensuring the integrity and real-time nature of the data during the imaging process for subsequent processing;
[0116] S44: Perform geometric calibration on the collected multi-view images to ensure accurate alignment of images at different viewpoints and obtain multi-view image data to support subsequent defect detection and analysis. Through the above steps, comprehensive multi-angle imaging acquisition of the workpiece can be achieved to ensure high-quality image data, providing a solid foundation for subsequent detection.
[0117] S5 specifically includes:
[0118] S51: using the curvature model generated in S1, analyzing the imaging distortion of each image, and using the inverse transformation method to perform image correction according to the characteristics of different curvature regions;
[0119] The specific steps are as follows:
[0120] Get curvature information: Extract the curvature value k(x, y) of the corresponding point in each image from the curvature model, where k represents the curvature and (x, y) is the original image coordinate;
[0121] Calculate the compensation offset: Calculate the compensation offset of each point according to the curvature value. The offset can be obtained by the following formula: and Among them, Δx and Δy are the compensation values of the image coordinates, and is the image intensity gradient at point (x, y);
[0122] Adjusting image coordinates: Using the compensation offset to adjust the original image coordinates to obtain compensated image coordinates, the adjustment formula is: x′=x+Δx and y′=y+Δy, where (x′, y′) is the compensated image coordinates and (x, y) is the original image coordinates;
[0123] Apply the adjustment results: The compensated coordinates obtained through the above calculations are used to generate the corrected image, ensuring that the image distortion caused by the curvature change is corrected.
[0124] S52: After image correction is completed, an image fusion algorithm is used to fuse the corrected multi-view images to generate a high-precision workpiece surface image. Specifically, a weighted average method is used to synthesize multiple images at the same position. The formula is: Among them, I f (x, y) is the fused image, I i (x, y) is the ith corrected image, w i is the weight to ensure that the fused image retains the characteristics of each perspective;
[0125] S53: Output the fused high-precision workpiece surface image for subsequent defect detection and analysis to ensure that the details in different curvature areas are retained; through the above steps, geometric compensation and image fusion based on the curvature model can be effectively realized to generate accurate workpiece surface images, providing a high-quality data basis for subsequent detection.
[0126] S6 specifically includes:
[0127] S61: Before extracting the surface defect features of the workpiece, the high-precision image corrected by S5 is preprocessed, including noise removal and contrast enhancement, to improve the detection accuracy of the subsequent algorithm;
[0128] Noise removal uses Gaussian filtering algorithm to smooth the image and reduce random noise in the image. The formula is: Among them, I filtered (x, y) is the filtered image, σ is the standard deviation, and k is the size of the filter window;
[0129] Contrast enhancement uses histogram equalization to increase the contrast of the image, making defects more obvious and easier to be recognized by subsequent algorithms;
[0130] S62: Use Canny edge detection algorithm to extract edge features of the workpiece surface;
[0131] The Canny edge detection algorithm consists of the following steps:
[0132] Gradient calculation: Calculate the gradient of the image in the horizontal and vertical directions using the Sobel operator. The formula is: Among them, G x and G y are the gradient operators in the horizontal and vertical directions respectively;
[0133] Non-maximum suppression: By suppressing the local maximum of the gradient amplitude, the pixels with the largest edge intensity are retained;
[0134] Double threshold detection: Apply high threshold and low threshold to classify edges into strong edges, weak edges and non-edges, and decide the final edge retention.
[0135] S63: Apply morphological analysis to the extracted edge features to identify different defect areas, including cracks, dents, and scratches; the specific steps include:
[0136] Erosion and dilation: Remove noise and small interference through erosion and dilation operations, and operate on the image using structural elements to enhance the visibility of major defect features;
[0137] Feature extraction: Using the region growing algorithm, different defect areas are identified, including cracks, dents and scratches.
[0138] S64: Use machine learning algorithms to classify and mark the extracted defect features and generate a defect detection report; through the above steps, the defect features on the workpiece surface can be effectively extracted, classified and a detailed detection report can be generated to ensure the reliability and consistency of the workpiece quality.
[0139] Machine learning algorithms include support vector machines or convolutional neural networks; defect detection reports include defect type, location, and size information.
[0140] like Figure 2 As shown, a workpiece surface defect detection system based on optical technology is used to implement the above-mentioned workpiece surface defect detection method based on optical technology, including the following modules:
[0141] Geometric profile data acquisition module: Use low-resolution optical scanning equipment to perform preliminary scanning on the workpiece surface to obtain geometric profile data, and remove noise through data filtering algorithm to generate geometric profile data containing the spatial coordinate information of each point;
[0142] Curvature analysis module: Based on the geometric contour data, the curvature value of each point is calculated, and the area with large curvature changes is identified by setting a threshold, and the curvature model of the workpiece is generated to provide a basis for subsequent light source adjustment;
[0143] Light source adjustment module: dynamically adjusts the illumination angle and spot shape of the light source according to the curvature model to ensure that the light evenly covers the area with large curvature changes, avoiding uneven light affecting subsequent image acquisition;
[0144] Focus adjustment module: used to adjust the focus of the detection equipment in real time so that different curvature areas can be imaged clearly to ensure image quality;
[0145] Image acquisition module: used to simultaneously capture images of the workpiece from multiple angles, obtain multi-view image data, and pass it to the next module for processing;
[0146] Image correction and fusion module: Based on multi-view image data, the curvature model is used for geometric compensation to correct image distortion caused by surface curvature changes, and multi-angle images are fused into a high-precision workpiece surface image;
[0147] Defect detection and reporting module: Based on the corrected image, the defect features on the workpiece surface are extracted, and the defects are classified and marked through machine learning algorithms to generate a defect detection report.
[0148] The present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention. In order to make the public have a thorough understanding of the present invention, specific details are described in detail in the following preferred embodiments of the present invention, but those skilled in the art can fully understand the present invention without the description of these details. In addition, in order to avoid unnecessary confusion about the essence of the present invention, well-known methods, processes, procedures, components and circuits are not described in detail.
[0149] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for detecting surface defects of a workpiece based on optical technology, characterized in that: The following steps are involved: S1: Perform low-resolution optical scanning on the workpiece surface to obtain its geometric profile data, extract the curvature change area through calculation, and generate a curvature model of the workpiece; S2: According to the curvature model of S1, the irradiation angle and spot shape of the light source are dynamically adjusted, and multi-angle irradiation is adopted to ensure that the light can evenly cover the area with large curvature changes; S3: Based on the light source adjustment of S2, the focal length of the inspection equipment is adjusted in real time, and the focus is automatically adjusted according to the curvature change of the workpiece, so that different curvature areas can be clearly imaged; S4: The workpiece is imaged and collected from multiple angles simultaneously to obtain multi-view image data; S5: Based on the multi-view image data obtained in S4, the curvature model is used for geometric compensation to correct the image distortion caused by the change of surface curvature, and the multi-angle images are fused into a high-precision workpiece surface image; S6: Extract the defect features on the workpiece surface from the image corrected in S5, classify the defects and mark their locations, and generate a defect detection report.
2. The method for detecting surface defects of a workpiece based on optical technology according to claim 1, characterized in that: The S1 specifically includes: S11: Use laser scanning or structured light scanning technology to scan the surface of the workpiece to generate three-dimensional point cloud data with low resolution; S12: Processing the three-dimensional point cloud data obtained in S11, specifically applying a data filtering algorithm to remove noise points, and using an interpolation algorithm to reconstruct the surface geometry, thereby generating geometric contour data of the workpiece; S13: according to the geometric contour data obtained in S12, a curvature calculation algorithm is used to calculate the curvature value of each point, and a region with a large curvature change is identified and extracted by setting a threshold, and then the region with a large change is marked as a curvature change region; S14: Processing the curvature change area data extracted in S13, and constructing a curvature model of the workpiece using surface fitting technology.
3. The method for detecting workpiece surface defects based on optical technology according to claim 2, characterized in that: The S14 specifically includes: S141: Obtain all marked points from the curvature change area data extracted in S13, and extract the three-dimensional coordinate information of the corresponding points; S142: Selecting a least squares surface fitting algorithm to minimize the gap between the fitted surface and the actual measurement data; S143: defining the form of the surface function according to actual needs, specifically using a quadratic surface model to describe the shape of the workpiece surface through a plurality of preset coefficients to reflect the relationship between different points; S144: Analyzing the error to find the optimal surface coefficient; S145: Using the coefficients obtained by the solution, the curvature modulus of the workpiece is constructed.
4. The method for detecting workpiece surface defects based on optical technology according to claim 1, characterized in that: The S2 specifically includes: S21: extract curvature information from the curvature model generated by S1, and obtain the curvature value of each point and the corresponding spatial coordinates; S22: according to the geometric features of the workpiece and the preset light source position, the initial irradiation angle and spot shape are set, and the initial parameters are used as the basis for dynamic adjustment; S23: analyzing the curvature change area, identifying the area with a large change in the curvature model, determining the area that needs to be focused on, and calculating the optimal irradiation angle for the focused area; S24: According to the calculated optimal irradiation angle, the irradiation angle of the light source is adjusted so that the contact angle between the light and the surface of the workpiece reaches the optimal angle; S25: According to the adjustment result of the irradiation angle, the light spot shape is changed, and the divergence angle and the beam shape of the light source are controlled to ensure that the light is evenly distributed in different curvature areas.
5. The method for detecting surface defects of a workpiece based on optical technology according to claim 1, characterized in that: The S3 specifically includes: S31: first extract the curvature value of each point and its corresponding spatial coordinates from the curvature model generated by S1; S32: Analyze the optical characteristics of each point according to the curvature value extracted from the curvature model, and determine the parameters for focal length adjustment; S33: Calculate the optimal focal length f using a preset focal length adjustment formula, the formula is: Where d is the initial distance from the light source to the detection device, C is the curvature value, and n is the refractive index of the material; S34: adjusting the focus position of the detection device in real time according to the calculated optimal focal length.
6. The method for detecting surface defects of a workpiece based on optical technology according to claim 1, characterized in that: The S4 specifically includes: S41: Multiple imaging devices, including cameras and optical sensors, are arranged around the workpiece from multiple preset angles to ensure coverage of all viewing angles; S42: Control the synchronous triggering of multiple imaging devices to ensure that all devices acquire images at the same time to avoid image distortion caused by time difference; S43: transmitting the real-time collected image data to the central processing unit via a high-speed transmission protocol for storage; S44: geometrically calibrate the collected multi-view images to ensure that images from different viewpoints are accurately aligned to obtain multi-view image data.
7. The method for detecting workpiece surface defects based on optical technology according to claim 1, characterized in that: The S5 specifically includes: S51: using the curvature model generated in S1, analyzing the imaging distortion of each image, and using the inverse transformation method to perform image correction according to the characteristics of different curvature regions; S52: After the image correction is completed, an image fusion algorithm is used to fuse the corrected multi-view images to generate a high-precision workpiece surface image. Specifically, a weighted average method is used to synthesize multiple images at the same position. S53: Output the fused high-precision workpiece surface image for subsequent defect detection and analysis.
8. The method for detecting workpiece surface defects based on optical technology according to claim 1, characterized in that: The S6 specifically includes: S61: preprocessing the high-precision image corrected by S5, including noise removal and contrast enhancement; S62: Use Canny edge detection algorithm to extract edge features of the workpiece surface; S63: Apply morphological analysis to the extracted edge features to identify different defect areas, including cracks, dents, and scratches; S64: Use machine learning algorithms to classify and label the extracted defect features and generate a defect detection report.
9. The method for detecting workpiece surface defects based on optical technology according to claim 8, characterized in that: The machine learning algorithm includes a support vector machine or a convolutional neural network; the defect detection report includes defect type, location and size information.
10. A workpiece surface defect detection system based on optical technology, used to implement a workpiece surface defect detection method based on optical technology as claimed in any one of claims 1 to 9, characterized in that: Includes the following modules: Geometric profile data acquisition module: Use low-resolution optical scanning equipment to perform preliminary scanning on the workpiece surface to obtain geometric profile data, and remove noise through data filtering algorithm to generate geometric profile data containing the spatial coordinate information of each point; Curvature analysis module: Based on the geometric contour data, the curvature value of each point is calculated, and the area with large curvature changes is identified by setting a threshold, and the curvature model of the workpiece is generated; Light source adjustment module: dynamically adjusts the illumination angle and spot shape of the light source according to the curvature model to ensure that the light evenly covers the area with large curvature changes; Focus adjustment module: used to adjust the focus of the detection equipment in real time so that different curvature areas can be clearly imaged; Image acquisition module: used to simultaneously acquire images of the workpiece from multiple angles to obtain multi-view image data; Image correction and fusion module: Based on multi-view image data, the curvature model is used for geometric compensation to correct image distortion caused by surface curvature changes, and multi-angle images are fused into a high-precision workpiece surface image; Defect detection and reporting module: Based on the corrected image, the defect features on the workpiece surface are extracted, and the defects are classified and marked through machine learning algorithms to generate a defect detection report.
Citation Information
Cited By
Microscope adjusting structure, optical module detection device and optical module detection method
CN119620369A
Microscope adjustment structure, optical module detection device and optical module detection method
CN119620369B
2.5 D imaging and AI combined safety buckle full-appearance visual detection method and system
CN119715569A
Optical lens surface defect detection method and system based on image processing
CN119880946A
Socket surface defect detection method and system based on image processing
CN120064298A