A method for automatically identifying and positioning surface defects of a plastic injection molded part

By constructing windows of different sizes to obtain the comprehensive importance and abrupt change of pixels, the Laplace operator is optimized for image enhancement, solving the problem of poor enhancement effect of the Laplace operator in gray-level abrupt change areas and improving the accuracy of automatic identification of surface defects of injection molded parts.

CN120525818BActive Publication Date: 2026-01-27SHENZHEN LIQI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510584242.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-07
Publication Date
2026-01-27
Estimated Expiration
2045-05-07

AI Technical Summary

Technical Problem

In existing technologies, the Laplace operator has poor or excessive enhancement effects on areas with obvious gray-scale jumps during image enhancement, resulting in low accuracy of automatic identification of surface defects in injection molded parts.

Method used

By constructing windows of different preset sizes, the overall importance and abrupt change of pixels are obtained, and the Laplace operator is optimized to adapt to grayscale changes in different regions for image enhancement processing.

Benefits of technology

It improves the accuracy of automatic identification of surface defect areas of injection molded parts, reduces artifacts in the image enhancement process, and enhances the effect of defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120525818B_ABST
    Figure CN120525818B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of computer vision, and especially relates to a plastic injection molding part surface defect automatic identification positioning method, which acquires a gray scale image of a plastic injection molding part; for any pixel point in the gray scale image, a window of different preset sizes is constructed with the pixel point as the center, a comprehensive importance degree is acquired according to the gray scale value difference and the gray scale value correlation degree of the pixel points in each window; a target window is established, and a jump degree is acquired according to the gray scale value difference of the pixel points in the target window; an initial laplace operator is optimized according to the comprehensive importance degree and the jump degree, and an optimized laplace operator is obtained, and image enhancement processing is performed on any pixel point according to the optimized laplace operator; the image enhancement processing is performed on each pixel point to obtain an enhanced image, defect detection is performed on the enhanced image, a plastic injection molding part surface defect area is obtained, and the accuracy of automatic identification and positioning of the injection molding part defect area is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and in particular to a method for automatic identification and location of surface defects in plastic injection molded parts. Background Technology

[0002] With the rapid development of plastic injection molding technology, injection molded products are increasingly widely used in daily life, industrial production, and scientific and technological fields. However, during the production process, due to the influence of various factors such as mold design, material selection, and molding process, various defects often appear on the surface of injection molded products, such as scorch marks, color mixing, watermarks, fogging, pits, bumps, scratches, shrinkage, spots, and water inclusions. These defects not only affect the appearance quality of the product but may also reduce its performance and lifespan, and in severe cases, even lead to product scrapping, causing economic losses to enterprises. Traditionally, the inspection of surface defects in injection molded parts is mainly done manually, but the inspection results are unstable and inefficient.

[0003] With the development of computer vision technology, existing technologies typically use image processing techniques to automatically identify and locate surface defects in plastic injection molded parts. First, the acquired images of the injection molded parts are enhanced to make the defects more obvious. Then, a large number of defect area images are acquired and trained to obtain surface texture, color, shape and other features. Machine learning algorithms are then used to achieve automatic identification and location of defect areas in the injection molded parts.

[0004] In existing technologies, the Laplace transform algorithm is commonly used to enhance the acquired images of injection molded parts. However, when using the Laplace transform algorithm to enhance image details, it is more effective in enhancing areas with significant gray-level jumps. Defective parts, due to varying degrees of defect severity, exhibit different degrees of local gray-level jumps. When a fixed Laplace operator is used to enhance the image, areas with indistinct gray-level jumps may not be effectively enhanced due to an excessively small Laplace operator; conversely, areas with significant gray-level jumps may be over-enhanced due to an excessively large Laplace operator, resulting in artifacts. This leads to poor subsequent automatic defect recognition and reduces the accuracy of automatic defect recognition on the injection molded part surface.

[0005] Therefore, optimizing the Laplace operator to increase its accuracy in the image enhancement process has become an urgent problem to be solved. Summary of the Invention

[0006] In view of this, embodiments of the present invention provide an automatic identification and location method for surface defects of plastic injection molded parts, in order to solve the problem of how to optimize the Laplace operator and increase its accuracy in the image enhancement process.

[0007] This invention provides an automatic identification and location method for surface defects in plastic injection molded parts, the method comprising the following steps:

[0008] A surface image of a plastic injection molded part is acquired, and the surface image is converted to grayscale to obtain a grayscale image;

[0009] For any pixel in the grayscale image, at least two windows of different preset sizes are constructed with the pixel as the center. The overall importance of the pixel is obtained based on the difference in grayscale values ​​and the degree of correlation between grayscale values ​​of the pixels in each window.

[0010] A target window of a preset size is established with any pixel as the center, and the degree of abrupt change of any pixel is obtained based on the difference in grayscale values ​​of the pixels within the target window.

