Injection molding part defect detection method and system based on machine vision

By improving the ICP algorithm, using the bending degree and matching degree of three-dimensional spatial points to calculate the transformation parameters, the local optimal solution problem caused by the initial position deviation of the traditional ICP algorithm when processing injection molded parts is solved, and the detection accuracy is improved.

CN120198440AActive Publication Date: 2025-06-24XIAN WEIER PRECISION TECH CO LTD

Patent Information

Application Number
CN202510689795.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-06-24
Estimated Expiration
2045-05-27

AI Technical Summary

Technical Problem

When traditional ICP algorithms deal with injection molded parts with complex surface geometry, they are prone to fall into local optimal solutions due to large initial position deviations, resulting in misjudgment or missed detection of deformation areas, reducing the accuracy of deformation defect detection.

Method used

By obtaining the surface grayscale image of the injection molded part to be tested, a three-dimensional spatial point is constructed, and the neighboring points in the same area are screened based on the position characteristics and the similarity of the grayscale features of the spatial point, the degree of bending is quantified, the degree of matching of the grid area is calculated, and the transformation parameters are obtained using singular value decomposition, and the ICP algorithm is improved to achieve accurate matching.

Benefits of technology

It effectively eliminates the influence of posture differences between the image to be tested and the standard image, avoids the local optimal solution problem, improves the accuracy of the transformation parameters, and realizes the accurate matching of the image to be tested and the standard image, providing a reliable basis for the identification of deformation defect areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120198440A_ABST
    Figure CN120198440A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to an injection molding part defect detection method and system based on machine vision, and the method comprises the steps: obtaining a to-be-detected image, constructing three-dimensional space points, calculating the direction difference between normal vectors of each space point and adjacent points in the same region to quantify the bending degree, and calculating the bending degree of the to-be-detected image; performing grid division on the to-be-detected image and the standard image, calculating the matching degree based on the average difference of the bending degrees of all the spatial points in the two grid areas, selecting the spatial points with the maximum matching degree in the two grid areas, and obtaining transformation parameters from the to-be-detected image to the standard image through singular value decomposition; and performing transformation alignment on the to-be-detected image based on the transformation parameter by using an ICP algorithm so as to identify the deformation defect of the to-be-detected image based on the two aligned images. According to the invention, the accuracy of image matching by using the ICP algorithm can be improved, so that the accurate recognition of the deformation defect area in the to-be-detected image is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing. More specifically, the present invention relates to a method and system for detecting defects of 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 key role in encapsulating and fixing electronic components and circuits. During the injection molding process of such parts, local deformations (such as warping and depression) often occur due to uneven cooling rates or material shrinkage, resulting in a decrease in assembly accuracy and even functional failure. To ensure product quality, it is necessary to evaluate whether the geometric accuracy meets the design requirements through deformation detection after injection molding.

