Injection molded parts defect detection method and system based on machine vision
By improving the ICP algorithm, using normal vectors and grayscale features to screen neighboring points, calculate the degree of bending, and obtain transformation parameters, the problem of local optimal solution caused by initial posture deviation in injection molded part deformation detection is solved, and high-precision deformation defect detection is achieved.
Patent Information
- Application Number
- CN202510689795.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-05-27
AI Technical Summary
When processing injection molded parts with complex surface geometry, the traditional ICP algorithm is prone to fall into the local optimal solution due to the large initial pose deviation, resulting in low accuracy of deformation area detection results.
By obtaining the three-dimensional spatial points of the injection molded part to be tested, the neighboring points in the same area are selected based on the normal vector and grayscale features, the degree of bending is calculated, the transformation parameters are obtained using singular value decomposition, and the ICP algorithm is improved to eliminate the influence of the initial posture difference and achieve accurate matching.
The accuracy of deformation defect detection of injection molded parts is improved, the local optimal solution problem caused by initial posture deviation of the traditional ICP algorithm is avoided, and accurate matching of the image to be tested and the standard image is achieved.
Smart Images

Figure CN120198440B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and more particularly to a method and system for detecting defects in injection molded parts based on machine vision. Background Art
[0002] In the automotive industry, injection-molded parts such as fuse boxes, ECU housings, and sensor protection boxes play a critical role in encapsulating and securing electronic components and circuitry. During the injection molding process, these parts often experience localized deformation (such as warping and dents) due to uneven cooling rates or material shrinkage. This can lead to reduced assembly accuracy and even functional failure. To ensure product quality, deformation testing is performed after injection molding to assess whether the geometric accuracy meets design requirements.
[0003] In the existing technology, in deformation detection, the iterative closest point (ICP) algorithm is usually used to align the image to be tested and the standard image. The principle of image alignment achieved by this algorithm is: by iteratively calculating the spatial distance error between the spatial point cloud in the image to be tested (which needs to be transformed) and the standard image (fixed), and dynamically adjusting the rigid body transformation parameters (including rotation and translation) until the error converges to the minimum value, finally achieving accurate alignment of the image to be tested and the standard image, so that deformation can be evaluated based on the alignment results.
[0004] However, deformation of an injection molded part can increase the geometric complexity of its surface. If the initial pose of the image to be tested deviates significantly from that of the reference image, the traditional ICP algorithm, which uses global data for transformation parameter optimization, can easily fall into a local optimal solution. Specifically, this initial pose deviation causes the algorithm to adjust parameters in the wrong search direction. Although the error change in a single iteration is small, the overall registration accuracy does not meet the actual requirements, leading to premature termination of the iteration. This ultimately leads to misjudgment or omission of deformed areas, resulting in low accuracy in the detection of deformed defect areas. Summary of the Invention
[0005] In order to solve the problem that the traditional ICP algorithm is prone to falling into the local optimal solution due to large initial posture deviation when processing injection molded parts with complex surface geometry, resulting in misjudgment or missed detection of deformation areas and reduced accuracy of deformation defect detection, the present invention provides an injection molded part defect detection method and system based on machine vision.
[0006] According to a first aspect of the present invention, a method for detecting defects in injection molded parts based on machine vision is provided, comprising:
[0007] Obtain a surface grayscale image of the injection molded part to be tested, obtain the image to be tested, and construct a three-dimensional spatial point, where each spatial point consists of a two-dimensional coordinate position and a depth value of a pixel point;
[0008] Based on the similarity of the positional features and grayscale features of different spatial points, the neighboring points in the same region of each spatial point are screened, and the degree of curvature of each spatial point is quantified by calculating the directional difference between the normal vector of each spatial point and the normal vector of the neighboring points in the same region;
[0009] The image to be tested and the pre-stored standard image are divided into grids. Based on the average difference between the curvatures of all spatial points in any two grid areas in different images, the matching degree of the corresponding two grid areas is calculated. The matching degree is negatively correlated with the average difference.
[0010] Based on the spatial points in the two grid areas with the maximum matching degree, the transformation parameters from the image to be tested to the standard image are obtained by singular value decomposition. Based on the transformation parameters, the ICP algorithm is used to perform transformation alignment on the image to be tested, so as to identify the deformation defects of the image to be tested based on the two aligned images.
[0011] The present invention calculates the matching degree indicator by integrating various data, and can accurately screen out the grid areas in the image to be tested that have not been deformed or have been slightly deformed, as well as the corresponding grid areas in the standard image, and use the transformation parameters when these two grid areas are aligned as the transformation parameters from the image to be tested to the standard image. This can eliminate the influence of the large difference in initial posture between the image to be tested and the standard image, thereby avoiding the problem that the traditional ICP algorithm is prone to falling into the local optimal solution during the iteration process, and improving the accuracy of the transformation parameters, so that the image to be tested and the standard image can be accurately matched, providing a reliable basis for the identification of deformation defect areas.
[0012] Preferably, the method for obtaining the curvature degree of each spatial point includes:
[0013] For any spatial point, the cosine similarity difference between the normal vector of any spatial point and the normal vectors of each neighboring point in the same area is calculated. The squares of the cosine similarity differences are summed and the average is taken. The normalized value of the square root of the average value is used as the curvature degree of any spatial point.
[0014] The present invention utilizes the directional difference value of the normal vector to quantify the curvature degree of each spatial point, which can reduce the difficulty of analyzing the directional difference of each spatial point.
[0015] Preferably, the degree of bending satisfies the following relationship:
[0016] ;
[0017] Where, The image to be tested Middle The degree of curvature of a point in space; The image to be tested Normal vector of a point in space; The image to be tested The first point in space Normal vectors of neighboring points in the same region; is the symbol for cosine similarity; is the symbol for the mean; is the symbol for vector; is the total number of neighboring points in the same area; is the normalization function.
[0018] Preferably, the method for obtaining the normal vector of a space point includes:
[0019] For any spatial point, a curve fitting is performed on the spatial point set consisting of any spatial point and the corresponding neighboring points in the same area to obtain a hyperplane, and based on the hyperplane, the normal vector of each spatial point in the spatial point set is obtained.
[0020] Preferably, the method for obtaining neighboring points in the same area includes:
[0021] Calculate the similarity between different spatial points, and the similarity satisfies the following relationship:
[0022] ;
[0023] Where, The image to be tested Middle A spatial point and The similarity of spatial points; 、 is the order of spatial points; The image to be tested The Euclidean distance between different spatial points in ; The image to be tested Grayscale value of the pixel in ; 、 The images to be tested are Middle spatial points and The gray value of the pixel corresponding to each spatial point; It is a function that returns the maximum value; is the absolute value symbol; is a natural exponential function; the first several spatial points are selected in descending order according to the similarity as the neighboring points of each spatial point in the same region.
[0024] The present invention utilizes the characteristic that the grayscale values of pixels in the deformation area will also change, and introduces the grayscale value characteristic when measuring the similarity of each spatial point, so as to accurately measure the similarity of different spatial points.
[0025] Preferably, based on the average difference between the curvatures of all spatial points in any two grid areas in different images, the matching degree of the corresponding two grid areas is calculated, satisfying the following relationship:
[0026] ;
[0027] Where, The image to be tested The grid area, and the standard image Middle The matching degree of each grid area; For this In the grid area The degree of curvature of a point in space; For this In the grid area The degree of curvature of a point in space; For this The number of spatial points in a grid area; For the The number of spatial points in a grid area; is the natural exponential function.
[0028] The present invention utilizes the characteristic that the degree of bending is not affected by the placement position of the injection molded part, and thus calculates the matching degree of any two images in different images based on the degree of bending. It can eliminate the influence of the posture difference between the image to be tested and the standard image, thereby providing an accurate data basis for the determination of subsequent transformation parameters.
[0029] Preferably, the sizes of the grid areas in the image to be tested and the standard image are the same.
[0030] Preferably, identifying deformation defects of the image to be tested based on the aligned two images includes:
[0031] A preset distance threshold is obtained. For any spatial point in the image to be tested, if the Euclidean distance between any spatial point and the nearest neighboring spatial point in the standard image is greater than the distance threshold, the area where the spatial point is located is judged to be a deformation defect area.
[0032] Preferably, the method for obtaining the depth value includes:
[0033] Depth processing is performed on the image to be tested of the injection molded part to obtain the depth value of each pixel in the image to be tested.
[0034] The present invention introduces the feature of depth value when constructing each spatial point, which can more comprehensively reflect the spatial structure of the object surface.
[0035] According to a second aspect of the present invention, a machine vision-based injection molded part defect detection system is provided. The system includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the first aspect of the present invention.
[0036] The present invention has the following effects:
[0037] This method calculates the matching degree between any two grid regions in different images and determines the transformation parameters from the test image to the reference image based on the spatial points within the two grid regions with the highest matching degree. This method effectively eliminates the influence of posture differences between the test image and the reference image, avoiding the problem of traditional ICP algorithms that can cause the transformation parameter iteration process to fall into a local optimal solution due to large differences in the initial spatial point clouds. This method can improve the accuracy of the transformation parameters, achieve precise matching between the test image and the reference image, and provide a precise imaging foundation for subsequent detection of deformation defects in the test image. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 The figure is a flowchart of the steps of the method for detecting defects of injection molded parts based on machine vision according to an embodiment of the present invention. DETAILED DESCRIPTION
[0039] Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative work shall fall within the scope of protection of the present invention.
[0040] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0041] Reference Figure 1 The method for detecting defects in injection molded parts based on machine vision includes steps S1 to S4, which are specifically as follows:
[0042] S1: Obtain a surface grayscale image of the injection molded part to be tested, obtain the image to be tested, and construct a three-dimensional space point, where each space point consists of a two-dimensional coordinate position and a depth value of a pixel point.
[0043] Among them, the spatial point refers to a point in three-dimensional space, which is composed of the two-dimensional coordinate position of the pixel point (that is, the row and column number of the pixel point in the image to be tested) and the depth value of the pixel point; the injection molded part to be tested refers to any injection molded part.
[0044] It should be noted that injection molded parts often have many areas of inconsistent depth. Relying solely on single-plane feature information for analysis can result in large matching errors. However, images captured by RGBD cameras can not only extract the two-dimensional distribution features within the image, but also obtain the depth information for each pixel in the image. Therefore, to achieve more accurate information, the present invention constructs each spatial point based on two-dimensional coordinate features and depth features.
[0045] Next, the construction process of each spatial point is described in detail:
[0046] First, you can choose a suitable shooting angle and distance to ensure that the image can fully capture the details of the injection molded parts, and use an RGBD camera to collect the test image of the injection molded parts in a uniformly illuminated environment. Then, the row and column numbers of each pixel point in the test image are used as the position coordinates of the corresponding pixel point, and the depth value of each pixel point is obtained by depth processing the test image. Finally, the three-dimensional coordinates composed of the position coordinates and depth values of each pixel point are used as the spatial point corresponding to each pixel point, thereby realizing the construction of spatial points.
[0047] It should be noted that the process of obtaining the grayscale value of each pixel in the image captured by the RGBD camera through depth processing is a prior art and will not be described in detail in this embodiment.
[0048] S2: Based on the similarity of the positional features and grayscale features of different spatial points, the neighboring points in the same region of each spatial point are screened, and the degree of curvature of each spatial point is quantified by calculating the directional difference between the normal vector of each spatial point and the normal vector of the neighboring points in the same region.
[0049] It's important to note that during the injection molding process, localized deformation can occur due to uneven cooling or material shrinkage, causing the edges or internal corners of the component to deviate from their original geometry. A notable characteristic of this deformed area is an abnormal increase in surface curvature, meaning that spatial points within the deformed area exhibit significant directional differences. Therefore, to accurately identify this type of deformation, it's necessary to first identify the neighboring points in the same region surrounding each spatial point, thereby identifying spatial points that may be in the same region.
[0050] It should be further explained that under normal circumstances, the grayscale values of each region of an injection molded part are generally consistent. However, when deformation occurs, the grayscale values of the deformed region will change accordingly due to changes in the surface structure. Therefore, the present invention utilizes this characteristic to screen neighboring points in the same region for each spatial point by analyzing the similarities in positional and grayscale characteristics of different spatial points.
[0051] In an exemplary embodiment of the present invention, the following steps may be used to determine the neighboring points of each spatial point in the same region:
[0052] Calculate the similarity between different spatial points, sort them from high to low according to the similarity, and select the first several spatial points as the neighboring points in the same area of each spatial point.
[0053] Specifically, the similarity between different spatial points satisfies the following relationship:
[0054] ;
[0055] Where, The image to be tested Middle A spatial point and The similarity of spatial points; 、 is the order of spatial points; The image to be tested The Euclidean distance between different spatial points in ; The image to be tested Grayscale value of the pixel in ; 、 The images to be tested are Middle spatial points and The gray value of the pixel corresponding to each spatial point; It is a function that returns the maximum value; is the absolute value symbol; is a natural exponential function, where the natural exponential function refers to a function with a natural constant An exponential function with base .
[0056] in, Reflects the A spatial point and The relative distance between two spatial points. The smaller the value, the more similar the position features of the two corresponding spatial points are, and the greater the similarity between the two corresponding spatial points. It reflects the relative difference in grayscale values between the two spatial points. The smaller the value, the more similar the grayscale features of the two spatial points are, and the greater the similarity between the two spatial points.
[0057] Next, for any spatial point, the process of determining the neighboring points in the same region of the spatial point is described in detail: first, the similarity between the arbitrary spatial point and all other spatial points is calculated, then all other spatial points are sorted in descending order according to the similarity from high to low, and finally, a number of spatial points, such as 5 spatial points, are selected from the front to the back of the ordered spatial point sequence as the neighboring points in the same region of the arbitrary spatial point.
[0058] Furthermore, after the neighboring points in the same region of each spatial point are determined, the directional changes between each spatial point and its neighboring points in the same region can be analyzed to evaluate the curvature of each spatial point.
[0059] It should be noted that for a spatial point in a deformed region, the more pronounced the surface orientation change among its neighboring points in the same region, the more significant the change in surface morphology near that spatial point, indicating a significant surface curvature. Therefore, the present invention utilizes this characteristic to assess the degree of curvature at each spatial point by analyzing the surface orientation changes relative to its local neighboring points.
[0060] However, injection molded parts have distinct three-dimensional features, and their surface orientation is complex and variable, making them difficult to represent directly. Normal vectors, on the other hand, can reflect the orientation of each spatial point relative to the surrounding spatial points. Therefore, by calculating the directional difference between the normal vectors of each spatial point and its neighboring points in the same region, the present invention can quantify the directional variation between each spatial point and its neighboring points in the same region, thus providing a basis for evaluating the degree of curvature.
[0061] In an exemplary embodiment of the present invention, the normal vector of each space point can be determined by the following steps:
[0062] For any spatial point, a curve fitting is performed on the spatial point set consisting of any spatial point and the corresponding neighboring points in the same area to obtain a hyperplane, and based on the hyperplane, the normal vector of each spatial point in the spatial point set is obtained.
[0063] Optionally, a least squares method, principal component analysis method, etc. may be used to fit the spatial point set consisting of each spatial point and its neighboring points in the same region, thereby obtaining a hyperplane corresponding to the spatial point set. This embodiment does not specifically limit the selected fitting method.
[0064] It should be noted that the process of determining the normal vector of each position on the hyperplane is a prior art and will not be described in detail in this embodiment.
[0065] In an exemplary embodiment of the present invention, the determination of the curvature degree of each spatial point can be achieved by the following steps:
[0066] For any spatial point, the cosine similarity difference between the normal vector of any spatial point and the normal vectors of each neighboring point in the same area is calculated. The squares of the cosine similarity differences are summed and the average is taken. The normalized value of the square root of the average value is used as the curvature degree of any spatial point.
[0067] The degree of curvature reflects the curvature condition at the location of the corresponding spatial point.
[0068] Specifically, the curvature of each spatial point satisfies the following relationship:
[0069] ;
[0070] Where, The image to be tested Middle The degree of curvature of a point in space; The image to be tested Normal vector of a point in space; The image to be tested The first point in space Normal vectors of neighboring points in the same region; is a symbol representing cosine similarity, wherein the process of determining the cosine similarity between vectors is prior art and will not be described in detail in this embodiment; is the symbol for the mean; is the symbol for vector; is the total number of neighboring points in the same area. ; is the normalization function.
[0071] Among them, the larger the normalized value is, the better the The greater the degree of dispersion of the cosine similarity between the normal vector of a spatial point and the normal vector of the neighboring points in the same area, the greater the difference in direction between the normal vector of the spatial point and the neighboring points in the same area, that is, the more drastic the change in the direction of the surface around the spatial point is. At this time, it can be determined that the morphology of the surface around the spatial point has changed significantly, and the corresponding curvature of the spatial point is larger.
[0072] In another embodiment, the directional difference between the normal vector of each spatial point and the normal vectors of its neighboring points in the same region can be measured by calculating the average angular difference between the normal vector of each spatial point and the normal vectors of its neighboring points in the same region, normalizing the difference, and then using the resulting normalized value as the degree of curvature of the corresponding spatial point. The angular difference here is the absolute value of the difference between the two corresponding angle values.
[0073] S3: Divide the image to be tested and the pre-stored standard image into grids, and calculate the matching degree of the corresponding two grid areas based on the average difference between the curvatures of all spatial points in any two grid areas in different images. The matching degree is negatively correlated with the average difference.
[0074] It should be noted that on an actual production line, injection molded parts may be placed on a conveyor belt at any angle for image acquisition, resulting in the orientation of the image to be measured being different each time. This in turn leads to differences between the image to be measured and the pre-stored standard image (the surface image of the injection molded part without deformation). The relative positions of the spatial points will change, increasing the complexity of spatial point matching.
[0075] However, due to the fixed shooting angle, the degree of curvature of the spatial points in the normal, undeformed areas of the test image and the corresponding areas in the standard image is essentially the same. This means that the distribution characteristics of the undeformed areas in the captured test image can be found in similar corresponding areas in the standard image. Therefore, the present invention utilizes this characteristic to analyze whether there is a correlation between the distribution characteristics of the spatial points in each grid area in the captured test image and those in each grid area in the standard image, thereby evaluating the degree of match between the two.
[0076] In an exemplary embodiment of the present invention, the sizes of the grid areas in the image to be tested and the standard image are the same.
[0077] For example, if the sizes of the image to be tested and the standard image are When the preset number of divided grid areas is 20, the size of each grid area is ,in ,and and The value of is chosen so that and As close as possible to ensure that the shape of each grid area is relatively regular; is the number of grid areas in the length direction of the image to be tested or the standard image; is the number of grid areas in the width direction of the image to be tested or the standard image.
[0078] Furthermore, after the grid division of the image to be tested and the pre-stored standard image is completed, the matching degree of the corresponding two grid areas can be calculated based on the average difference in the curvature of the spatial points in any two grid areas in different images. Specifically, the matching degree of any two grid areas in different images satisfies the following relationship:
[0079] ;
[0080] Where, The image to be tested The grid area, and the standard image Middle The matching degree of each grid area; For this In the grid area The degree of curvature of a point in space; For this In the grid area The degree of curvature of a point in space; For this The number of spatial points in a grid area; For the The number of spatial points in a grid area; is the natural exponential function.
[0081] in, Reflects the The grid area and the The average difference in the degree of curvature of the spatial points in the two grid areas is the square of the difference between the data (the absolute value of the difference between the data can also be used). The smaller the value, the closer the curvature of the spatial points in the two grid areas is on the whole, which means that the surface morphology of the two grid areas is similar, the distribution characteristics of the spatial points are also relatively consistent, and the corresponding matching degree of the two grid areas is relatively large.
[0082] It should be noted that when any grid area in the test image has the highest degree of match with another grid area in the reference image, that grid area in the test image is likely to be undeformed or minimally deformed, and the other grid area in the reference image is the best match. This is because the degree of curvature of the spatial points in the two images is consistent in the undeformed areas. Furthermore, due to the complex structure of injection molded parts, the degree of curvature often varies at different locations, which makes the areas with the highest degree of match the corresponding areas.
[0083] In another embodiment, the inverse of the average difference may be directly normalized, and the obtained normalized value is used as the matching degree of the corresponding two grid areas.
[0084] S4: Based on the spatial points within the two grid areas with the maximum matching degree, the transformation parameters from the image to be tested to the standard image are obtained through singular value decomposition, and the ICP algorithm is used to perform transformation alignment on the image to be tested based on the transformation parameters, so as to identify the deformation defects of the image to be tested based on the two aligned images.
[0085] It should be noted that due to the non-fixed orientation of injection molded parts, the relative positions of spatial points in different images may differ significantly. This can cause the ICP algorithm to suffer from excessive initial errors or fall into a local optimal solution, resulting in low matching accuracy. Therefore, the present invention improves the traditional ICP algorithm. The specific improvements are as follows: based on the matching degree of any two grid regions in different images, the two grid regions with the highest matching degree are screened out, and based on the spatial point set consisting of all spatial points within these two grid regions, the transformation parameters (i.e., rotation matrix and translation vector) from the image to be tested to the standard image are calculated, thereby replacing the transformation parameters determined by iterative operations in the traditional ICP algorithm. Subsequently, the traditional ICP algorithm is used to perform a transformation alignment operation on the image to be tested to align the image to the standard image.
[0086] The parameter types included in the transformation parameters are fixed parameter types in the ICP algorithm.
[0087] Next, the process of aligning the image to be tested with the standard image is described in detail:
[0088] First, based on the spatial points within the two grid regions with the highest degree of matching, singular value decomposition (SVD) is used to calculate the transformation parameters (including the rotation matrix and translation vector) from the test image to the standard image. It should be noted that using SVD to calculate transformation parameters is a well-known technique in the ICP algorithm and will not be elaborated on in detail here.
[0089] Then, the transformation parameters obtained through the above steps are used as the optimal transformation parameters of the ICP algorithm, and based on the optimal transformation parameters, the ICP algorithm is used to perform a global transformation alignment operation on the image to be tested; specifically, the global area of the image to be tested is transformed according to the transformation parameters so that it is aligned with the standard image, thereby achieving accurate matching between the image to be tested and the standard image.
[0090] Furthermore, after the image to be tested is aligned with the standard image, the deformation defect area in the image to be tested can be identified based on the aligned images.
[0091] In an exemplary embodiment of the present invention, the following steps may be performed to determine the deformation defect area in the image to be measured:
[0092] A preset distance threshold is obtained. For any spatial point in the image to be tested, if the Euclidean distance between any spatial point and the nearest neighboring spatial point in the standard image is greater than the distance threshold, the area where the spatial point is located is judged to be a deformation defect area.
[0093] Among them, the nearest neighbor spatial point refers to the spatial point with the closest distance between different images.
[0094] For example, for any spatial point in the image to be tested, the spatial point in the standard image that has the smallest Euclidean distance or Manhattan distance to the spatial point can be used as the nearest neighboring spatial point of the spatial point.
[0095] Optionally, the distance threshold can be set to 0.5. If the distance between any spatial point in the image to be tested and the nearest spatial point in the standard image is greater than 0.5, it is judged that any spatial point has a deformation defect, so that the positions of all defects can be obtained to form a deformation defect area, thereby realizing accurate detection of deformation defects of the injection molded parts to be tested.
[0096] Alternatively, based on the aligned image to be tested and the reference image, other methods can be used to identify deformation defect areas in the image to be tested. For example, the distance distribution (e.g., mean, standard deviation, etc.) between each spatial point in the image to be tested and its nearest spatial point in the reference image can be calculated. If the distance to a point significantly deviates from the overall distribution (e.g., exceeds the mean plus a certain number of standard deviations), the point is considered to have a deformation defect, thereby enabling the identification of deformation defect areas in the image to be tested.
[0097] The present invention also provides an injection molded part defect detection system based on machine vision. The system includes a memory and a processor, and a computer program is stored in the memory. The computer program integrates the functions of the injection molded part defect detection method based on machine vision. When the computer program is executed, the injection molded part defect detection method based on machine vision can improve the accuracy of image matching using the ICP algorithm, thereby achieving accurate identification of deformation defect areas in the image to be tested.
[0098] It should be understood that various alternatives to the embodiments of the invention described herein may be employed in practicing the invention.
Claims
1. A method for detecting defects in injection molded parts based on machine vision, characterized in that: include: Obtain a surface grayscale image of the injection molded part to be tested, obtain the image to be tested, and construct a three-dimensional spatial point, where each spatial point consists of a two-dimensional coordinate position and a depth value of a pixel point; Based on the similarity of positional features and grayscale features of different spatial points, the neighboring points of each spatial point in the same region are screened, and the degree of curvature of each spatial point is quantified by calculating the directional difference between the normal vector of each spatial point and the normal vector of the neighboring points in the same region, including: for any spatial point, calculating the cosine similarity difference between the normal vector of the any spatial point and the normal vectors of the neighboring points in the same region, square-summing the cosine similarity differences and taking the average value, and taking the normalized value of the square root of the average value as the degree of curvature of the any spatial point; Dividing the image to be tested and the pre-stored standard image into grids, and calculating the matching degree of the corresponding two grid areas based on the average difference between the curvatures of all spatial points in any two grid areas in different images, wherein the matching degree is negatively correlated with the average difference; Based on the spatial points within the two grid areas with the maximum matching degree, the transformation parameters of the image to be tested to the standard image are obtained by singular value decomposition, and the image to be tested is transformed and aligned using the ICP algorithm based on the transformation parameters to identify the deformation defects of the image to be tested based on the two aligned images.
2. The method for detecting defects in injection molded parts based on machine vision according to claim 1, characterized in that: The degree of bending satisfies the following relationship: ; Where, The image to be tested Middle The degree of curvature of a point in space; The image to be tested Normal vector of a point in space; The image to be tested The first point in space Normal vectors of neighboring points in the same region; is the symbol for cosine similarity; is the symbol for the mean; is the symbol for vector; is the total number of neighboring points in the same area; is the normalization function.
3. The method for detecting defects in injection molded parts based on machine vision according to claim 2, wherein: The method for obtaining the normal vector of the space point includes: For any spatial point, curve fitting is performed on the spatial point set consisting of the arbitrary spatial point and the corresponding neighboring points in the same area to obtain a hyperplane, so as to obtain the normal vector of each spatial point in the spatial point set based on the hyperplane.
4. The method for detecting defects in injection molded parts based on machine vision according to claim 3, characterized in that: The method for obtaining neighboring points in the same area includes: Calculate the similarity between different spatial points, and the similarity satisfies the following relationship: ; Where, The image to be tested Middle A spatial point and Similarity of spatial points; 、 is the order of spatial points; The image to be tested The Euclidean distance between different spatial points in ; The image to be tested Grayscale value of the pixel in ; 、 The images to be tested are Middle spatial points and The gray value of the pixel corresponding to each spatial point; It is a function that returns the maximum value; is the absolute value symbol; is a natural exponential function; the first several spatial points are selected in descending order according to the similarity as the neighboring points of each spatial point in the same region.
5. The method for detecting defects in injection molded parts based on machine vision according to claim 1, wherein: The matching degree of the corresponding two grid areas is calculated based on the average difference between the curvatures of all spatial points in any two grid areas in different images, and satisfies the following relationship: ; Where, The image to be tested The grid area, and the standard image Middle The matching degree of each grid area; For this In the grid area The degree of curvature of a point in space; For this In the grid area The degree of curvature of a point in space; For this The number of spatial points in a grid area; For the The number of spatial points in a grid area; is the natural exponential function.
6. The method for detecting defects in injection molded parts based on machine vision according to claim 5, characterized in that: The grid areas in the image to be tested and the standard image have the same size.
7. The method for detecting defects in injection molded parts based on machine vision according to claim 1, wherein: The identifying the deformation defect of the image to be tested based on the two aligned images includes: A preset distance threshold is obtained. For any spatial point in the image to be tested, if the Euclidean distance between the any spatial point and the nearest neighboring spatial point in the standard image is greater than the distance threshold, the area where the any spatial point is located is judged to be a deformation defect area.
8. The method for detecting defects in injection molded parts based on machine vision according to claim 1, wherein: The method for obtaining the depth value includes: Depth processing is performed on the image to be tested of the injection molded part to obtain a depth value of each pixel in the image to be tested.
9. The injection molded parts defect detection system based on machine vision is characterized by: The machine vision-based injection molded part defect detection system includes a memory and a processor, the memory stores a computer program, and the processor executes the computer program to implement the steps of the machine vision-based injection molded part defect detection method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Open defect detection method based on template matching
CN118015310A
Industrial automatic three-dimensional detection system and method
CN118628474A
Cable flaw detection method, medium and system
CN119180817A