[0011] An initial Laplace operator is set, and the initial Laplace operator is optimized according to the overall importance and judder degree of any pixel to obtain an optimized Laplace operator for any pixel. The optimized Laplace operator is used as the Laplace operator in the Laplace transform algorithm to perform image enhancement processing on any pixel.

[0012] Each pixel in the grayscale image is subjected to image enhancement processing to obtain an enhanced image. Defect detection is then performed on the enhanced image to obtain the defect area on the surface of the plastic injection molded part.

[0013] Preferably, constructing at least two windows of different preset sizes centered on any one of the pixels includes:

[0014] In the grayscale image, with any pixel as the center, the any pixel and a first preset number of pixels in the horizontal direction form a horizontal window;

[0015] A vertical window is formed by combining any one pixel with a first preset number of pixels in the vertical direction;

[0016] Centered on any one of the pixels, create a second preset number of square windows of different sizes.

[0017] Preferably, obtaining the overall importance of any pixel based on the grayscale value difference and grayscale value correlation of pixels in each window includes:

[0018] The gradient value of each pixel in the horizontal window is obtained to obtain a horizontal gradient line graph. The horizontal axis of the horizontal gradient line graph is the pixel position number, and the vertical axis is the gradient value.

[0019] The gradient value of each pixel in the vertical window is obtained to obtain a vertical gradient line graph. The horizontal axis of the vertical gradient line graph is the pixel position number, and the vertical axis is the gradient value.

[0020] The importance of any pixel is obtained based on the fluctuation characteristics of the gradient values ​​in the horizontal gradient line chart and the vertical gradient line chart.

[0021] The degree of abnormality of any pixel is obtained based on the difference in grayscale values ​​and the degree of correlation of grayscale values ​​of pixels in each square window;

[0022] The product of the importance level and the anomaly level is normalized to obtain the overall importance level of any pixel.

[0023] Preferably, obtaining the importance of any pixel based on the fluctuation characteristics of the gradient values ​​in the horizontal gradient line chart and the vertical gradient line chart includes:

[0024] In the horizontal gradient line graph, the gradient change rate between any pixel and its left neighbor is obtained and denoted as the left change rate, and the gradient change rate between any pixel and its right neighbor is obtained and denoted as the right change rate.

[0025] Obtain the absolute value of the ratio of the left change rate to the right change rate to get the change rate ratio; calculate the absolute value of the difference between the constant 1 and the change rate ratio to get the gradient change difference value of any pixel.

[0026] Obtain the mean gradient of the horizontal gradient line graph, calculate the product of the reciprocal of the mean gradient and the reciprocal of the gradient change difference value, and obtain the edge feature value of any pixel in the horizontal direction;

[0027] The edge feature value of any pixel in the vertical direction is obtained based on the vertical gradient line graph. The importance of any pixel is obtained based on the average of the edge feature values ​​in the horizontal direction and the edge feature values ​​in the vertical direction.

[0028] Preferably, obtaining the anomaly level of any pixel based on the grayscale value difference and grayscale value correlation of pixels in each of the square windows includes:

[0029] For any square window, the gray values ​​of each row of pixels in the square window are combined into a gray value sequence. The standard deviation of each gray value sequence is obtained, and the mean of the standard deviation is obtained. The ratio of the standard deviation of each gray value sequence to the mean of the standard deviation is calculated, and the cumulative ratio value is obtained.

[0030] The Pearson correlation coefficient between the grayscale value sequences of every two adjacent rows in any square window is obtained respectively, and the mean of the Pearson correlation coefficient is obtained accordingly.

[0031] The outlier of any square window is obtained by multiplying the accumulated ratio value with the reciprocal of the mean Pearson correlation coefficient.

[0032] The outlier values ​​of each of the square windows are obtained, and the average outlier value is used as the degree of outlier for any pixel.

[0033] Preferably, obtaining the degree of judder of any pixel based on the difference in grayscale values ​​of pixels within the target window includes:

[0034] In the target window, the average gray value of the four neighboring pixels of any pixel is obtained, and the absolute value of the difference between the average gray value and the gray value of any pixel is normalized to obtain the degree of change of any pixel.

[0035] Preferably, optimizing the initial Laplace operator based on the overall importance and hop degree of any pixel to obtain an optimized Laplace operator for any pixel includes:

[0036] Set a threshold for the degree of abrupt change and the center coefficient of the initial Laplace operator. If the degree of abrupt change of any pixel is greater than or equal to the threshold for the degree of abrupt change, then optimize the center coefficient of the initial Laplace operator according to the degree of abrupt change and the importance of any pixel to obtain the optimized center coefficient.

[0037] If the degree of change of any pixel is less than the degree of change threshold, then the center coefficient of the initial Laplace operator is optimized according to the degree of change of any pixel and the overall importance, to obtain the optimized center coefficient;

[0038] Based on the optimized center coefficient, the optimized laplace operator for any pixel is obtained.

[0039] Preferably, optimizing the center coefficients of the initial Laplace operator based on the degree and importance of the transition of any pixel includes:

[0040] The product of the jump degree and importance of any pixel is normalized to obtain an adjustment value. The optimized center coefficient is obtained by adding the center coefficient and the adjustment value.

[0041] Preferably, optimizing the center coefficients of the initial Laplace operator based on the degree of judder and overall importance of any pixel includes:

[0042] The product of the inverse of the juxtaposition degree of any pixel and the overall importance degree is normalized to obtain an adjustment value. The optimized center coefficient is obtained based on the difference between the center coefficient and the adjustment value.

[0043] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:

[0044] This invention acquires a surface image of a plastic injection molded part, performs grayscale processing on the surface image to obtain a grayscale image; for any pixel in the grayscale image, at least two windows of different preset sizes are constructed with the pixel as the center; the overall importance of the pixel is obtained based on the difference and correlation of grayscale values ​​of pixels in each window; a target window of preset size is established with the pixel as the center; the degree of abrupt change of the pixel is obtained based on the difference in grayscale values ​​of pixels within the target window; an initial Laplace operator is set; the initial Laplace operator is optimized based on the overall importance and abrupt change of the pixel to obtain an optimized Laplace operator for the pixel; the optimized Laplace operator is used as the Laplace operator in the Laplace transform algorithm to perform image enhancement processing on the pixel; image enhancement processing is performed on each pixel in the grayscale image to obtain an enhanced image; defect detection is performed on the enhanced image to obtain the defect area on the surface of the plastic injection molded part. Specifically, based on the differences and correlations of gray values ​​among pixels in a grayscale image, the overall importance and hopping degree of each pixel are obtained. Then, based on the overall importance and hopping degree of each pixel, the Laplace operator in the Laplace transform algorithm is optimized, so that the defective parts in the enhanced image obtained by the Laplace transform algorithm are effectively enhanced while the overall image remains clear and free of artifacts, thereby increasing the accuracy of automatic identification and positioning of defective areas in subsequent injection molded parts. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0046] Figure 1This is a flowchart of an automatic identification and location method for surface defects in plastic injection molded parts provided in Embodiment 1 of the present invention;

[0047] Figure 2 These are surface images of the front and sides of a plastic injection molded part provided in Embodiment 1 of the present invention;

[0048] Figure 3 This is a schematic diagram of a Laplace kernel provided in Embodiment 1 of the present invention. Detailed Implementation

[0049] Embodiments of this disclosure are described in detail below, with examples of these embodiments illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting it.

[0050] It should be noted that the terms "first," "second," etc., used in this disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure.

[0051] To illustrate the technical solution of the present invention, specific embodiments are described below.

[0052] See Figure 1 This is a flowchart of a method for automatically identifying and locating surface defects in plastic injection molded parts, as provided in Embodiment 1 of the present invention. Figure 1 As shown, the method may include:

[0053] Step S101: Obtain a surface image of the plastic injection molded part, and perform grayscale processing on the surface image to obtain a grayscale image.

[0054] During the production process of injection molded products, various defects often appear on their surface due to the influence of factors such as mold design, material selection, and molding process. These defects include scorch marks, color mixing, watermarks, fogging, pits, bumps, scratches, shrinkage, spots, and water inclusions. These defects not only affect the appearance quality of the product, but may also reduce the product's performance and lifespan. In severe cases, they may even lead to product scrapping and economic losses for the company.

[0055] With the development of computer vision technology, existing technologies typically use image processing techniques to automatically identify and locate surface defects in plastic injection molded parts. First, the acquired images of the injection molded parts are enhanced to make the defects more obvious. Then, a large number of defect area images are acquired and trained to obtain surface texture, color, shape and other features. Machine learning algorithms are then used to achieve automatic identification and location of defect areas in the injection molded parts.

[0056] In this embodiment, after the plastic injection molding process is completed, a high-definition camera is installed directly above and on both sides of the conveyor belt carrying the plastic injection molding part. When the plastic injection molding part is conveyed to the area directly below (opposite to) the camera, it is photographed to obtain surface images of the front and sides of the plastic injection molding part. Figure 2 The image shown is a surface image of the front and sides of a plastic injection molded part. The surface images are then processed into grayscale images. Grayscale processing is a prior art technique and will not be described in detail here. Since the method for automatically identifying defect areas in each surface image is the same, this embodiment uses a surface image of a plastic injection molded part as an example to perform automatic defect area identification.

[0057] In existing technologies, the Laplace transform algorithm is commonly used to enhance the acquired images of injection molded parts. However, when using the Laplace transform algorithm to enhance image details, it is more effective in enhancing areas with significant gray-level jumps. Defective parts, due to varying degrees of defect severity, exhibit different degrees of local gray-level jumps. When a fixed Laplace operator is used to enhance the image, areas with indistinct gray-level jumps may not be effectively enhanced due to an excessively small Laplace operator; conversely, areas with significant gray-level jumps may be over-enhanced due to an excessively large Laplace operator, resulting in artifacts. This leads to poor subsequent automatic defect recognition and reduces the accuracy of automatic defect recognition on the injection molded part surface.