[0003] In the prior art, in deformation detection, the Iterative Closest Point (ICP) algorithm is usually used to achieve the alignment of the image to be measured and the standard image. The principle of this algorithm to achieve image alignment is as follows: By iteratively calculating the spatial distance error between the spatial point clouds in the image to be measured (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, and finally achieving the precise registration of the image to be measured and the standard image, so that the deformation can be evaluated based on the registration result.

[0004] However, when the injection-molded part is deformed, it may increase the geometric complexity of the surface of the injection-molded part. When the initial pose deviation between the image to be measured and the standard image is large, the traditional ICP algorithm uses global data to optimize the transformation parameters and is prone to falling into a local optimal solution. The specific manifestation is as follows: The initial pose deviation causes the algorithm to adjust the parameters in the wrong search direction. Although the change amount of the error in a single iteration is small, the overall registration accuracy does not meet the actual requirements and the iteration is terminated in advance, resulting in misjudgment or missed detection of the deformation area, and the accuracy of the detection result of the deformation defect area is low. Summary of the Invention

[0005] In order to solve the problem that the traditional ICP algorithm is prone to falling into a local optimal solution due to a large initial pose deviation when processing injection-molded parts with complex surface geometry, resulting in misjudgment or missed detection of the deformation area and reducing the accuracy of deformation defect detection, the present invention provides a method and system for detecting defects of injection-molded parts based on machine vision.

[0006] According to a first aspect of the present invention, there is provided a method for detecting defects of injection-molded parts based on machine vision, including: Obtaining a surface grayscale image of the injection-molded part to be measured to obtain an image to be measured, and constructing three-dimensional space points, where each space point is composed of the two-dimensional coordinate position and depth value of a pixel point; Based on the similarity of the position features and gray-scale features of different spatial points, the same-region neighboring points of each spatial point are screened, and by calculating the direction difference value between the normal vector of each spatial point and the normal vectors of the same-region neighboring points, the bending degree of each spatial point is quantified; Perform grid division on the image to be measured and the pre-stored standard image, and calculate the matching degree of the corresponding two grid regions based on the average difference between the bending degrees of all spatial points in any two grid regions of different images. The matching degree is negatively correlated with the average difference; Based on the spatial points in the two grid regions with the largest matching degree, obtain the transformation parameters from the image to be measured to the standard image through singular value decomposition, and perform transformation alignment on the image to be measured using the ICP algorithm based on the transformation parameters, so as to identify the deformation defects of the image to be measured based on the two aligned images.

[0007] The present invention comprehensively calculates the matching degree index from multiple aspects of data, can accurately screen out the grid regions in the image to be measured that have not undergone deformation or have small deformation, as well as the corresponding grid regions in the standard image, and uses the transformation parameters when aligning these two grid regions as the transformation parameters from the image to be measured to the standard image, which can eliminate the influence of the large initial attitude difference between the image to be measured and the standard image, thereby avoiding the problem that the traditional ICP algorithm is prone to falling into a local optimal solution during the iteration process, improving the accuracy of the transformation parameters, and thus enabling accurate matching between the image to be measured and the standard image, providing a reliable basis for the identification of deformation defect regions.

[0008] Preferably, the method for obtaining the bending degree of each spatial point includes: For any spatial point, calculate the cosine similarity difference between the normal vector of any spatial point and the normal vectors of each same-region neighboring point, square-sum the cosine similarity differences and then take the average value, so as to use the normalized value of the square root result of the average value as the bending degree of any spatial point.

[0009] The present invention uses the direction difference value of the normal vector to quantify the bending degree of each spatial point, which can reduce the analysis difficulty of the direction difference of each spatial point.

[0010] Preferably, the bending degree satisfies the following relational expression: ; In the formula, is the bending degree of the th spatial point in the image to be measured ; is the normal vector of the th spatial point in the image to be measured; is the normal vector of the th same-region neighboring point of the th spatial point in the image to be measured; is the representation symbol of cosine similarity; is the representation symbol of mean value; is the representation symbol of vector; is the total number of neighboring points in the same region; is the normalization function.

[0011] Preferably, the method for obtaining the normal vector of a spatial point includes: For any spatial point, perform curve fitting on the spatial point set composed of any spatial point and its corresponding neighboring points in the same region to obtain a hyperplane, and based on the hyperplane, obtain the normal vectors of each spatial point in the spatial point set.

[0012] Preferably, the method for obtaining neighboring points in the same region includes: Calculate the similarity between different spatial points. The similarity satisfies the following relational expression: ; In the formula, is the image to be measured in the th spatial point and the 、 are the orders of the spatial points; is the Euclidean distance between different spatial points in the image to be measured ; is the gray value of the pixel point in the image to be measured ; 、 are respectively the gray values of the pixel points corresponding to the th spatial point and the th spatial point in the image to be measured; is the function with the maximum return value; is the absolute value symbol; The natural exponential function is used to sort the similarities from high to low, and select the first several spatial points as the neighboring points in the same region of each spatial point.

[0013] The present invention utilizes the feature that the gray values of the pixel points in the deformed region also change, and introduces the feature of gray values when measuring the similarity of each spatial point, so as to accurately measure the similarity of different spatial points.

[0014] Preferably, based on the average difference between the bending degrees of all spatial points in any two grid regions of different images, calculate the matching degree of the corresponding two grid regions, which satisfies the following relational expression: ; In the formula, is the th a grid area, and the matching degree with the standard image in the matching degree of the grid area; is the bending degree of the nth spatial point in this nth grid area; is the bending degree of the mth spatial point in this nth grid area; is the number of spatial points in this nth grid area; is the number of spatial points in this nth grid area; is the natural exponential function.

[0015] The present invention utilizes the feature that the bending degree is not affected by the placement position of the injection molded part, so as to calculate the matching degree between any two images in different images based on the bending degree, and can eliminate the influence of the pose difference between the image to be measured and the standard image, thereby providing an accurate data basis for the determination of subsequent transformation parameters.

[0016] Preferably, the sizes of the grid areas in the image to be measured and the standard image are the same.

[0017] Preferably, identifying the deformation defect of the image to be measured based on the two aligned images includes: Obtain a preset distance threshold. For any spatial point in the image to be measured, if the Euclidean distance between any spatial point and the nearest neighbor spatial point in the standard image is greater than the distance threshold, it is determined that the area where any spatial point is located is a deformation defect area.

[0018] Preferably, the method for obtaining the depth value includes: Perform depth processing on the image to be measured of the injection molded part to be measured to obtain the depth values of each pixel point in the image to be measured.

[0019] When constructing each spatial point, the present invention introduces the feature of the depth value, which can more comprehensively reflect the spatial structure of the object surface.

[0020] According to the second aspect of the present invention, there is provided an injection molded part defect detection system based on machine vision. The system includes a memory and a processor. A computer program is stored on the memory, and the processor executes the computer program to implement the steps of the first aspect of the present invention.

[0021] The present invention has the following effects: The present invention determines the transformation parameters from the image to be measured to the standard image by calculating the matching degrees of any two grid regions in different images and based on the spatial points within the two grid regions with the highest matching degrees. This method effectively eliminates the influence of the pose difference between the image to be measured and the standard image, and avoids the problem that the iterative process of the transformation parameters falls into a local optimal solution due to the excessive difference in the initial spatial point cloud in the traditional ICP algorithm. Thus, the accuracy of the transformation parameters can be improved, the precise matching between the image to be measured and the standard image can be achieved, and a precise image basis is provided for the detection of deformation defects in the subsequent image to be measured. Description of the Drawings

[0022] Figure 1 is a schematic flow chart of the steps of the injection molding part defect detection method based on machine vision according to an embodiment of the present invention. Detailed Embodiments

[0023] Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts fall within the scope of protection of the present invention.

[0024] The following will describe in detail the specific embodiments of the present invention with reference to the drawings.

[0025] Refer to Figure 1 , the injection molding part defect detection method based on machine vision includes steps S1 - S4, specifically as follows: S1: Obtain the surface grayscale image of the injection molding part to be measured to obtain the image to be measured, and construct three-dimensional spatial points, where each spatial point is composed of the two-dimensional coordinate position and depth value of the pixel point.

[0026] 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 (i.e., the row and column numbers of the pixel point in the image to be measured) and the depth value of the pixel point; the injection molding part to be measured refers to any injection molding part.

[0027] It should be noted that there are generally many regions with inconsistent depths on the surface of the injection molding part. Analyzing solely based on a single planar feature information may lead to a large matching error. The image captured by the RGBD camera can not only extract the two-dimensional distribution features in the image, but also obtain the depth information of each pixel point in the image; therefore, in order to make the information more accurate, the present invention constructs each spatial point based on the two-dimensional coordinate feature and depth feature.

[0028] Next, the construction process of each spatial point will be described in detail: First, an appropriate shooting perspective and distance can be selected to ensure that the image can comprehensively capture the details of the injection molded part. Then, in an environment with uniform illumination, use an RGBD camera to collect the test image of the injection molded part to be tested. After that, take the row and column numbers of each pixel point in the test image as the position coordinates of the corresponding pixel point, and through depth processing of the test image, obtain the depth value of each pixel point. Finally, take the three-dimensional coordinates composed of the position coordinates and depth values of each pixel point as the spatial point corresponding to each pixel point, thereby realizing the construction of spatial points.

[0029] It should be noted that the process of obtaining the gray value of each pixel point in the image collected by the RGBD camera through depth processing is a prior art, and this embodiment will not elaborate on it here.

[0030] S2: Based on the similarity of the position features and gray features of different spatial points, screen the neighboring points in the same region of each spatial point, and quantify the bending degree of each spatial point by calculating the direction difference value between the normal vectors of each spatial point and the normal vectors of the neighboring points in the same region.

[0031] It should be noted that during the production process of injection molded parts, due to uneven cooling or material shrinkage, local deformation is likely to occur, resulting in the deviation of the part edge or the internal corner area from the original geometric shape. The significant feature of the deformed area is that the surface curvature increases abnormally, that is, there are significant differences in the directions of the spatial points within the deformed area. Therefore, to accurately identify such deformations, it is necessary to first determine the neighboring points in the same region around each spatial point, so as to find the spatial points that may be in the same region.

[0032] It should be further noted that under normal circumstances, the gray values of each part area of the injection molded part are usually relatively consistent. However, when deformation occurs, the gray value of the deformed area will change accordingly due to the change of the surface structure. Therefore, the present invention utilizes this feature to screen the neighboring points in the same region of each spatial point by analyzing the similarity of the position features and gray features of different spatial points.

[0033] In an exemplary embodiment of the present invention, the determination of the neighboring points in the same region of each spatial point can be achieved through the following steps: 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 region of each spatial point.

[0034] Specifically, the similarity between different spatial points satisfies the following relational expression: ; In the formula, is the similarity between the th spatial point and the th spatial point in the test image; ; , is the order of spatial points; is the image to be measured is the Euclidean distance between different spatial points in; is the image to be measured is the gray value of the pixel points in; , are respectively the in the image to be measured th spatial point and the th spatial point corresponding to the gray value of the pixel points; is a function with the return value of the maximum value; is the absolute value symbol; is the natural exponential function, where the natural exponential function refers to the exponential function with the natural constant as the base.

[0035] Among them, reflects the th spatial point and the th spatial point between the relative distance, the smaller the value, the more similar the corresponding two spatial points in the position characteristics, the greater the similarity of the corresponding two spatial points; reflects the relative difference between the two spatial points in the gray value, the smaller the value, the more similar the corresponding two spatial points in the gray characteristics, the greater the similarity of the corresponding two spatial points.

[0036] Next, for any spatial point, the determination process of the same-region neighboring points of this spatial point is described in detail: First, calculate the similarity between this any spatial point and all other spatial points, then, sort all other spatial points in descending order according to the similarity, and finally, select several, such as 5 spatial points, from the ordered spatial point sequence from front to back as the same-region neighboring points of this any spatial point.

[0037] Furthermore, after determining the same-region neighboring points of each spatial point, the change amount in the direction between each spatial point and its same-region neighboring points can be analyzed, so as to evaluate the bending degree of each spatial point.

[0038] It should be noted that for the spatial points in the deformation region, the more obvious the change in the surface direction of its same-region neighboring points, the greater the change in the surface morphology near this spatial point, that is, the surface is bent. Therefore, the present invention uses this feature to evaluate the bending degree of each spatial point by analyzing the surface direction change between each spatial point and its local same-region spatial points.

[0039] However, the surface components of the injection-molded parts have obvious three-dimensional features, and the surface directions are complex and variable, making it difficult to directly represent. The normal vector can reflect the direction information of the surface where each spatial point is located relative to the surrounding spatial points. Therefore, by calculating the difference value in the direction between the normal vector of each spatial point and the normal vector of its neighboring points in the same region, the present invention can quantify the change amount in the direction between each spatial point and its neighboring points in the same region, thereby providing a basis for the evaluation of the bending degree.

[0040] In an exemplary embodiment of the present invention, the determination of the normal vector of each spatial point can be achieved through the following steps: For any spatial point, perform curve fitting on the spatial point set composed of any spatial point and its corresponding neighboring points in the same region to obtain a hyperplane, and based on the hyperplane, obtain the normal vectors of each spatial point in the spatial point set.

[0041] Optionally, the least squares method, the principal component analysis method, etc. can be used to fit the spatial point set composed of each spatial point and its neighboring points in the same region, so as to obtain the hyperplane of the corresponding spatial point set. There is no special limitation on the selected fitting method in this embodiment.

[0042] It should be noted that the process of determining the normal vectors at each position on the hyperplane is a prior art, and this embodiment will not elaborate on it here.

[0043] In an exemplary embodiment of the present invention, the determination of the bending degree of each spatial point can be achieved through the following steps: For any spatial point, calculate the difference in the cosine similarity between the normal vector of any spatial point and the normal vectors of each neighboring point in the same region, square and sum the differences in cosine similarity, and then take the average value. The normalized value of the square root result of the average value is used as the bending degree of any spatial point.

[0044] Among them, the bending degree reflects the bending condition at the position where the corresponding spatial point is located.

[0045] Specifically, the bending degree of each spatial point satisfies the following relational expression: ; In the formula, is the bending degree of the th spatial point in the image to be measured; is the normal vector of the th spatial point in the image to be measured; is the normal vector of the th spatial point in the image to be measured; is the th neighboring point in the same region of the is the symbol representing the cosine similarity. Among them, the determination process of the cosine similarity between vectors is a prior art, and this embodiment will not elaborate on it here; is the symbol for the mean; is the symbol for a vector; is the total number of neighboring points in the same region. In this embodiment, ; is a normalization function.

[0046] Among them, the larger the obtained normalized value, it indicates that the discrete degree of the cosine similarity between the normal vector of the th spatial point and the normal vectors of the neighboring points in the same region is larger. Furthermore, it indicates that the difference in the direction of the normal vector between this spatial point and the normal vectors of the neighboring points in the same region is larger, that is, the change in the surface direction around this spatial point is relatively drastic. At this time, it can be determined that the shape of the surface around this spatial point has changed greatly, and correspondingly, the bending degree of this spatial point is larger.

[0047] In another embodiment, to measure the difference value in the direction between the normal vector of each spatial point and the normal vectors of the neighboring points in the same region, it can also be achieved by calculating the average angular difference between the normal vector of each spatial point and the normal vectors of the neighboring points in the same region, and then normalizing it. After that, the obtained normalized value is used as the bending degree of the corresponding spatial point. The angular difference here is the absolute value of the difference between the corresponding two angular values.

[0048] S3: Perform grid division on the image to be measured and the pre-stored standard image. Based on the average difference between the bending degrees of all spatial points in any two grid regions of different images, calculate the matching degree of the corresponding two grid regions. The matching degree is negatively correlated with the average difference.

[0049] It should be noted that in an actual production line, the injection molded parts may be placed on the conveyor belt at any angle for image acquisition, resulting in different orientations of the images to be measured each time. As a result, there are differences between the images to be measured and the pre-stored standard images (surface images of injection molded parts without deformation), and the relative positions of the spatial points will change, increasing the complexity of spatial point matching.

[0050] However, due to the fixed shooting angle, the bending degrees of the spatial points in the normal non-deformed regions of the image to be measured are basically the same as those in the corresponding regions of the standard image. This means that similar corresponding regions can be found in the standard image for the distribution characteristics of the non-deformed regions in the acquired image to be measured. Therefore, the present invention utilizes this feature to evaluate the matching degree between the two by analyzing whether there is an association in the distribution characteristics between each grid region in the acquired image to be measured and the spatial points in each grid region of the standard image.

[0051] In an exemplary embodiment of the present invention, the sizes of the grid regions in the image to be measured and the standard image are the same.

[0052] Exemplarily, if the sizes of the image to be measured and the standard image are When the preset number of divided grid regions is 20, the size of each grid region is , where , and and are chosen such that is as close as possible to , thus ensuring that the shape of each grid region is relatively regular; where is the number of grid regions in the length direction of the image to be measured or the standard image; is the number of grid regions in the width direction of the image to be measured or the standard image.

[0053] Furthermore, after the grid division of the image to be measured and the pre-stored standard image is completed, the matching degree of any two grid regions in different images can be calculated based on the average difference in the bending degree of the spatial points in the two grid regions. Specifically, the matching degree of any two grid regions in different images satisfies the following relational expression: ; In the formula, is the matching degree of the th grid region in the image to be measured and the th grid region in the standard image ; is the bending degree of the th spatial point in the th grid region; is the bending degree of the th spatial point in the th grid region; is the number of spatial points in the th grid region; is the number of spatial points in the th grid region; is the natural exponential function.

[0054] Among them, reflects the average difference in the bending degree of the spatial points in the th grid region and the th grid region. Here, the difference is the square of the difference between the data (the absolute value of the difference between the data can also be used); the smaller this value is, the closer the bending degrees of the spatial points in the two grid regions are as a whole, which means that the surface morphologies of the two grid regions are similar and the distribution characteristics of the spatial points are also relatively consistent, and the corresponding matching degree of the two grid regions is relatively large.

[0055] It should be noted that when the matching degree between any grid region in the image to be measured and another grid region in the standard image is the largest, the grid region in the image to be measured is very likely to be a region with no or less deformation, and the other grid region in the standard image is the best region that matches it. This is because in the region with no deformation, the bending degree of the spatial points in the two images is the same. In addition, due to the relatively complex structure of the injection molded part, the bending degree at different positions is usually different, which makes the regions with high matching degree correspond to each other.

[0056] In another embodiment, the opposite number of the average difference can also be directly normalized, and the obtained normalized value is used as the matching degree of the corresponding two grid regions.

[0057] S4: Based on the spatial points in the two grid regions with the largest matching degree, the transformation parameters from the image to be measured to the standard image are obtained by singular value decomposition, and the image to be measured is transformed and aligned using the ICP algorithm based on the transformation parameters, so as to identify the deformation defects of the image to be measured based on the two aligned images.

[0058] It should be noted that since the orientation of the injection molded part is not fixed, it may lead to significant differences in the relative positions of the spatial points in different images, which will cause the ICP algorithm to have too large an initial error or fall into a local optimal solution, resulting in low matching accuracy. Therefore, the present invention improves the traditional ICP algorithm. The specific improvement content is as follows: Based on the matching degrees of any two grid regions in different images, the two grid regions with the largest matching degree are selected, and based on the set of spatial points composed of all the spatial points in the two grid regions, the transformation parameters (i.e., the rotation matrix and the translation vector) from the image to be measured to the standard image are calculated, so as to replace the transformation parameters determined by iterative operations in the traditional ICP algorithm. Then, the traditional ICP algorithm is used to perform a transformation alignment operation on the image to be measured to align the image to be measured with the standard image.

[0059] Among them, the parameter types included in the transformation parameters are the fixed parameter types in the ICP algorithm.

[0060] Next, the process of aligning the image to be measured with the standard image will be described in detail: First, based on the spatial points in the two grid regions with the highest matching degree, the transformation parameters (including the rotation matrix and the translation vector) from the image to be measured to the standard image are calculated by singular value decomposition (SVD). It should be noted that calculating the transformation parameters using singular value decomposition is an existing technique in the ICP algorithm and will not be elaborated here in detail.

[0061] Then, the transformation parameters obtained through the above steps are used as the optimal transformation parameters of the ICP algorithm. Based on these optimal transformation parameters, the ICP algorithm is used to perform a global transformation alignment operation on the image to be measured. Specifically, the global region of the image to be measured is transformed according to the transformation parameters to align it with the standard image, thereby achieving an accurate match between the image to be measured and the standard image.

[0062] Furthermore, after aligning the image to be measured with the standard image, the deformed defect region in the image to be measured can be recognized based on the aligned images.

[0063] In an exemplary embodiment of the present invention, the determination of the deformed defect region in the image to be measured can be achieved through the following steps: Obtain a preset distance threshold. For any spatial point in the image to be measured, if the Euclidean distance between any spatial point and the nearest neighbor spatial point in the standard image is greater than the distance threshold, it is determined that the region where the any spatial point is located is a deformed defect region.

[0064] Wherein, the nearest neighbor spatial point refers to the spatial point with the shortest distance in different images.

[0065] Exemplarily, for any spatial point in the image to be measured, the spatial point in the standard image with the minimum Euclidean distance or Manhattan distance from the any spatial point can be used as the nearest neighbor spatial point of the any spatial point.

[0066] Optionally, the distance threshold can be set to 0.5. If the distance between any spatial point in the image to be measured and the nearest neighbor spatial point in the standard image is greater than 0.5, it is determined that the any spatial point has a deformed defect. Thus, all the positions with defects can be obtained to form a deformed defect region, thereby achieving accurate detection of the deformed defects of the injection molded part to be measured.

[0067] Optionally, based on the aligned image to be measured and the standard image, other methods can also be used to recognize the deformed defect region in the image to be measured. For example, the distance distribution (such as mean, standard deviation, etc.) between each spatial point in the image to be measured and the nearest neighbor spatial point in the standard image can be calculated. If the distance of a certain point significantly deviates from the overall distribution (such as exceeding the mean plus several times the standard deviation), it is considered that the point has a deformed defect, thereby realizing the recognition of the deformed defect region in the image to be measured.

[0068] 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 on 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 accuracy of image matching using the ICP algorithm can be improved through the injection molded part defect detection method based on machine vision, thereby achieving accurate recognition of the deformed defect region in the image to be measured.

[0069] It should be understood that in the process of practicing the present invention, various alternative solutions to the embodiments of the present invention described herein may be adopted.

Claims

1. A method for detecting defects of injection molded parts based on machine vision, characterized in that, Including: Obtain the surface grayscale image of the injection molded part to be measured, obtain the image to be measured, and construct three-dimensional space points, where each space point is composed of the two-dimensional coordinate position and depth value of the pixel point; Based on the similarity of the position characteristics and grayscale characteristics of different space points, screen the neighboring points in the same region of each space point, and quantify the bending degree of each space point by calculating the direction difference value between the normal vectors of each space point and the normal vectors of the neighboring points in the same region; Perform grid division on the image to be measured and the pre-stored standard image, and calculate the matching degree of the corresponding two grid regions based on the average difference between the bending degrees of all space points in any two grid regions of different images. The matching degree is negatively correlated with the average difference; Based on the space points in the two grid regions with the largest matching degree, obtain the transformation parameters from the image to be measured to the standard image through singular value decomposition, and perform transformation alignment on the image to be measured using the ICP algorithm based on the transformation parameters, so as to identify the deformation defects of the image to be measured based on the aligned two images.

2. The method for detecting defects of injection molded parts based on machine vision according to claim 1, characterized in that, The method for obtaining the bending degree of each space point includes: For any space point, calculate the difference in cosine similarity between the normal vector of the any space point and the normal vectors of each neighboring point in the same region, sum the squares of the differences in cosine similarity and then take the average value, so as to use the normalized value of the square root result of the average value as the bending degree of the any space point.

3. The method for detecting defects of injection molded parts based on machine vision according to claim 2, wherein, The bending degree satisfies the following relational expression: ; In the formula, The image to be tested Middle The degree of curvature of a point in space; is the image to be tested The normal vector of a point in space; is the image to be tested The space point 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.

4. The method for detecting defects of injection molded parts based on machine vision according to claim 3, characterized in that, The method for obtaining the normal vector of the space point includes: For any space point, perform curve fitting on the space point set composed of the any space point and the corresponding neighboring points in the same region to obtain a hyperplane, so as to obtain the normal vectors of each space point in the space point set based on the hyperplane.

5. The method for detecting defects of injection molded parts based on machine vision according to claim 4, characterized in that, The method for obtaining the neighboring points in the same region includes: Calculate the similarity between different space points. The similarity satisfies the following relational expression: ; In the formula, is the similarity between the th spatial point and the th spatial point in the image to be measured; , are the orders of the spatial points; is the Euclidean distance between different spatial points in the image to be measured ; is the gray value of the pixel point in the image to be measured ; , are respectively the gray values of the pixel points corresponding to the th spatial point and the th spatial point in the image to be measured; is a function whose return value is the maximum value; is the absolute value symbol; is the natural exponential function; they can be sorted from high to low according to the similarity, and the first several spatial points are selected as the neighboring points in the same region of each spatial point.

6. The method for detecting defects of injection molded parts based on machine vision according to claim 1, wherein Calculating the matching degree of the corresponding two grid regions based on the average difference between the bending degrees of all space points in any two grid regions of different images satisfies the following relational expression: ; In the formula, is the th grid region in the image to be measured, and the matching degree with the th grid region in the standard image ; ; is the degree of curvature of the th spatial point in the th grid region; is the degree of curvature of the th spatial point in the th grid region; is the number of spatial points in the th grid region; is the number of spatial points in the th grid region; is the natural exponential function.

7. The method for detecting defects of injection molded parts based on machine vision according to claim 6, wherein The sizes of the grid regions in the image to be measured and the standard image are the same.

8. The method for detecting defects of injection molded parts based on machine vision according to claim 1, characterized in that Identifying the deformation defects of the image to be measured based on the aligned two images includes: Obtain a preset distance threshold. For any space point in the image to be measured, if the Euclidean distance between the any space point and the nearest neighboring space point in the standard image is greater than the distance threshold, then determine that the region where the any space point is located is a deformation defect region.

9. The method for detecting defects of injection molded parts based on machine vision according to claim 1, wherein, The method for obtaining the depth value includes: Perform depth processing on the image to be measured of the injection molded part to be measured to obtain the depth values of each pixel point in the image to be measured.

10. An injection molded part defect detection system based on machine vision, characterized in that, The injection molded part defect detection system based on machine vision includes a memory and a processor. A computer program is stored on the memory, and the processor executes the computer program to implement the steps of the injection molded part defect detection method based on machine vision according to any one of claims 1-9.

Citation Information

Patent Citations

  • Injection molding part surface defect detection method based on image processing

    CN115953409A

  • 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

  • Shape detection method, shape detection system, and program

    US20220164975A1

Cited By

  • Intelligent injection molding part defect detection method and system based on machine vision

    CN121147627A

  • A machine vision-based intelligent detection method and system for defects of injection molded parts

    CN121147627B