Surface defect analysis method of injection molded parts based on image recognition
Through multi-directional light irradiation image processing, the initial and corrected defect values of pixel points are calculated, which solves the problem of difficult distinction between the reflective area of the injection molded part and the white patches on the surface, improves the accuracy of defect analysis, and enhances the surface defects of the injection molded part Identification ability.
Patent Information
- Application Number
- CN202411266121.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-09-11
AI Technical Summary
In the analysis of surface defects of injection molded parts, the reflective area is difficult to distinguish from white patches, resulting in a low accuracy of defect analysis.
By obtaining the images under light irradiation in multiple directions, calculate the initial defect value and correct defect value of each pixel point, use the gradient amplitude and brightness of the pixel point in the image to reduce the impact of injection molding and reflective areas on the analysis, and judge the impact of the injection molding part shape and reflective areas on the analysis. Whether there are defects and improve the accuracy of analysis.
Effectively distinguish reflective areas and white patches, improve the accuracy of surface defect analysis of injection molded parts, reduce false detection, and enhance the ability to identify defects.
Smart Images

Figure CN118781114B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image data processing and an injection molded part surface defect analysis method based on image recognition. Background Art
[0002] Injection molding is a plastic processing technology, also known as injection molding. It refers to the process of heating plastic particles or powder to a molten state, then injecting the molten plastic into the closed cavity of the mold under high pressure, and obtaining a plastic product of the desired shape after cooling.
[0003] During the injection molding process, there are many factors that can cause white patches to appear on the surface of the molded plastic part. The area with white patches can be considered as a defective area on the surface of the injection molded part. Here are some situations that may cause white patches: If the material temperature is too high, it may cause the plastic to decompose or other adverse reactions to occur, which may cause white patches to appear on the surface of the molded plastic part. For example, these patches may be caused by the accumulation of substances after the decomposition of the plastic on the surface. If the cooling is uneven, it may cause stress concentration on the plastic part, which may cause white patches. Plastics shrink after injection molding, and white patches may appear on the plastic surface due to uneven shrinkage. This is because when the plastic shrinks, it may form tiny stress concentration areas, causing the optical properties of the area to change and appear white. If the clamping force is too large or uneven, it may cause uneven distribution of the plastic or a blocked plastic flow path, thereby affecting the molding quality. In this case, white patches may appear on the plastic surface.
[0004] The prior art, such as the patent document with authorization announcement number CN115311270B, discloses a method for detecting surface defects of plastic products. The method includes: based on the degree of aggregation and grayscale distribution characteristics of each pixel point in the image, reducing the grayscale value difference between areas that may be defects, thereby improving the accuracy of subsequent threshold segmentation, and thereby improving the accuracy of defect analysis.
[0005] However, since the surface of injection molded parts is usually smooth, under the influence of light, the smooth area on the surface of the injection molded parts may appear reflective. The reflective area is also white in the image, and the reflective area has color characteristics similar to white patches, but the reflective area is likely to be a non-defective area. Therefore, the above method cannot effectively distinguish between the "reflective" non-defective area and the defective area, that is, it is easier to cause false detection, which leads to a low accuracy rate of defect analysis on the surface of injection molded parts based on the above method. Summary of the invention
[0006] In order to solve the above-mentioned technical problem of low accuracy in defect analysis on the surface of injection molded parts, the present invention proposes an injection molded part surface defect analysis method based on image recognition.
[0007] The surface defect analysis method of injection molded parts based on image recognition includes:
[0008] Acquire multiple images of the surface of the target injection molded part illuminated by light from multiple directions respectively;
[0009] For a position on the surface of the target injection molded part, determine a target pixel point corresponding to the position in each image, and in each image, calculate an initial defect value of the target pixel point, wherein the initial defect value is positively correlated with the average of the gradient amplitudes of the target pixel point and its neighboring pixel points, and is positively correlated with the brightness of the target pixel point;
[0010] Calculate the corrected defect value F at the position:
[0011]
[0012] in, is the mean of the initial defect values of the target pixels in each image, is a natural exponential function, v is the mean brightness of the target pixels in each image, and c is the maximum value of the difference between the brightness of each target pixel and the mean brightness;
[0013] According to the corrected defect values at various positions on the surface of the target injection-molded part, it is determined whether the surface of the target injection-molded part has defects.
[0014] Taking into account that the white patch has a relatively obvious edge, the shape of the injection molded part itself also has a relatively obvious edge, but usually the color of the injection molded part itself is quite different from the color of the white patch. Based on this, the initial defect value of each pixel is calculated according to the gradient amplitude and brightness of each pixel in the image, and then the influence of the shape of the injection molded part itself on the defect analysis is weakened based on the initial defect value of each pixel.
[0015] Considering that the position of the reflective area is likely to change with the change of the lighting direction, while the position of the white patch does not change, based on this, the corrected defect value of each position in the image is calculated according to the initial defect value of each position in the image and the brightness of the pixel point at the same position in multiple images corresponding to the surface of the injection molded part. Among them, if the corrected defect value of a certain position on the surface of the target injection molded part is larger, the pixel point corresponding to the position is more likely to be the edge pixel point of the white patch. Then, based on the corrected defect value of each position, it is judged whether there is a defect on the surface of the target injection molded part, which reduces the influence of the reflective area in the image on the defect analysis and improves the accuracy of defect analysis on the surface of the target injection molded part.
[0016] Optionally, judging whether there is a defect on the surface of the target injection molded part according to the corrected defect value at each position on the surface of the target injection molded part includes:
[0017] The formula for calculating the defect index at each position on the surface of the target injection molded part is:
[0018]
[0019] Among them, m and n are not 0 at the same time. is the defect index corresponding to the pixel point in the i-th row and j-th column in the image, is the function that takes the minimum value, is the corrected defect value of the pixel point at the i-th row and j-th column, For the image Line Corrected defect values at corresponding positions of column pixels;
[0020] like , then the target injection molded part has surface defects, where is the total number of positions corresponding to defect indicators greater than the first preset defect threshold, is the total number of positions on the surface of the target injection molded part, is the first preset ratio threshold.
[0021] Considering that the edge pixels of the white patch have a certain "continuity", that is, the edge pixels of the white patch exist in the eight-neighborhood pixels of the edge pixels of the white patch, the white noise points in the image of the target injection molded part surface usually do not have this "continuity". Among them, the target injection molded part surface is the surface of a certain injection molded part. Based on this, in order to improve the accuracy of defect analysis on the target injection molded part surface, the defect index of each position is calculated according to the corrected defect value of each position on the target injection molded part surface, and then the defect index of each position is used to judge whether there is a defect on the target injection molded part surface, which reduces the influence of white noise points in the image on defect analysis and improves the accuracy of defect analysis on the target injection molded part surface.
[0022] like The larger it is, the more likely the pixel in the i-th row and j-th column in the image is an edge pixel of the white patch.
[0023] Optionally, judging whether there is a defect on the surface of the target injection molded part according to the corrected defect value at each position on the surface of the target injection molded part includes:
[0024] like , then the target injection molded part has surface defects, where is the total number of positions corresponding to the corrected defect values that are greater than the second preset defect threshold, is the total number of positions on the surface of the target injection molded part, is the second preset ratio threshold.
[0025] like The larger the value is, the more likely it is that the area of the white patch in the image is larger, which in turn means that the possibility of defects on the surface of the target injection molded part is greater.
[0026] Optionally, the initial defect value is calculated as:
[0027]
[0028] Among them, the initial defect value of the pixel at the i-th row and j-th column in any image is, is the first Line The gradient amplitude of the pixel points in the column, T is the maximum value of the gradient amplitude of the pixel points in any image, is the brightness of the pixel in the i-th row and j-th column in any one of the images, and G is the maximum brightness of the pixels in any one of the images.
[0029] like The larger the value is, the more likely the pixel in the i-th row and j-th column in any image is to be the edge pixel of the white patch or the edge pixel of the reflective area.
[0030] Optionally, the multiple directions are four directions.
[0031] Considering more lighting directions can improve the accuracy of calculating and correcting defect values.
[0032] Optionally, the angle between the irradiation direction of the light and the surface of the injection molded part is 45 degrees.
[0033] Optionally, the multiple directions are two directions, and the two directions are any two directions among the four directions.
[0034] Optionally, the first preset defect threshold is 0.5, and the first preset ratio threshold is 0.03.
[0035] Beneficial effects of the present invention:
[0036] White patches have obvious edges, and usually the color of white patches is quite different from the color of the surface of the injection molded part. Although the shape of the surface of the injection molded part itself has obvious edges, the color of the shape is usually quite different from the color of the white patches, and usually the position of the reflective area changes with the change of the lighting direction. Based on this, the gradient amplitude and brightness of each pixel in the image of the surface of the injection molded part can be used to determine whether there are defects on the surface of the injection molded part, thereby improving the accuracy of defect analysis on the surface of the injection molded part.
[0037] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0039] Figure 1 is a flow chart schematically illustrating a method for analyzing surface defects of injection molded parts based on image recognition according to an embodiment of the present invention;
[0040] Figure 2 is a schematic diagram schematically illustrating four light emitting directions according to an embodiment of the present invention;
[0041] Figure 3 is a schematic diagram schematically illustrating two target pixels according to an embodiment of the present invention;
[0042] Figure 4 is a first schematic diagram schematically illustrating a surface of an injection molded part according to an embodiment of the present invention;
[0043] Figure 5 1 is a second schematic diagram schematically showing the surface of an injection molded part according to an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", "A1", "B1", etc. in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit "A1", "B1", "first" and "second" to be different types; in other words, the serial numbers themselves for the components in this article, such as "A1", "B1", "first", "second", etc., are only used to distinguish the objects described, and do not have any order or technical meaning. For example: the first feature of an image is the feature of the image, where the first has no technical meaning and is only used to distinguish objects. The role of adding "first" includes: facilitating narration, understanding and explanation, and facilitating citing different objects, which can make the article more concise and clear. For example: the first feature and the second feature are different features.
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0046] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0047] Figure 1 FIG. 1 is a flow chart schematically showing a method for analyzing surface defects of injection molded parts based on image recognition according to an embodiment of the present invention. Figure 1 The specific instructions are as follows.
[0048] S1: Acquire multiple images of the surface of the target injection molded part illuminated by light from multiple directions; and then calculate the brightness and gradient amplitude of each pixel point in each image.
[0049] In one embodiment, the target injection molded part surface is the surface of any injection molded part. This article selects an injection molded part surface as an example to perform defect analysis on the injection molded part surface. The injection molded part surface analyzed below is the target injection molded part surface.
[0050] The surface of the injection molded part is usually smooth. When illuminated from a certain direction, some areas of the surface of the injection molded part may reflect light. The color of the reflective area in the image is white. The color of the white patches on the surface of the injection molded part is also white, so the reflective area and the white patches have the same color characteristics.
[0051] Multiple images of a certain injection molded part surface are obtained by respectively irradiating light from multiple directions, wherein the direction of light corresponds to the image one-to-one, and the position of the reflective area in one of the multiple images is likely to be different from the position of the reflective area in another of the multiple images. The reason is that: under normal circumstances, the curvature of the surface of the injection molded part is variable, and the reflection direction of light from different directions is likely to be different, so under normal circumstances, the position of the reflective area will change with the change of the incident light direction; the surface treatment method of the injection molded part and the material properties of the injection molded part will also affect the reflection of light. When light from different directions irradiates the surface of the injection molded part, the direction of the reflected light is likely to be different, which in turn causes the position of the reflective area to be likely to be different.
[0052] The position of the white patch in the image remains unchanged.
[0053] Generally, the color of the surface of the injection molded part is quite different from the color of the white patch and the color of the reflective area. For example, the color of the surface of the injection molded part is gray or black.
[0054] Based on this, the reflective areas and white patches can be effectively distinguished through contextual methods.
[0055] In one embodiment, four light sources are selected to illuminate the surface of a certain injection molded part respectively, and four images of the surface of the injection molded part are obtained, wherein the light emitting directions of different light sources are different. Figure 2 Schematic diagram schematically showing four light emitting directions according to an embodiment of the present invention, such as Figure 2 As shown, 201 is the first light emitting direction, 202 is the second light emitting direction, 203 is the third light emitting direction, 204 is the fourth light emitting direction, and 205 is the surface of the injection molded part. The angles between the first light emitting direction, the second light emitting direction, the third light emitting direction, and the fourth light emitting direction and the surface of the injection molded part are all 45 degrees. Each light emitting direction corresponds to an image. For example, when only the light source corresponding to 201 is turned on, one image is taken; when only the light source corresponding to 202 is turned on, another image is taken; and so on, four images are obtained. It should be noted that the camera used to take the image of the surface of the injection molded part is located directly above the surface of the injection molded part, and the camera is facing the surface of the injection molded part to take pictures.
[0056] In this embodiment, there is no restriction on the light intensity, and the implementer can set the light intensity according to the specific scene. The implementer can also set the angle between the light emitting direction and the surface of the injection molded part according to the specific scene.
[0057] In one embodiment, since the captured image may have a background image, and the background image is irrelevant information, the image of the captured image that only includes the surface of the injection molded part can be obtained by a semantic segmentation algorithm. Among them, the semantic segmentation algorithm is a prior art. The training process of the semantic segmentation model is briefly introduced below. For example, first: first obtain the first preset number of images of the surface of the injection molded part illuminated by the above four lighting directions, and all images constitute a semantic segmentation data set, wherein the first preset number can be an empirical value of 50. Second: mark the pixels in the image, that is, the pixels corresponding to the surface of the injection molded part in the image are marked as 1, and the pixels corresponding to the background in the image are marked as 0. Third: the structure of the network (semantic segmentation model) is a Unet structure. The implementer can select the network module in the Unet structure according to the specific scenario. Fourth: the loss function is a cross entropy loss function. The implementer can select the loss function according to the specific scenario. The semantic segmentation data set is input into the semantic segmentation model for training to obtain a trained semantic segmentation model.
[0058] In one embodiment, based on the Sobel operator, the gradient magnitude of each pixel in each image is calculated.
[0059] In one embodiment, each image of the surface of the injection molded part is converted from the RGB color space to the HSV color space to obtain the brightness of each pixel in each image.
[0060] S2: Based on the brightness and gradient amplitude of each pixel of each image, the initial defect value of each pixel of each image is calculated. The description is as follows:
[0061] For a position on the surface of the target injection molded part, determine the pixel point corresponding to the position in each image, and record it as the target pixel point corresponding to the position. For example, if the surface of the target injection molded part corresponds to 4 images, then the position corresponds to 4 target pixel points, and each image corresponds to one target pixel point. Among them, the target pixel points at the same position refer to the same object.
[0062] In each image, the initial defect value of the target pixel is calculated, and the initial defect value is positively correlated with the average of the gradient amplitudes of the target pixel and its neighboring pixels, and positively correlated with the brightness of the target pixel. In one embodiment, the initial defect value is positively correlated with the average of the gradient amplitudes of the target pixel and its eight neighboring pixels.
[0063] All remaining positions on the surface of the target injection molded part are traversed to obtain an initial defect value of a pixel point corresponding to each remaining position.
[0064] Figure 3 is a schematic diagram schematically showing two target pixels according to an embodiment of the present invention. Figure 3 As shown, 301 is a target pixel point, 302 is another target pixel point, 301 and 302 are at the same position in their respective images, and 303 is the surface of the injection molded part.
[0065] The position of a pixel in the image can be represented by the row information and column information of the pixel in the image. The row information and column information of different target pixels are the same. For example, the position of 301 in the image is the 5th row and the 5th column, and the position of 302 in the image is also the 5th row and the 5th column.
[0066] The following explains.
[0067] It should be noted that the surface of the injection molded part usually has some shapes, and the shapes have obvious edges (contours) in the image.
[0068] In the image, the white patch has a more obvious edge, and the brightness of the edge pixels of the white patch is higher. In the image, the reflective area also has a more obvious edge, and the brightness of the edge pixels of the reflective area is higher. However, in the image, the brightness of the edge pixels corresponding to the shape of the injection molded part itself is lower. The gradient amplitude of the edge pixels is larger.
[0069] Figure 4 Schematic diagram of the surface of the injection molded part according to an embodiment of the present invention. Figure 4As shown, 401 is a white patch, 402 is a reflective area, and 403 is the shape of the surface of the injection molded part.
[0070] Figure 5 Schematic diagram of the surface of the injection molded part according to an embodiment of the present invention. Figure 5 As shown, 501 is the edge pixel of the white patch, 502 is the edge pixel of the self-shape, and 503 is the pixel of the white patch.
[0071] Obviously, the initial defect value of the edge pixel corresponding to the shape of the injection molded part itself is smaller, the initial defect value of the edge pixel of the white patch is larger, and the initial defect value of the edge pixel of the reflective area is also larger. The edge pixel has a certain "continuity", so the larger the mean value of the gradient amplitude of the target pixel and its neighboring pixel, and the larger the brightness of the target pixel, the more likely the target pixel is to be the edge pixel of the white patch or the edge pixel of the reflective area.
[0072] S3: Based on the initial defect value and brightness of each pixel point in each image, the corrected defect value of each position on the surface of the target injection molded part is calculated. The description is as follows:
[0073] The expression of the corrected defect value at a position on the surface of the target injection molded part is:
[0074]
[0075] Wherein, F is the corrected defect value of a position on the surface of the target injection molded part, is the mean of the initial defect values of the target pixels in each image, is a natural exponential function, v is the average brightness of the target pixels in each image, and c is the maximum value of the difference between the brightness of each target pixel and the average brightness. In one embodiment, the difference in the context may be an absolute value of the difference.
[0076] in, It is a negative exponential function with a natural constant as the base, and its function is to perform negative correlation normalization on the data. It should be noted that the negative correlation normalization function can be other negative correlation normalization functions in the prior art.
[0077] The purpose of "+1" is to make Less than , that is, Make a downward correction.
[0078] All remaining positions in the target injection molded part surface are traversed to obtain a corrected defect value for each remaining position.
[0079] It should be noted that the pixel points in an image correspond one-to-one to the positions on the surface of the target injection molded part.
[0080] The following explains.
[0081] By calculating the initial defect value of each pixel in each image, the influence of the molding edge of the injection molded part surface on the defect analysis can be eliminated, but the influence of the reflective area on the defect analysis cannot be eliminated. Due to the reflection law of light, the material of the injection molded part, and the texture characteristics of the injection molded part surface, a certain area in the image collected under a certain lighting direction may correspond to a reflective area, and there may be no reflective area in the image collected under another lighting direction. Therefore, the initial defect value and brightness of each pixel in each image are selected to calculate the corrected defect value of each position on the surface of the target injection molded part.
[0082] It is understandable that if The larger the value is, the more likely the target pixel is the edge pixel of the white patch or the edge pixel of the reflective area.
[0083] The position of the white patch in the image does not change, and the position of the reflective area is likely to change with the change of the lighting direction. Moreover, the brightness of the edge pixels in the reflective area is significantly different from the brightness of the pixels in the normal area on the surface of the injection molded part. The normal area is an area that is neither a reflective area nor a white patch area. The brightness of the edge pixels of the white patch is significantly different from the brightness of the pixels in the normal area on the surface of the injection molded part. Therefore, if c is smaller, the target pixel is more likely to be a pixel of the white patch, that is, the area where the target pixel is located is the area corresponding to the white patch, and the pixels of the white patch include the edge pixels of the white patch. If v is larger, the target pixel is more likely to be a pixel of the white patch.
[0084] It should be noted that even if a certain reflective area is also a certain white patch area, the brightness of the pixels of the white patch is slightly different from the brightness of the pixels of the white patch that are not in the reflective area, because the colors of the pixels of the white patch and the pixels of the reflective area are both white.
[0085] Therefore, the larger F is, the more likely the target pixel is to be an edge pixel of the white patch.
[0086] In another embodiment, .
[0087] In order to facilitate understanding and make the above expression more intuitive, the above expression is now explained intuitively. In one embodiment, the expression for correcting the defect value is:
[0088]
[0089] in, is the corrected defect value of the pixel at the i-th row and j-th column in the image, is the total number of images corresponding to the target injection molded part surface, that is, the total number of lighting directions. is the initial defect value of the pixel at the i-th row and j-th column in the image corresponding to the k-th lighting direction, is the function that takes the maximum value, is the mean brightness of the pixels in the i-th row and j-th column of each image, is the brightness of the pixel at the i-th row and j-th column in the image corresponding to the k-th lighting direction, is an absolute value. In one embodiment, is 4.
[0090] In another embodiment, the expression for correcting the defect value is:
[0091]
[0092] in, is the brightness of the pixel in the i-th row and j-th column in the median map. The value of any channel of any pixel in the median map is the mean of the first value, wherein the first value is the mean of the channel values corresponding to the pixel at the corresponding position of any pixel in the multiple images corresponding to the target injection molded part surface. For example, if there are two images corresponding to a certain injection molded part surface, and the pixel value of a pixel at a certain position in one of the images is (100, 110, 120), and the pixel value of the pixel at the same position as the pixel in the other image is (102, 108, 118), then the pixel value of the pixel at the same position as the pixel in the median map corresponding to the injection molded part surface is ( , , ).
[0093] S4: judging whether there are defects on the surface of the target injection molded part according to the corrected defect values at various positions on the surface of the target injection molded part.
[0094] In one embodiment, judging whether there is a defect on the surface of the target injection molded part according to the corrected defect value at each position on the surface of the target injection molded part includes:
[0095] The formula for calculating the defect index at each position on the surface of the target injection molded part is:
[0096]
[0097] Where m is -1, 0 or 1, n is -1, 0 or 1, and m and n are not 0 at the same time. is the defect index corresponding to the pixel point in the i-th row and j-th column in the image, is the function that takes the minimum value, is the corrected defect value of the pixel point at the i-th row and j-th column, For the image Line The corrected defect value of the corresponding position of the column pixel, is an absolute value. It represents the minimum absolute value of the difference between the corrected defect value of the position corresponding to the pixel point in the i-th row and j-th column and the corrected defect value of the position corresponding to the eight neighboring pixel points of the pixel point, wherein the eight neighboring pixel points of the pixel point do not include the pixel point in the i-th row and j-th column.
[0098] like , then the target injection molded part has surface defects, where is the total number of positions corresponding to defect indicators greater than the first preset defect threshold, is the total number of positions on the surface of the target injection molded part, is the first preset ratio threshold. Wherein, the total number of positions in the surface of the target injection molded part is equal to the total number of pixels in any image.
[0099] In one embodiment, the implementer may set the first preset defect threshold according to the specific scenario. The first preset defect threshold may be an empirical value of 0.5. The implementer may set the first preset ratio threshold according to the specific scenario. The first preset ratio threshold may be an empirical value of 0.03.
[0100] The following explains.
[0101] Considering that the eight-neighborhood pixel points of a certain edge pixel point of a certain white patch in the image include other edge pixel points of the white patch, that is, the edge pixel points of the white patch have a certain "continuity".
[0102] The temperature near the injection molding machine is usually high. The image of the surface of the injection molded part captured by the camera may contain white noise caused by the thermal motion of electrons in the sensor. The white noise in the image will affect the accuracy of defect analysis. It should be noted that the pixels at the same position in multiple images corresponding to the surface of a certain injection molded part may all be white noise. The white noise in the image usually does not have a certain "continuity", that is, the white noise usually exists in isolation, that is, there is a high probability that there is no white noise in the eight-neighborhood pixel of a certain white noise in the image.
[0103] Therefore, if The smaller, and The larger the value is, the more likely the pixel in the i-th row and j-th column is to be an edge pixel of the white patch.
[0104] like The larger it is, the more likely it is that the total number of edge pixels of the white patches in the image is large, which means that the ratio of the area of the white patches in the image to the area of the image is large, which means that the possibility of defects on the surface of the target injection molded part is greater.
[0105] In one embodiment, judging whether there is a defect on the surface of the target injection molded part according to the corrected defect value at each position on the surface of the target injection molded part includes:
[0106] like , then the target injection molded part has surface defects, where is the total number of positions corresponding to the corrected defect values that are greater than the second preset defect threshold, is the total number of positions on the surface of the target injection molded part, is the second preset ratio threshold.
[0107] In one embodiment, the implementer may set the second preset defect threshold according to the specific scenario. The second preset defect threshold may be an empirical value of 0.5. The implementer may set the second preset ratio threshold according to the specific scenario. The second preset ratio threshold may be an empirical value of 0.03.
[0108] like The larger the value is, the more likely it is that the total number of edge pixels of the white patches in the image is large, which means that the possibility of defects on the surface of the target injection molded part is greater.
[0109] In one embodiment, the formula for calculating the initial defect value of each pixel in any image is:
[0110]
[0111] in, is the initial defect value of the pixel at the i-th row and j-th column in any image, is the first Line The gradient amplitude of the pixel points in the column, T is the maximum value of the gradient amplitude of all the pixel points in any image, is the brightness of the pixel at the i-th row and j-th column in any one of the images, and G is the maximum brightness of all the pixels in any one of the images.
[0112] in, Represents the average value of the gradient amplitude of the pixel point in the i-th row and j-th column and its eight neighboring pixels in any of the images.
[0113] like The larger the The larger the value is, the more likely the pixel in the i-th row and j-th column in any image is an edge pixel of a white patch or an edge pixel of a reflective area.
[0114] The above scheme takes any one injection molded part surface as an example to analyze whether the injection molded part surface has defects. For other injection molded part surfaces, the method for analyzing whether the injection molded part surface has defects is the same.
[0115] In one embodiment, if there are defects on the surface of the injection molded parts within a preset time, it is considered that there is an abnormality in the production process of the current injection molded parts. At this time, the relevant staff should be notified in time to debug the injection molding machine to avoid producing more defective products. The implementer can set the preset time according to the specific scenario. The preset time can take an empirical value of 10 minutes.
[0116] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0117] Additionally, the articles "a" and "an" as used in this application and the appended claims are generally construed to mean "one or more" unless specified otherwise or clear from context to be directed to a singular form.
[0118] Where the terms "includes," "having," "having," "having," or variations thereof are used in the detailed description or claims, such terms are intended to be inclusive in a manner similar to the term "comprising."
[0119] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. The method for analyzing surface defects of injection molded parts based on image recognition is characterized in that: include: Acquire multiple images of the surface of the target injection molded part illuminated by light from multiple directions; For a position on the surface of the target injection molded part, determine the target pixel point corresponding to the position in each image. In each image, calculate the initial defect value of the target pixel point. The initial defect value is positively correlated with the average value of the gradient amplitude of the target pixel point and its neighboring pixel points, and is positively correlated with the brightness of the target pixel point. Calculate the corrected defect value F at the position, ,in, is the mean of the initial defect values of the target pixels in each image, is a natural exponential function, v is the mean brightness of the target pixels in each image, and c is the maximum value of the difference between the brightness of each target pixel and the mean brightness; According to the corrected defect values at various positions on the surface of the target injection molded part, it is judged whether the surface of the target injection molded part has defects, including: the formula for calculating the defect index at various positions on the surface of the target injection molded part is: ; Where m is -1, 0 or 1, n is -1, 0 or 1, and m and n are not 0 at the same time. is the defect index corresponding to the pixel point in the i-th row and j-th column in the image, is the function that takes the minimum value, is the corrected defect value of the pixel at the position corresponding to the i-th row and j-th column, For the Line The corrected defect value of the corresponding position of the column pixel, is an absolute value; if , then there are defects on the surface of the target injection molded part, where is the total number of positions corresponding to defect indicators greater than the first preset defect threshold, is the total number of locations on the target injection molded part surface, is the first preset ratio threshold.
2. The method for analyzing surface defects of injection molded parts based on image recognition according to claim 1, characterized in that: Judging whether there is a defect on the surface of the target injection molded part according to the corrected defect values at various positions on the surface of the target injection molded part comprises: like , then the target injection molded part has surface defects, where is the total number of positions corresponding to the corrected defect values that are greater than the second preset defect threshold, is the total number of positions on the surface of the target injection molded part, is the second preset ratio threshold.
3. The method for analyzing surface defects of injection molded parts based on image recognition according to claim 1, characterized in that: The calculation formula for the initial defect value is: ; Where m is -1, 0 or 1, n is -1, 0 or 1, is the initial defect value of the pixel at the i-th row and j-th column in any image, is the first Line The gradient amplitude of the pixel points in the column, T is the maximum value of the gradient amplitude of the pixel points in any image, is the brightness of the pixel in the i-th row and j-th column in any one of the images, and G is the maximum brightness of the pixels in any one of the images.
4. The method for analyzing surface defects of injection molded parts based on image recognition according to claim 1, characterized in that: The multiple directions are four directions.
5. The method for analyzing surface defects of injection molded parts based on image recognition according to claim 1, characterized in that: The angle between the irradiation direction of the light and the surface of the injection molded part is 45 degrees.
6. The method for analyzing surface defects of injection molded parts based on image recognition according to claim 1, characterized in that: The multiple directions are two directions.
7. The method for analyzing surface defects of injection molded parts based on image recognition according to claim 1, characterized in that: The first preset defect threshold is 0.5, and the first preset ratio threshold is 0.03.