[0058] Therefore, this embodiment obtains the overall importance and jump degree of each pixel based on the difference in gray values ​​and the degree of correlation of gray values ​​in the grayscale image. Then, based on the overall importance and jump degree of each pixel, the Laplace operator in the Laplace transform algorithm is optimized so that the defective part in the enhanced image obtained by the Laplace transform algorithm is effectively enhanced while the overall image remains clear and free of artifacts, thereby increasing the accuracy of automatic identification and positioning of defective areas in subsequent injection molded parts.

[0059] Step S102: For any pixel in the grayscale image, construct at least two windows of different preset sizes centered on the pixel, and obtain the overall importance of the pixel based on the difference in grayscale values ​​and the degree of correlation of grayscale values ​​of the pixels in each window.

[0060] Since the Laplace transform algorithm has a strong sharpening effect on the parts of a grayscale image with obvious local grayscale changes, and the parts of a grayscale image with obvious local grayscale changes are the edge parts, the importance of each pixel can be obtained based on the local grayscale change characteristics of each pixel. The greater the importance of a pixel, the more likely it is to be an edge pixel, and the more it needs to be enhanced.

[0061] However, not only defective areas in grayscale images have edges, but normal textures in plastic injection molded parts also have edges. Since defective areas in plastic injection molded parts are characterized by complex local grayscale variations and poor texture continuity and consistency (i.e., strong local grayscale fluctuations and low similarity of local grayscale changes), for any pixel in a grayscale image, the degree of abnormality of that pixel can be obtained based on its local grayscale variation characteristics. Then, combining the importance and abnormality of any pixel, the overall importance of that pixel is obtained, i.e., the probability that any pixel belongs to the edge pixel of the defective area. Furthermore, the Laplace operator in the Laplace transform algorithm is optimized based on the overall importance of any pixel, increasing the accuracy of subsequent automatic identification and localization of defective areas in injection molded parts. The steps for obtaining the overall importance of any pixel are as follows:

[0062] (1) Obtain the importance of any pixel.

[0063] In the grayscale image, taking any pixel as the center, a horizontal window is formed by the pixel and a first preset number of pixels in the horizontal direction; a vertical window is formed by the pixel and a first preset number of pixels in the vertical direction. Because there are many types of surface defects in injection molded parts, in order to prevent multiple edge pixels from being contained in one window, the importance of any pixel should be analyzed in a small area. In this embodiment, the first preset number is set to 5, but there is no limitation here, and it can be set according to the specific implementation scenario.

[0064] Since the edge is located at the boundary of gray-level changes, the gray-level changes of pixels on both sides of the edge are relatively uniform within a small area. That is, if any pixel is an edge pixel, the average gradient of its neighboring pixels is low, and the gradient values ​​of pixels on both sides of any pixel are highly similar.

[0065] Therefore, the gradient value of each pixel in the horizontal window is obtained to form a horizontal gradient line graph, where the horizontal axis represents the pixel position index and the vertical axis represents the gradient value. Similarly, the gradient value of each pixel in the vertical window is obtained to form a vertical gradient line graph, where the horizontal axis represents the pixel position index and the vertical axis represents the gradient value. The gradient value is a prior art concept and will not be elaborated upon here. Based on the fluctuation characteristics of the gradient values ​​in the horizontal and vertical gradient line graphs, the importance of any given pixel is determined. Specifically:

[0066] In the horizontal gradient line graph, the gradient change rate between any pixel and its left neighbor is obtained and denoted as the left change rate. The gradient change rate between any pixel and its right neighbor is obtained and denoted as the right change rate. The change rate is existing technology and will not be described in detail here.

[0067] Obtain the absolute value of the ratio of the left change rate to the right change rate to get the change rate ratio; calculate the absolute value of the difference between the constant 1 and the change rate ratio to get the gradient change difference value of any pixel.

[0068] Obtain the mean gradient of the horizontal gradient line graph, calculate the product of the reciprocal of the mean gradient and the reciprocal of the gradient change difference value, and obtain the edge feature value of any pixel in the horizontal direction;

[0069] According to the method for obtaining the edge feature value of any pixel in the horizontal direction, the edge feature value of any pixel in the vertical direction is obtained according to the vertical gradient line graph. The importance of any pixel is obtained according to the average of the edge feature values ​​in the horizontal direction and the edge feature values ​​in the vertical direction.

[0070] In one embodiment, the formula for calculating the importance of any pixel is:

[0071]

[0072] Where X represents the importance of any pixel; Let be the gradient value of the j-th pixel in the horizontal or vertical gradient line chart; n is the number of pixels in the horizontal or vertical gradient line chart. The left rate of change of any pixel in the horizontal or vertical gradient line graph; is the rate of change of any pixel in the horizontal or vertical gradient line graph; 'a' is the horizontal or vertical gradient line graph; || is the absolute value sign; 1 is a constant.

[0073] It should be noted that, This represents the gradient mean of a horizontal or vertical gradient line chart. The smaller the value, the more uniform the gray level distribution of any pixel is on both sides of the horizontal or vertical gradient line graph, the more it matches the local distribution characteristics of edge pixels, and the greater the importance of any pixel. This represents the difference in gradient change for any pixel in either the horizontal or vertical gradient line graph. The smaller the value, the more similar the left and right rates of change of any pixel in the horizontal or vertical gradient line graph, the higher the symmetry of the gradient values ​​of the pixels on both sides, the more it conforms to the local distribution characteristics of edge pixels, and the greater the importance of any pixel.

[0074] (2) Obtain the degree of abnormality of any pixel.

[0075] Since the location and size of the defect area are random, in order to prevent the defect area features from being too weak to be obtained in a window that is too small, and to prevent the defect area features from being weakened by an excessively large window containing too many normal areas, the abnormality of any pixel should be obtained by setting windows of different sizes. In this embodiment, the second preset number is set to 3. Square windows with sizes of 3×3, 7×7, and 11×11 are established with the pixel as the center. There is no limit here, and it can be set according to the specific implementation scenario.

[0076] Because the grayscale changes in the defective areas are complex, and it is necessary to consider whether the grayscale fluctuations are caused by the regular texture of the plastic injection molded part; secondly, although some defective areas have texture, their texture continuity is poor, and the texture may be broken or missing, which is manifested as low similarity of grayscale changes of pixels in adjacent rows within a square window. Therefore, the degree of abnormality of any pixel can be obtained based on the difference in grayscale values ​​and the degree of correlation of grayscale values ​​of pixels in each square window. Specifically:

[0077] For any square window, the gray values ​​of each row of pixels in the square window are combined into a gray value sequence. The standard deviation of each gray value sequence is obtained, and the mean of the standard deviation is obtained. The ratio of the standard deviation of each gray value sequence to the mean of the standard deviation is calculated, and the cumulative ratio value is obtained.

[0078] The Pearson correlation coefficient between the grayscale value sequences of every two adjacent rows in any square window is obtained respectively, and the mean of the Pearson correlation coefficient is obtained accordingly. The Pearson correlation coefficient is an existing technology and will not be described in detail here.

[0079] The outlier of any square window is obtained by multiplying the accumulated ratio value with the reciprocal of the mean Pearson correlation coefficient.

[0080] According to the method for obtaining outliers of any square window, the outliers of each square window are obtained respectively, and the average outlier value is obtained as the degree of outlier of any pixel.

[0081] In one embodiment, the formula for calculating the degree of anomaly of any pixel is:

[0082]

[0083] Where Y represents the degree of anomaly at any pixel; m is the second preset number (i.e., the number of square windows); Let be the standard deviation of the grayscale value sequence of the pixels in the t-th row of the c-th square window; s is the total number of rows of pixels in the c-th square window; Let be the Pearson correlation coefficient between the gray value sequence of the pixels in the t-th row and the gray value sequence of the pixels in the (t+1)-th row of the c-th square window.

[0084] It should be noted that, This is the cumulative ratio of the c-th square window for any pixel. The larger the value, the greater the fluctuation of the grayscale value of each row of pixels in the c-th square window of any pixel, the more the pixel matches the characteristics of the edge pixels of the defect area, and the greater the abnormality of any pixel. Let be the mean Pearson correlation coefficient of the c-th square window for any pixel. The smaller the value, the lower the similarity of the gray values ​​of the pixels in the c-th square window of any pixel, which is more consistent with the characteristics of poor texture continuity in the defect area, and the greater the degree of abnormality of any pixel.

[0085] (3) Combine the importance and abnormality of any pixel to obtain the overall importance of any pixel.

[0086] Specifically, the product of the importance level and the anomaly level is normalized to obtain the overall importance level of any pixel.

[0087] In one embodiment, the formula for calculating the overall importance of any pixel is as follows:

[0088] Z = nrom(X × Y)

[0089] Where Z represents the overall importance of any pixel; X represents the importance of any pixel; Y represents the anomaly of any pixel; and norm() is the normalization function.

[0090] It should be noted that the greater the importance of any pixel, the more likely that pixel is to be an edge pixel, and the greater the overall importance of any pixel; the greater the abnormality of any pixel, the more likely that pixel is to be an edge pixel of a defect area, and the greater the overall importance of any pixel.

[0091] Thus, the overall importance of any pixel is obtained.

[0092] Step S103: Establish a target window of a preset size with any pixel as the center, and obtain the degree of change of any pixel based on the difference in grayscale values ​​of the pixels within the target window.

[0093] After obtaining the overall importance of any pixel, image enhancement processing needs to be performed on that pixel. However, due to the different degrees of defects, the local gray-level jumps also vary. When a fixed Laplace operator is used to enhance the image, areas with indistinct gray-level jumps may not be effectively enhanced because the Laplace operator is too small; while areas with obvious gray-level jumps may be over-enhanced due to an overly large Laplace operator, resulting in artifacts. In order to enhance subtle defect areas while eliminating artifacts caused by over-enhancing strong edges, it is necessary to combine the jump degree and overall importance of the pixel to obtain an optimized Laplace operator corresponding to any pixel, and then use the optimized Laplace operator to enhance the image of any pixel.

[0094] In this embodiment, the Laplace transform algorithm is used as follows: Figure 3 The Laplace kernel is shown. Therefore, a target window of a preset size of 3×3 is established with any given pixel as the center. This is not limited here and can be set according to the specific implementation scenario. The degree of transition of any pixel is obtained based on the difference in grayscale values ​​of the pixels within the target window. Specifically:

[0095] In the target window, the average gray value of the four neighboring pixels of any pixel is obtained, and the absolute value of the difference between the average gray value and the gray value of any pixel is normalized to obtain the degree of change of any pixel.

[0096] In one embodiment, the formula for calculating the degree of judder at any pixel is:

[0097]

[0098] Where T is the degree of hopping at any pixel; g is the gray value of any pixel; The mean gray value of any pixel is the gray value of its four neighboring pixels; norm() is the normalization function.

[0099] It should be noted that the greater the difference between the gray values ​​of the four neighboring pixels of any pixel and the gray value of any pixel, the greater the degree of change of any pixel.

[0100] At this point, the degree of judder at any given pixel is obtained.

[0101] Step S104: Set an initial Laplace operator, optimize the initial Laplace operator according to the overall importance and hopping degree of any pixel, obtain an optimized Laplace operator for any pixel, and use the optimized Laplace operator as the Laplace operator in the Laplace transform algorithm to perform image enhancement processing on any pixel.

[0102] After obtaining the degree of transition and the overall importance of any pixel, it is necessary to obtain the optimized Laplace operator corresponding to any pixel, and then use the optimized Laplace operator to perform image enhancement on any pixel.

[0103] When the abrupt change of any pixel is small, if the overall importance of that pixel is high, it indicates that the pixel belongs to the edge of a defect region, but the abrupt change is not obvious and it is not easy to distinguish. In this case, the response intensity of the Laplace operator needs to be increased to further enhance it. When the abrupt change of any pixel is large, to prevent image artifacts, regardless of whether it is a defect region, the response intensity of the Laplace operator needs to be decreased to prevent artifacts. That is, in this case, only the importance of any pixel is considered. Therefore, the steps to optimize the initial Laplace operator based on the overall importance and abrupt change of any pixel to obtain the optimized Laplace operator for any pixel are as follows:

[0104] In this embodiment, the threshold for the degree of abrupt change is set to 0.6 based on historical experience. Since the commonly used center coefficient of the Laplace operator is -4, the center coefficient of the initial Laplace operator is set to -4. This is not a limitation and can be set according to the specific implementation scenario. If the degree of abrupt change of any pixel is greater than or equal to 0.6, then any pixel is recorded as a high-abrupt-change pixel. Based on the degree of abrupt change and the importance of the high-abrupt-change pixel, the center coefficient of the initial Laplace operator is optimized to obtain the optimized center coefficient.

[0105] Specifically, the product of the degree of change and the importance of any pixel is normalized to obtain an adjustment value. The optimized center coefficient is obtained by adding the center coefficient and the adjustment value.

[0106] In one embodiment, the formula for calculating the optimized center coefficient of high-jump pixels is:

[0107] G = -4 + exp(T × X)

[0108] Where G is the optimized center coefficient of the high-jump pixel; T is the jump degree of the high-jump pixel; X is the importance of the high-jump pixel; exp() is an exponential function with the natural constant as the base, used for normalization; and -4 is the center coefficient of the initial Laplace operator.

[0109] It should be noted that the greater the degree of hopping of a high-jump pixel, the higher the probability that the high-jump pixel belongs to an edge pixel, the larger the optimization center coefficient of the high-jump pixel, and the smaller the sharpening intensity of the optimized Laplace operator corresponding to the optimization center coefficient.

[0110] If the hopping degree of any pixel is less than 0.6, then any pixel is recorded as a low-hopping pixel. Based on the hopping degree and overall importance of the low-hopping pixel, the center coefficient of the initial Laplace operator is optimized to obtain the optimized center coefficient.

[0111] Specifically, the product of the inverse of the degree of change of any pixel and the overall importance is normalized to obtain an adjustment value. Based on the difference between the center coefficient and the adjustment value, an optimized center coefficient is obtained.

[0112] In one embodiment, the formula for calculating the optimized center coefficient of low-jump pixels is:

[0113]

[0114] Where D is the optimized center coefficient of the low-jump pixel; T is the jump degree of the low-jump pixel; Z is the overall importance of the low-jump pixel; exp() is an exponential function with the natural constant as the base, used for normalization; and -4 is the center coefficient of the initial Laplace operator.

[0115] It should be noted that the greater the overall importance of low-jump pixels, the greater the likelihood that the low-jump pixels belong to the edge pixels of the defect area, the smaller the optimization center coefficient of the low-jump pixels, and the greater the sharpening intensity of the optimized Laplace operator corresponding to the optimization center coefficient.

[0116] After obtaining the optimized center coefficient of any pixel, the optimized Laplace operator of that pixel is obtained based on the optimized center coefficient. Obtaining the Laplace operator based on the center coefficient is an existing technology and will not be elaborated here.

[0117] Furthermore, after obtaining the optimized Laplace operator for any pixel, the optimized Laplace operator is used as the Laplace operator in the Laplace transform algorithm to perform image enhancement processing on any pixel. The Laplace transform algorithm is existing technology and will not be described in detail here.

[0118] This completes the image enhancement process for any given pixel.

[0119] Step S105: Perform image enhancement processing on each pixel in the grayscale image to obtain an enhanced image, and perform defect detection on the enhanced image to obtain the defect area on the surface of the plastic injection molded part.

[0120] Based on the above method for image enhancement processing of any pixel, image enhancement processing is performed on each pixel in the grayscale image to obtain an enhanced image.

[0121] The surface texture, color, shape and other features of a large number of defect area images are acquired and trained. A detection model for automatic identification and localization of surface defect areas of plastic injection molded parts is obtained by using machine learning algorithms. The obtained enhanced images are input into the detection model to obtain the surface defect areas of plastic injection molded parts, thus completing the automatic identification and localization of surface defect areas of plastic injection molded parts.

[0122] The main objective of this invention is to optimize the Laplace operator in the Laplace transform algorithm. The use of machine learning algorithms to obtain detection models and to use these models to detect enhanced images are existing technologies and will not be elaborated here.

[0123] In summary, this embodiment acquires a surface image of a plastic injection molded part, performs grayscale processing on the surface image to obtain a grayscale image; for any pixel in the grayscale image, at least two windows of different preset sizes are constructed with the pixel as the center, and the overall importance of the pixel is obtained based on the difference in grayscale values ​​and the degree of correlation of grayscale values ​​of the pixels in each window; a target window of a preset size is established with the pixel as the center, and the degree of abrupt change of the pixel is obtained based on the difference in grayscale values ​​of the pixels in the target window; an initial Laplace operator is set, and the initial Laplace operator is optimized based on the overall importance and abrupt change of the pixel to obtain an optimized Laplace operator for the pixel, and the optimized Laplace operator is used as the Laplace operator in the Laplace transform algorithm to perform image enhancement processing on the pixel; image enhancement processing is performed on each pixel in the grayscale image to obtain an enhanced image, and defect detection is performed on the enhanced image to obtain the surface defect area of ​​the plastic injection molded part. Specifically, based on the differences and correlations of gray values ​​among pixels in a grayscale image, the overall importance and hopping degree of each pixel are obtained. Then, based on the overall importance and hopping degree of each pixel, the Laplace operator in the Laplace transform algorithm is optimized, so that the defective parts in the enhanced image obtained by the Laplace transform algorithm are effectively enhanced while the overall image remains clear and free of artifacts, thereby increasing the accuracy of automatic identification and positioning of defective areas in subsequent injection molded parts.

[0124] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for automatic identification and location of surface defects in plastic injection molded parts, characterized in that, The method includes: A surface image of a plastic injection molded part is acquired, and the surface image is converted to grayscale to obtain a grayscale image; For any pixel in the grayscale image, at least two windows of different preset sizes are constructed with the pixel as the center. The overall importance of the pixel is obtained based on the difference in grayscale values ​​and the degree of correlation between grayscale values ​​of the pixels in each window. A target window of a preset size is established with any pixel as the center, and the degree of abrupt change of any pixel is obtained based on the difference in grayscale values ​​of the pixels within the target window. An initial Laplace operator is set, and the initial Laplace operator is optimized according to the overall importance and judder degree of any pixel to obtain an optimized Laplace operator for any pixel. The optimized Laplace operator is used as the Laplace operator in the Laplace transform algorithm to perform image enhancement processing on any pixel. Each pixel in the grayscale image is subjected to image enhancement processing to obtain an enhanced image. Defect detection is then performed on the enhanced image to obtain the defect area on the surface of the plastic injection molded part. The step of constructing at least two windows of different preset sizes centered on any given pixel includes: In the grayscale image, with any pixel as the center, a horizontal window is formed by the pixel and a first preset number of pixels in the horizontal direction; a vertical window is formed by the pixel and a first preset number of pixels in the vertical direction; and a second preset number of square windows of different sizes are established with the pixel as the center. The step of obtaining the overall importance of any pixel based on the grayscale value difference and grayscale value correlation of pixels in each window includes: The gradient value of each pixel in the horizontal window is obtained to obtain a horizontal gradient line graph. The horizontal axis of the horizontal gradient line graph is the pixel position number, and the vertical axis is the gradient value. The gradient value of each pixel in the vertical window is obtained to obtain a vertical gradient line graph. The horizontal axis of the vertical gradient line graph is the pixel position number, and the vertical axis is the gradient value. The importance of any pixel is obtained based on the fluctuation characteristics of the gradient values ​​in the horizontal gradient line chart and the vertical gradient line chart. The degree of abnormality of any pixel is obtained based on the difference in grayscale values ​​and the degree of correlation of grayscale values ​​of pixels in each square window; The product of the importance level and the anomaly level is normalized to obtain the overall importance level of any pixel.

2. The method for automatic identification and location of surface defects in plastic injection molded parts according to claim 1, characterized in that, The step of obtaining the importance of any pixel based on the fluctuation characteristics of the gradient values ​​in the horizontal gradient line chart and the vertical gradient line chart includes: In the horizontal gradient line graph, the gradient change rate between any pixel and its left neighbor is obtained and denoted as the left change rate, and the gradient change rate between any pixel and its right neighbor is obtained and denoted as the right change rate. Obtain the absolute value of the ratio of the left change rate to the right change rate to get the change rate ratio; calculate the absolute value of the difference between the constant 1 and the change rate ratio to get the gradient change difference value of any pixel. Obtain the mean gradient of the horizontal gradient line graph, calculate the product of the reciprocal of the mean gradient and the reciprocal of the gradient change difference value, and obtain the edge feature value of any pixel in the horizontal direction; The edge feature value of any pixel in the vertical direction is obtained based on the vertical gradient line graph. The importance of any pixel is obtained based on the average of the edge feature values ​​in the horizontal direction and the edge feature values ​​in the vertical direction.

3. The method for automatic identification and positioning of surface defects in plastic injection molded parts according to claim 1, characterized in that, The step of obtaining the anomaly level of any pixel based on the grayscale value difference and grayscale value correlation of pixels in each square window includes: For any square window, the gray values ​​of each row of pixels in the square window are combined into a gray value sequence. The standard deviation of each gray value sequence is obtained, and the mean of the standard deviation is obtained. The ratio of the standard deviation of each gray value sequence to the mean of the standard deviation is calculated, and the cumulative ratio value is obtained. The Pearson correlation coefficient between the grayscale value sequences of every two adjacent rows in any square window is obtained respectively, and the mean of the Pearson correlation coefficient is obtained accordingly. The outlier of any square window is obtained by multiplying the accumulated ratio value with the reciprocal of the mean Pearson correlation coefficient. The outlier values ​​of each of the square windows are obtained, and the average outlier value is used as the degree of outlier for any pixel.

4. The method for automatic identification and positioning of surface defects in plastic injection molded parts according to claim 1, characterized in that, The step of obtaining the degree of judder of any pixel based on the difference in grayscale values ​​of pixels within the target window includes: In the target window, the average gray value of the four neighboring pixels of any pixel is obtained, and the absolute value of the difference between the average gray value and the gray value of any pixel is normalized to obtain the degree of change of any pixel.

5. The method for automatic identification and positioning of surface defects in plastic injection molded parts according to claim 1, characterized in that, The optimization of the initial Laplace operator based on the overall importance and hop count of any pixel to obtain an optimized Laplace operator for that pixel includes: Set a threshold for the degree of abrupt change and the center coefficient of the initial Laplace operator. If the degree of abrupt change of any pixel is greater than or equal to the threshold for the degree of abrupt change, then optimize the center coefficient of the initial Laplace operator according to the degree of abrupt change and the importance of any pixel to obtain the optimized center coefficient. If the degree of change of any pixel is less than the degree of change threshold, then the center coefficient of the initial Laplace operator is optimized according to the degree of change of any pixel and the overall importance, to obtain the optimized center coefficient; Based on the optimized center coefficient, the optimized laplace operator for any pixel is obtained.

6. The method for automatic identification and positioning of surface defects in plastic injection molded parts according to claim 5, characterized in that, The optimization of the center coefficients of the initial Laplace operator based on the degree of judder and importance of any pixel includes: The product of the judder degree and importance of any pixel is normalized to obtain an adjustment value. The optimized center coefficient is obtained by adding the center coefficient and the adjustment value.

7. The method for automatic identification and positioning of surface defects in plastic injection molded parts according to claim 5, characterized in that, The optimization of the center coefficients of the initial Laplace operator based on the degree of judder and overall importance of any pixel includes: The product of the inverse of the juxtaposition degree of any pixel and the overall importance degree is normalized to obtain an adjustment value. The optimized center coefficient is obtained based on the difference between the center coefficient and the adjustment value.

Citation Information

Patent Citations

  • Aluminum alloy auto part mold defect detection method based on image processing

    CN117011297A

  • Injection molding part production quality detection method based on image enhancement

    CN117036205A