Injection molded parts coating quality inspection method and system based on machine vision

Through the machine vision-based coating quality detection method of injection molded parts, using grayscale values ​​and edge feature analysis, the bright printing defects on the surface of injection molded parts are accurately identified, which solves the problem of inaccurate detection results in the prior art, and improves the accuracy and efficiency of detection.

CN120182247BActive Publication Date: 2025-09-02XIAN WEIER PRECISION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510616254.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2025-09-02
Estimated Expiration
2045-05-14

AI Technical Summary

Technical Problem

The prior art cannot accurately identify bright printing defects in the quality inspection of injection molded parts, resulting in low accuracy of the detection results.

Method used

The coating quality detection method of injection molded parts based on machine vision is adopted. By analyzing the grayscale values ​​and neighborhood differences in the grayscale image of the injection molded parts surface, combining edge features, deep bright and light bright stamp areas are identified to construct the coating quality detection model of injection molded parts.

Benefits of technology

It improves the accuracy and efficiency of coating quality inspection of injection molded parts, can accurately identify bright print defect areas, reduces the cost of manual identification and reduces the impact of subjective experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120182247B_ABST
    Figure CN120182247B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image data processing technology, and in particular to a method and system for detecting the coating quality of injection molded parts based on machine vision. The method comprises the following steps: determining the dark bright print area pixel points and the edge pixel points of the dark bright print area based on the difference between the grayscale value of the pixel point and the maximum grayscale value in the surface grayscale image, and the average grayscale difference between the pixel point and different scale neighborhoods; obtaining the light bright print area pixel points based on the probability that the remaining pixel points are the dark bright print area, the difference between the brightness value and the standard value, and the chromaticity distance between the remaining pixel points and the remaining pixel points corresponding to the standard value; and enhancing the dark bright print area pixel points and the corresponding edge pixel points and the light bright print area pixel points and the corresponding edge pixel points in the surface image of the injection molded part and then training them to realize the coating quality detection of the injection molded part, thereby effectively improving the accuracy and efficiency of the coating quality detection of the injection molded part.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, and in particular to a method and system for detecting the coating quality of injection molded parts based on machine vision. Background Art

[0002] Injection molded parts are plastic products manufactured through the injection molding process and can be used in a variety of applications, including automotive, electronics, home appliances, and medical devices. Quality testing of finished injection molded parts verifies their performance and reduces the potential for safety hazards in their use.

[0003] During the injection molding process, problems can arise, including improper injection pressure settings, changes in raw material properties, and mold quality. For example, when polyethylene is heated too high, its gloss changes, ultimately resulting in bright marks on the surface of the molded part. These marks typically appear as irregular curves and blurred boundaries. Injection molding lines typically operate at high speeds, and to improve production efficiency, it's crucial to quickly detect bright mark defects on a large number of molded parts in a short period of time to facilitate accurate screening.

[0004] Existing technologies often rely on manual recognition or image enhancement to identify bright prints. However, manual recognition is costly and susceptible to subjective experience. During image enhancement, the boundary between the bright print and the background area is blurred, making accurate enhancement impossible. Consequently, the resulting quality inspection results are less accurate.

[0005] In summary, how to accurately identify bright printing defects on the surface of injection molded parts during injection molded parts quality inspection, so as to accurately obtain injection molded parts quality inspection results, is a problem that needs to be solved at present. Summary of the Invention

[0006] In order to solve the technical problem of how to accurately identify bright printing defects on the surface of injection molded parts during injection molded part quality inspection, thereby accurately obtaining injection molded part quality inspection results, the present invention provides an injection molded part coating quality inspection method and system based on machine vision.

[0007] In a first aspect, the present invention provides a method for inspecting the coating quality of injection molded parts based on machine vision, which adopts the following technical solutions:

[0008] The method for inspecting the coating quality of injection molded parts based on machine vision includes the following steps:

[0009] Obtain the edge of the surface grayscale image of the injection molded part; obtain the probability that the pixel is a dark bright print area according to the difference between the grayscale value of the pixel point in the surface grayscale image and the maximum grayscale value, and the average grayscale difference between the pixel point and the neighborhood of different scales, and determine the pixel point of the dark bright print area; iteratively obtain the grayscale entropy value of the pixel point in the edge in different neighborhoods within the neighborhood variation range, and in response to the grayscale entropy value before and after the iteration meeting the iteration termination condition, obtain the edge pixel point of the dark bright print area in each edge; convert the remaining pixel points in the surface grayscale image of the injection molded part except the pixel points of the dark bright print area and the edge pixel points into a surface color image, and convert the surface The brightness value that appears most frequently in the color image is recorded as the standard value; the probability that the remaining pixel points are in the light bright print area is determined based on the probability that the remaining pixel points are in the dark bright print area, the difference between the brightness value and the standard value, and the chromaticity distance between the remaining pixel points and the remaining pixel points corresponding to the standard value, and the pixel points in the light bright print area are obtained; the edge pixels of the surface grayscale image except the edge pixels of the dark bright print area are regarded as the edge pixels of the light bright print area; the dark bright print area pixels and the corresponding edge pixels and the light bright print area pixels and the corresponding edge pixels in the surface image of the injection molded part are enhanced and trained to realize the coating quality detection of the injection molded part.

[0010] The present invention can accurately obtain the injection molded part coating quality inspection results by constructing a recognition model for the bright print defect area on the injection molded part surface. When extracting the bright print defects on the injection molded part surface, the present invention takes into account that global enhancement of the injection molded part surface image will also amplify the background noise, but when only the bright print area is enhanced, the bright print area includes both a dark bright print area and a light bright print area, and its boundary is relatively fuzzy, making it impossible to accurately identify the bright print defect area; based on this, the present invention accurately screens the dark bright print area in the surface image by analyzing the grayscale feature difference between the pixel points of the dark bright print area and the background area, and combining the edge curvature feature of the dark bright print area. In addition, the present invention accurately screens the light bright print area in the surface image according to the brightness and chromaticity feature difference between the remaining pixel points and the background area in the remaining pixel points, effectively improving the accuracy and efficiency of extracting the injection molded part surface bright print defects when constructing the model, thereby effectively improving the accuracy of the injection molded part coating quality inspection.

[0011] According to the method for inspecting the coating quality of injection molded parts based on machine vision provided by the present invention, the method for obtaining the edges in the surface grayscale image of the injection molded part further includes: performing preprocessing after photographing the surface of the injection molded part to obtain the surface image of the injection molded part; and grayscale processing the surface image of the injection molded part to obtain the surface grayscale image of the injection molded part.

[0012] According to the method for inspecting the coating quality of injection molded parts based on machine vision provided by the present invention, the probability that the pixel point is a dark bright print area is obtained based on the difference between the grayscale value of the pixel point in the surface grayscale image and the maximum grayscale value, and the average grayscale difference between the pixel point and the neighborhood of different scales, including: presetting the neighborhood scale of the pixel point; calculating the first The probability that the pixel is a dark bright print area :

[0013] ;

[0014] For the The grayscale value of the pixel, is the maximum grayscale value of the grayscale image of the injection molded part surface, is the number of neighborhood scales, For the Pixel No. The grayscale mean of the neighborhood at each scale, is an exponential function with base e.

[0015] The present invention provides an accurate calculation formula for the probability that a pixel point is in a dark bright print area. By analyzing the difference between the grayscale value of the pixel point and the grayscale of the background area, as well as the grayscale change of the pixel point in different scale neighborhoods, the probability that the pixel point is in a dark bright print area is accurately obtained.

[0016] According to the method for inspecting the coating quality of injection molded parts based on machine vision provided by the present invention, determining the pixel points of the dark bright print area includes: taking the pixel points whose probability of being a dark bright print area in the surface grayscale image is greater than the probability mean of the dark bright print area in the surface grayscale image as the pixel points of the dark bright print area.

[0017] According to the machine vision-based injection molded part coating quality detection method provided by the present invention, the method for obtaining the neighborhood variation range includes: taking the maximum width of the edge in the surface grayscale image as the upper limit of the neighborhood variation range, and taking 1 as the lower limit of the neighborhood variation range.

[0018] The present invention takes the maximum edge width as the maximum range of the neighborhood, so that the neighborhood can cover all pixels in the edge area, thereby obtaining the grayscale features of the edge more comprehensively and accurately, and improving the accuracy of edge approximation.

[0019] According to the method for detecting the coating quality of injection molded parts based on machine vision provided by the present invention, the grayscale entropy value before and after the iteration satisfies the iteration termination condition, and the edge pixel points of the dark bright print area in each edge are obtained, including: taking the upper limit of the neighborhood change range of the pixel point as the initial neighborhood of the pixel point Start iteration and determine the initial neighborhood of the pixel Grayscale entropy value within , neighborhood Grayscale entropy value within , neighborhood Grayscale entropy value within and neighborhood Grayscale entropy value within ; If the pixel meets the iteration termination condition:

[0020] and , then the pixel point is determined to be the edge pixel point of the dark bright print area; otherwise, the iteration continues until the iteration termination condition is met or the iteration ends within the neighborhood change range.

[0021] The present invention takes into account that the edge of the dark bright print area is located between the dark bright print area and the light bright print area, and there is a significant difference in grayscale on both sides. Therefore, the present invention determines the pixel points that meet this feature through edge approximation, so that the edge of the dark bright print area can be accurately obtained.

[0022] According to the method for inspecting the coating quality of injection molded parts based on machine vision provided by the present invention, the method for determining the probability that the remaining pixel point is a light bright print area includes: taking the average of the coordinates of all the remaining pixel points corresponding to the standard value to obtain the standard pixel point coordinates corresponding to the standard value; calculating the probability that the remaining pixel point is a light bright print area; The probability that the remaining pixels are light-bright printed areas :

[0023] ;

[0024] For the The probability that the remaining pixels are dark bright print areas, For the The brightness values ​​of the remaining pixels, is the standard value, For the The chromaticity distance between the remaining pixel coordinates and the standard pixel coordinates, is the maximum chromaticity distance between the coordinates of all remaining pixels and the coordinates of the standard pixel. is the standard normalization function.

[0025] The present invention takes into account that the pixel points in the light and bright print area are close to the brightness of the background area in the surface color image but have a large difference in chroma. Therefore, it provides an accurate method for calculating the probability that the remaining pixel points are in the light and bright print area. By analyzing the brightness difference and chroma difference between the remaining pixel points and the background area, the probability that the remaining pixel points are in the light and bright print area can be accurately obtained.

[0026] According to the method for inspecting the coating quality of injection molded parts based on machine vision provided by the present invention, obtaining the pixel points of the light bright print area includes: taking the pixel points whose probability of the light bright print area in the surface color image is greater than the probability mean of the light bright print area in the surface color image as the pixel points of the light bright print area.

[0027] According to the machine vision-based injection molded part coating quality inspection method provided by the present invention, the pixel points in the dark bright print area and the corresponding edge pixel points and the pixel points in the light bright print area and the corresponding edge pixel points in the surface image of the injection molded part are enhanced and then trained to achieve injection molded part coating quality inspection, including: labeling the pixel points in the dark bright print area and the corresponding edge pixel points and the pixel points in the light bright print area and the corresponding edge pixel points after enhancement, and inputting them into the model for training to obtain an injection molded part coating quality inspection model; inputting the latest collected injection molded part surface image into the injection molded part coating quality inspection model to obtain an injection molded part coating quality inspection result.

[0028] In a second aspect, the present invention provides an injection molded part coating quality inspection system based on machine vision, which adopts the following technical solutions:

[0029] The system for detecting the coating quality of injection molded parts based on machine vision includes a processor and a memory. The memory stores computer program instructions. When the computer program instructions are executed by the processor, the method for detecting the coating quality of injection molded parts based on machine vision is implemented.

[0030] By adopting the above technical solution, the above-mentioned machine vision-based injection molded part coating quality detection method is generated into a computer program and stored in a memory to be loaded and executed by a processor, thereby making a terminal device based on the memory and the processor for easy use.

[0031] The present invention has the following technical effects:

[0032] Based on the above technical solution, the present invention provides a method and system for detecting the coating quality of injection molded parts based on machine vision. By constructing a recognition model for the bright print defect area on the surface of the injection molded part, the injection molded part coating quality detection result can be accurately obtained. When extracting the bright print defects on the surface of the injection molded part, the present invention takes into account that the global enhancement of the surface image of the injection molded part will also amplify the background noise. However, when only the bright print area is enhanced, the bright print area includes both a dark bright print area and a light bright print area, and its boundary is relatively fuzzy, making it impossible to accurately identify the bright print defect area. Based on this, the present invention accurately screens the dark bright print area in the surface image by analyzing the grayscale feature difference between the pixel points of the dark bright print area and the background area, and combining the edge curvature feature of the dark bright print area. In addition, the present invention accurately screens the light bright print area in the surface image according to the brightness and chromaticity feature difference between the remaining pixel points and the background area in the remaining pixel points, effectively improving the accuracy and efficiency of extracting the bright print defects on the surface of the injection molded part when constructing the model, thereby effectively improving the accuracy of the injection molded part coating quality detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of a process for inspecting the coating quality of injection molded parts based on machine vision provided by an embodiment of the present invention;

[0034] Figure 2 A schematic diagram of a surface grayscale image of an injection molded part with a bright print defect provided by an embodiment of the present invention;

[0035] Figure 3 A schematic diagram of a surface brightness image of an injection molded part with bright printing defects provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0036] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, but not all of the embodiments.

[0037] In order to accurately identify bright print defects on the surface of injection molded parts and thus accurately obtain injection molded part quality inspection results, an embodiment of the present invention discloses a method for inspecting the quality of injection molded part coatings based on machine vision. This method accurately identifies the bright print areas by analyzing the differences between the normal background area and the bright print areas on the surface of the injection molded parts. This allows an injection molded part coating quality inspection model to be accurately constructed based on this, effectively improving the accuracy of injection molded part coating quality inspection.

[0038] For details, please see Figure 1 As shown, Figure 1 A flow chart of a method for inspecting the coating quality of injection molded parts based on machine vision provided by an embodiment of the present invention, the method specifically comprising the following steps:

[0039] S1: Collect the surface grayscale image of the injection molded part.

[0040] It should be noted that the grayscale differences on the surfaces of injection molded parts without bright print defects are generally small. However, the model construction process requires the acquisition of a large number of injection molded part surface images. Performing bright print recognition on images of normal injection molded parts can result in a waste of resources. Therefore, embodiments of the present invention can preprocess the injection molded part images before starting recognition.

[0041] For example, in an embodiment of the present invention, collecting a surface grayscale image of an injection molded part includes: performing preprocessing after photographing the surface of the injection molded part to obtain a surface image of the injection molded part; and grayscale processing the surface image of the injection molded part to obtain a surface grayscale image of the injection molded part.

[0042] Among them, the preprocessing can be edge detection, screening of injection molded part surface images that may have bright marks, image denoising, grayscale conversion, etc., which can be specifically set according to actual needs and are not limited in this embodiment of the present invention.

[0043] Specifically, when photographing the surface of an injection-molded part, the produced injection-molded part can be placed in the center of a horizontal table, and a high-resolution industrial camera can be installed directly above the table to photograph the surface of the injection-molded part.

[0044] It is understandable that random noise may exist when capturing the surface image of the injection molded part due to interference from electronic components inside the shooting device. Therefore, the injection molded part image may be denoised after capturing the surface of the injection molded part.

[0045] For example, the influence of random noise on subsequent image processing can be eliminated by using a local weighted regression filtering algorithm, and the denoised image is then grayscale processed to obtain the surface grayscale images of all injection molded parts.

[0046] Based on the above steps, the surface grayscale images of all injection-molded parts are obtained, and the surface grayscale images of all injection-molded parts can be preliminarily classified to obtain the surface grayscale images of injection-molded parts that may contain bright printing defects.

[0047] It should be noted that the most prominent feature of a surface grayscale image of an injection molded part with a bright print defect is a high degree of grayscale disorder within the surface grayscale image. Based on this, when screening surface grayscale images that may contain bright print defects, embodiments of the present invention can obtain grayscale entropy values ​​from all surface grayscale images of injection molded parts and select those with the highest grayscale entropy values ​​as the grayscale surface images of the injection molded parts requiring subsequent bright print defect identification.

[0048] For example, an image whose grayscale entropy value is greater than an entropy value threshold may be used as a surface grayscale image of the injection molded part.

[0049] The entropy value threshold can be obtained based on the histogram distribution of the surface grayscale images of all injection molded parts, or can be set according to actual needs. The embodiment of the present invention does not impose too many restrictions on this.

[0050] After obtaining the surface grayscale image of the injection molded part through the above steps, edge detection can be performed on the surface grayscale image of the injection molded part to obtain the edges in the surface grayscale image of the injection molded part. Figure 2 As shown, Figure 2 A schematic diagram of a grayscale image of a surface of an injection molded part with a bright print defect provided by an embodiment of the present invention. Figure 2 It can be seen that the bright print on the surface of the injection molded part has the characteristics of irregular curved lines, blurred boundaries, and varying depths. The darker bright print appears as a white area in the image, and the background is invisible; while the lighter bright print appears as a white area, but the background is still visible.

[0051] Based on this, the embodiment of the present invention can enhance the bright print defect before identifying the bright print defect, thereby accurately identifying the bright print defect.

[0052] It can be understood that the bright print area includes a dark bright print area and a light bright print area, and the dark bright print area and the light bright print area have different performances. The dark bright print area has a larger grayscale value in the surface grayscale image as a whole and has obvious curved features.

[0053] Therefore, in the embodiment of the present invention, the dark bright print area in the grayscale image of the injection molded part surface can be obtained by first analyzing the grayscale features of the pixels and the curvature features of the edges in the grayscale image of the injection molded part surface.

[0054] For ease of understanding, the embodiment of the present invention is described by taking the processing of a surface grayscale image of any injection molded part that may have bright print defects as an example, but the embodiment of the present invention is not limited thereto.

[0055] S2: Based on the difference between the grayscale value of the pixel point in the surface grayscale image and the maximum grayscale value, as well as the average grayscale difference between the pixel point and its neighbors at different scales, the probability that the pixel point is in the dark bright print area is obtained, and the pixel point in the dark bright print area is determined.

[0056] It should be noted that the grayscale values ​​of pixels in the dark bright print area are larger, and the grayscale difference between them and the background area is significant. Therefore, by analyzing the grayscale differences between pixels in the surface grayscale image of the injection molded part and those in the background area, we can evaluate the grayscale characteristics of each pixel and accurately select pixels that meet the grayscale characteristics of the dark bright print area.

[0057] For example, in an embodiment of the present invention, when obtaining the maximum grayscale value in a surface grayscale image, a grayscale histogram of the surface grayscale image of the injection molded part can be plotted, with the grayscale value of the pixel as the horizontal axis and the number of pixels corresponding to the grayscale value as the vertical axis. On the horizontal axis of the grayscale histogram, the grayscale value increases from left to right, while on the vertical axis, the number of pixels increases from bottom to top. Ultimately, the grayscale value on the rightmost side of the horizontal axis is used as the maximum grayscale value in the surface grayscale image of the injection molded part.

[0058] It's understandable that the maximum grayscale value in a surface grayscale image is the brightest grayscale value in the image. Therefore, the maximum grayscale value is used as an indicator of dark and bright print areas in the surface grayscale image. The closer a pixel's grayscale value is to the maximum grayscale value, the closer it is to the grayscale characteristics of a dark and bright print area, and the more likely it is a dark and bright print pixel. Furthermore, pixel neighborhoods of varying sizes can encompass varying ranges of spatial information, helping to determine the grayscale characteristics of a pixel within its local area and its relationship to surrounding pixels. This allows for a more comprehensive analysis of whether a pixel is in a dark and bright print area, avoiding isolated pixel processing.

[0059] Based on this, the embodiment of the present invention can obtain the probability that the pixel point is a dark bright print area by combining the difference between the grayscale value of the pixel point and the maximum grayscale value, as well as the average grayscale difference between the pixel point and the neighbors of different scales, thereby accurately obtaining the possibility that each pixel point is in the dark bright print area.

[0060] For example, the number of neighborhood scales of a pixel point can be set to 3, and the size of the scale can be 3, 5, and 7, and the scale size is the side length of the neighborhood; the number of neighborhood scales of a pixel point and the size of the scale can be set according to actual needs.

[0061] Specifically, when obtaining the neighborhood of the current pixel at each scale, the neighborhood of the current pixel at different scales can be constructed with the current pixel as the center and the scale size as the side length.

[0062] Among them, if the number of pixels around some pixels is insufficient to construct their neighborhood, they can be supplemented by mirror filling or other methods.

[0063] Take an example to illustrate the neighborhoods of different scales of a pixel: if the neighborhood scale of a pixel is 3, then a neighborhood of size 3×3 centered on the pixel can be obtained, and the number of pixels contained in the neighborhood is 9.

[0064] For example, in the embodiment of the present invention, the probability of a pixel being a dark bright print area is calculated, and the details can be seen in the following relationship:

[0065] ;

[0066] For the The probability that the pixel point is a dark bright print area, For the The grayscale value of the pixel, is the maximum grayscale value of the grayscale image of the injection molded part surface, is the number of neighborhood scales, For the Pixel No. The grayscale mean of the neighborhood at each scale, is an exponential function with base e, is the absolute value symbol.

[0067] In the above formula, the normalized difference term Indicates the The difference between the gray value of the pixel and the maximum gray value, the smaller the value, the The closer the grayscale value of a pixel is to the grayscale characteristics of a dark bright print area, the greater the possibility that it is a dark bright print area.

[0068] Normalized difference term Indicates the The gray value of the pixel point is different from the gray value of the neighborhood at different scales. The smaller the value is, the smaller the gray value is. The closer the gray value of a pixel is to that of its neighborhood, the The more likely a pixel is to be in a dark and bright print area, the higher the probability is.

[0069] After obtaining the probability that each pixel point in the surface grayscale image of the injection molded part is a dark bright print area based on the above steps, the pixel points in the dark bright print area in the surface grayscale image of the injection molded part can be screened out.

[0070] For example, in an embodiment of the present invention, determining the pixel points of the dark bright print area includes: taking the pixel points whose probability of being a dark bright print area in the surface grayscale image is greater than the probability mean of the dark bright print area in the surface grayscale image as the pixel points of the dark bright print area.

[0071] The above steps analyze the probability of each pixel being a dark bright print area, and thus determine the pixels in the dark bright print area. However, the edges of the dark bright print area are blurred and mixed with the pixels in the light bright print area. Therefore, the embodiment of the present invention uses the following steps to analyze the edge curvature characteristics in the surface grayscale image to determine the edges of each dark bright print area.

[0072] S3: Obtain the edge of the surface grayscale image of the injection molded part, iteratively obtain the grayscale entropy values ​​of the pixel points in the edge in different neighborhoods within the neighborhood variation range, and in response to the grayscale entropy values ​​before and after the iteration satisfying the iteration termination condition, obtain the edge pixel points of the dark bright printed area in each edge.

[0073] For example, the Canny edge detection algorithm may be used to obtain edges in a grayscale image. The edge detection algorithm may be specifically configured according to actual needs.

[0074] It should be noted that the edges obtained based on the edge detection algorithm include both the edges of the dark bright print area and the edges of the light bright print area. The edge of the dark bright print area is between the dark bright print area and the light bright print area. Therefore, there is a significant difference in the grayscale on both sides of the edge pixels of the dark bright print area.

[0075] Based on this, the embodiment of the present invention can use the edge approximation principle to judge whether the grayscale value change of the pixel points at the edge position before and after edge contour approximation within the neighborhood change range conforms to the bending characteristics of the edge pixel points of the dark bright print area, thereby accurately obtaining the edge pixel points of the dark bright print area.

[0076] For example, in an embodiment of the present invention, a method for obtaining a neighborhood variation range of a pixel point includes: taking the maximum width of an edge in a surface grayscale image as the upper limit of the neighborhood variation range, and taking 1 as the lower limit of the neighborhood variation range.

[0077] It is understandable that the maximum edge width determines the maximum range of the neighborhood, so that the neighborhood can cover all pixels in the edge area. In this way, when analyzing the grayscale information of a pixel and its neighborhood, no edge-related pixels are missed, thereby obtaining the grayscale characteristics of the edge more comprehensively and accurately, avoiding the situation where the neighborhood is too small to fully include the edge, resulting in loss of edge information or misjudgment.

[0078] For example, in an embodiment of the present invention, in response to the grayscale entropy values ​​before and after iteration satisfying the iteration termination condition, the edge pixel points of the dark bright print area in each edge are obtained, including: taking the upper limit of the neighborhood change range of the pixel point as the initial neighborhood of the pixel point Start iteration and determine the initial neighborhood of the pixel Grayscale entropy value within , neighborhood Grayscale entropy value within , neighborhood Grayscale entropy value within and neighborhood Grayscale entropy value within ; If the pixel meets the iteration termination condition and , then the pixel point is determined to be the edge pixel point of the dark bright print area; otherwise, the iteration continues until the iteration termination condition is met or the iteration ends within the neighborhood change range.

[0079] It is understandable that the pixel point meets the iteration termination condition:

[0080] and , indicating that the pixel point meets the edge features of the dark bright print area. Based on this, all the edge pixels in the dark bright print area can be accurately obtained.

[0081] Thus, the embodiment of the present invention can accurately obtain the dark bright print area and the edge pixel points of the dark bright print area.

[0082] It can be understood that the edge obtained based on the edge detection algorithm includes the edge of the dark bright print area and the edge of the light bright print area. Therefore, after determining the edge pixel points of the dark bright print area in the edge of the surface grayscale image based on the above steps, the edge pixel points in the remaining edge are the edge pixel points of the light bright print area.

[0083] It should be noted that the dark bright print area and its edge pixels have a significant grayscale difference from the background area of ​​the injection molded part's surface grayscale image, making it accurate for localization based on the injection molded part's surface grayscale image. However, the pixels of the light bright print area are closer to the background area in grayscale space, making it difficult to accurately identify the light bright print area in the injection molded part's surface grayscale image. However, the light bright print area and the background area have different characteristics in luminance space: their luminance is similar but their colors are significantly different.

[0084] Based on this, the embodiment of the present invention can accurately filter out pixels of the light bright print area from the remaining pixels except for the dark bright print area pixels and edge pixels in the surface grayscale image of the injection molded part, that is, perform the following steps.

[0085] S4: Obtain the surface color image of the remaining pixel points, and determine the probability that the remaining pixel points are the light bright print area based on the probability that the remaining pixel points are the dark bright print area, the difference between the brightness value and the standard value, and the chromaticity distance between the remaining pixel points and the remaining pixel points corresponding to the standard value, and obtain the pixel points of the light bright print area.

[0086] For example, when obtaining the surface color image of the remaining pixels, the remaining pixels in the surface grayscale image of the injection molded part, except for the dark bright print area pixels and edge pixels, can be converted into the surface color image. Figure 3 As shown, Figure 3 A schematic diagram of a surface brightness image of an injection molded part with bright printing defects provided by an embodiment of the present invention.

[0087] In the color space of the surface color image, each remaining pixel corresponds to a three-dimensional coordinate (x, y, z), where y is the brightness value of the remaining pixel, and x and z are both the chromaticity values ​​of the remaining pixel.

[0088] For example, after the surface color image is obtained, a white balance correction algorithm may be used for processing, which may be specifically set according to actual needs.

[0089] For example, in the embodiment of the present invention, the brightness value that appears most frequently in the surface color image may be recorded as the standard value in the surface color image.

[0090] Specifically, when obtaining the standard value, the brightness value of the remaining pixels can be used as the horizontal axis and the number of remaining pixels corresponding to the brightness value as the vertical axis to draw a brightness histogram of the surface brightness image of the injection molded part. On the horizontal axis of the brightness histogram, the brightness value increases gradually from left to right, and on the vertical axis, the number of remaining pixels increases gradually from bottom to top. The brightness value corresponding to the maximum peak value of the number of remaining pixels is is the standard value in the surface color image.

[0091] It is understandable that the brightness of the background area in the surface brightness image of the injection molded part is relatively uniform and has a large area. Therefore, the obtained standard value can represent the standard brightness of the background area in the surface brightness image. However, the number of remaining pixels corresponding to the standard value is not unique. Therefore, it is necessary to first determine the coordinates corresponding to the standard value, so as to accurately analyze the difference between the coordinates of the remaining pixel points and the coordinates of the standard value.

[0092] For example, the coordinates of all remaining pixel points corresponding to the standard value can be averaged to obtain the standard pixel point coordinates corresponding to the standard value ( , , ).

[0093] For example, in the embodiment of the present invention, the probability that the remaining pixels are in the light-bright printed area is calculated. For details, see the following relationship:

[0094] ;

[0095] For the The probability that the remaining pixels are light-bright printed areas, For the The probability that the remaining pixels are dark bright print areas, For the The brightness values ​​of the remaining pixels, is the standard value, For the The chromaticity distance between the remaining pixel coordinates and the standard pixel coordinates, is the maximum chromaticity distance between the coordinates of all remaining pixels and the coordinates of the standard pixel. is the standard normalization function.

[0096] In the above formula, The chromaticity distance between the remaining pixel coordinates and the standard pixel coordinates The formula can be Get, among them, 、 are the chromaticity values ​​of the standard pixels, 、 Respectively The chromaticity value of the remaining pixels. It is understandable that due to The chromaticity distance is evaluated, so only the chromaticity value coordinates in the three-dimensional coordinate system are used.

[0097] For the The normalized difference between the brightness value of the remaining pixels and the standard value is The greater the probability that the remaining pixels are dark bright print areas, the smaller the value is, indicating that the The closer the brightness of the remaining pixels is to the brightness of the background area, the The larger the chromaticity distance between the remaining pixel coordinates and the standard pixel coordinates, the The more the brightness and chromaticity differences between the remaining pixel points and the background area conform to the characteristics of the light-bright printed area, the greater the possibility that the pixel point is a pixel point in the light-bright printed area, and the greater the corresponding probability.

[0098] After obtaining the probability that each remaining pixel point is in the light-bright print area according to the above steps, the pixel points in the light-bright print area among the remaining pixels can be accurately screened out.

[0099] For example, in an embodiment of the present invention, obtaining pixel points of the light bright print area includes: taking pixel points whose probability of the light bright print area in the surface color image is greater than the probability mean of the light bright print area in the surface color image as pixel points of the light bright print area.

[0100] In this way, after the embodiment of the present invention obtains the pixel points of the dark bright print area and the edge pixel points of the dark bright print area and the pixel points of the light bright print area and the edge pixel points of the light bright print area based on the above steps, they can be merged to accurately obtain the bright print area in the surface image of the injection molded part.

[0101] S5: The pixels in the dark bright print area and the corresponding edge pixels and the pixels in the light bright print area and the corresponding edge pixels in the surface image of the injection molded part are enhanced and then trained to realize the coating quality detection of the injection molded part.

[0102] For example, in an embodiment of the present invention, the pixels in the dark bright print area and the corresponding edge pixels and the pixels in the light bright print area and the corresponding edge pixels in the surface image of the injection molded part are enhanced and then trained to realize the injection molded part coating quality detection, including: the pixels in the dark bright print area and the corresponding edge pixels and the pixels in the light bright print area and the corresponding edge pixels in the surface image of the injection molded part are enhanced and labeled, and input into the model for training to obtain an injection molded part coating quality detection model; the latest collected injection molded part surface image is input into the injection molded part coating quality detection model to obtain the injection molded part coating quality detection result.

[0103] The enhancement method may be a local contrast enhancement algorithm. The enhancement step may be implemented using existing technologies, and will not be described in detail in the embodiment of the present invention.

[0104] The model may be a convolutional neural network, a random forest, etc., and may be specifically configured according to actual needs. In an embodiment of the present invention, a convolutional neural network may be used.

[0105] For example, when the dark bright print area pixel points and the corresponding edge pixel points and the light bright print area pixel points and the corresponding edge pixel points in the surface image of the injection molded part are enhanced and labeled, the dark bright print area pixel points and the corresponding edge pixel points and the light bright print area pixel points and the corresponding edge pixel points can be merged through logical operations, and morphological operations are applied for optimization to finally obtain a complete bright print area and label it. The obtained bright print area is, from the center to the outside, the dark bright print area pixel points, the dark bright print area edge pixel points, the light bright print area pixel points, and the light bright print area edge pixel points.

[0106] The labeling method may be a region growing-based labeling method, an edge detection-based labeling method, etc., which may be set according to actual needs. In an embodiment of the present invention, an edge detection-based labeling method may be used for labeling. The labeling step may be implemented by existing technologies, and the embodiment of the present invention will not be described in detail here.

[0107] After marking the bright-printed areas in all injection-molded part surface images based on the above steps, training can be performed based on the marked injection-molded part surface images.

[0108] Specifically, the labeled injection molded part surface images are divided into a training set, a validation set, and a test set to input into the model. After setting the model's learning parameters, training and verification are started, and finally an injection molded part coating quality inspection model that can be used to identify bright print defects on the injection molded part surface is obtained.

[0109] It can be seen that in the embodiment of the present invention, when determining the injection molded part coating quality inspection result, the edge in the surface grayscale image of the injection molded part can be obtained; based on the difference between the grayscale value of the pixel point in the surface grayscale image and the maximum grayscale value, and the mean value of the grayscale difference between the pixel point and the neighborhood of different scales, the probability that the pixel point is a dark bright print area is obtained, and the pixel point of the dark bright print area is determined; the grayscale entropy values ​​of the pixel point in the edge in different neighborhoods are iteratively obtained within the neighborhood variation range, and in response to the grayscale entropy values ​​before and after the iteration satisfying the iteration termination condition, the edge pixel points of the dark bright print area in each edge are obtained; the remaining pixel points in the surface grayscale image of the injection molded part, except for the pixel points of the dark bright print area and the edge pixel points, are converted into a surface color image. , the brightness value that appears the most times in the surface color image is recorded as the standard value; according to the probability that the remaining pixel points are the dark bright print area, the difference between the brightness value and the standard value, and the chromaticity distance between the remaining pixel points and the remaining pixel points corresponding to the standard value, the probability that the remaining pixel points are the light bright print area is determined, and the pixel points of the light bright print area are obtained; the edge pixels of the surface grayscale image except the edge pixels of the dark bright print area are regarded as the edge pixels of the light bright print area; the dark bright print area pixels and the corresponding edge pixels and the light bright print area pixels and the corresponding edge pixels in the surface image of the injection molded part are enhanced and trained to realize the injection molded part coating quality detection, which effectively improves the accuracy and efficiency of the injection molded part coating quality detection.

[0110] An embodiment of the present invention also discloses an injection molded part coating quality detection system based on machine vision, including a processor and a memory, wherein the memory stores computer program instructions. When the computer program instructions are executed by the processor, the injection molded part coating quality detection method based on machine vision provided by the present invention is implemented.

[0111] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface. The configuration and functions of these components are known in the art and will not be described in detail here.

[0112] In the present invention, the aforementioned memory may be any tangible medium that contains or stores a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0113] The above are all preferred embodiments of the present invention, and are not intended to limit the scope of protection of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for inspecting the coating quality of injection molded parts based on machine vision, characterized in that: include: Obtaining edges in the grayscale image of the surface of the injection molded part; According to the difference between the gray value of the pixel point and the maximum gray value in the surface gray image, and the average gray difference between the pixel point and the neighborhood of different scales, the probability that the pixel point is a dark bright print area is obtained, including: presetting the neighborhood scale of the pixel point; calculating the first The probability that the pixel is a dark bright print area : ; For the The grayscale value of the pixel, is the maximum grayscale value of the grayscale image of the injection molded part surface, is the number of neighborhood scales, For the Pixel No. The grayscale mean of the neighborhood at each scale, is an exponential function with base e, which determines the pixels in the dark and bright printing area; Iteratively obtain the grayscale entropy values ​​of different neighborhoods of the pixel points in the edge within the neighborhood variation range, and in response to the grayscale entropy values ​​before and after the iteration satisfying the iteration termination condition, obtain the edge pixel points of the dark bright print area in each edge; convert the remaining pixel points in the surface grayscale image of the injection molded part except the dark bright print area pixel points and the edge pixel points into the surface color image, and record the brightness value that appears the most times in the surface color image as the standard value; determine the probability that the remaining pixel points are the light bright print area based on the probability that the remaining pixel points are the dark bright print area, the difference between the brightness value and the standard value, and the chromaticity distance between the remaining pixel points and the remaining pixel points corresponding to the standard value, and obtain the light bright print area pixel points; the edge pixel points in the surface grayscale image except the dark bright print area are regarded as the light bright print area edge pixel points; the dark bright print area pixel points and the corresponding edge pixel points in the surface grayscale image of the injection molded part and the light bright print area pixel points and the corresponding edge pixel points are enhanced and trained to realize the coating quality detection of the injection molded part.

2. The method for detecting the coating quality of injection molded parts based on machine vision according to claim 1, characterized in that: The method of obtaining the edge in the surface grayscale image of the injection molded part also includes: After photographing the surface of the injection molded part, pre-processing is performed to obtain a surface image of the injection molded part; and the surface image of the injection molded part is gray-scaled to obtain a surface grayscale image of the injection molded part.

3. The method for detecting the coating quality of injection molded parts based on machine vision according to claim 1, characterized in that: Determining the pixel points in the dark bright print area includes: The pixel points whose probability of the dark bright print area in the surface grayscale image is greater than the probability mean of the dark bright print area in the surface grayscale image are regarded as the dark bright print area pixel points.

4. The method for detecting the quality of coatings on injection molded parts based on machine vision according to claim 1, wherein: Methods for obtaining neighborhood change range include: The maximum width of the edge in the surface grayscale image is taken as the upper limit of the neighborhood variation range, and 1 is taken as the lower limit of the neighborhood variation range.

5. The method for detecting the quality of coatings on injection molded parts based on machine vision according to claim 1, wherein: The step of obtaining edge pixel points of dark bright printed areas in each edge in response to the grayscale entropy values ​​before and after iteration satisfying the iteration termination condition comprises: The upper limit of the neighborhood change range of the pixel point is used as the initial neighborhood of the pixel point Start iteration and determine the initial neighborhood of the pixel Grayscale entropy value within , neighborhood Grayscale entropy value within , neighborhood Grayscale entropy value within and neighborhood Grayscale entropy value within ; If the pixel meets the iteration termination condition: and , then the pixel point is determined to be the edge pixel point of the dark bright print area; otherwise, the iteration continues until the iteration termination condition is met or the iteration ends within the neighborhood change range.

6. The method for detecting the quality of coatings on injection molded parts based on machine vision according to claim 1, characterized in that: Determining the probability that the remaining pixel points are in the light-bright printed area includes: Take the average of the coordinates of all remaining pixels corresponding to the standard value to obtain the standard pixel coordinates corresponding to the standard value; calculate the The probability that the remaining pixels are light-bright printed areas : ; For the The probability that the remaining pixels are dark bright print areas, For the The brightness values ​​of the remaining pixels, is the standard value, For the The chromaticity distance between the remaining pixel coordinates and the standard pixel coordinates, is the maximum chromaticity distance between the coordinates of all remaining pixels and the coordinates of the standard pixel. is the standard normalization function.

7. The method for inspecting the coating quality of injection molded parts based on machine vision according to claim 1, wherein: The step of obtaining pixel points in the light-bright printed area includes: The pixel points whose probability of the light-bright printing area in the surface color image is greater than the probability mean of the light-bright printing area in the surface color image are regarded as the light-bright printing area pixel points.

8. The method for inspecting the coating quality of injection molded parts based on machine vision according to claim 1, wherein: The method of enhancing and training the pixels of the dark bright print area and the corresponding edge pixels and the pixels of the light bright print area and the corresponding edge pixels in the surface grayscale image of the injection molded part to realize the coating quality inspection of the injection molded part includes: The pixels in the dark bright print area and the corresponding edge pixels as well as the pixels in the light bright print area and the corresponding edge pixels are enhanced and labeled, and input into the model for training to obtain an injection molded part coating quality detection model; the latest collected injection molded part surface image is input into the injection molded part coating quality detection model to obtain the injection molded part coating quality detection result.

9. The injection molded parts coating quality inspection system based on machine vision is characterized by: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method for detecting the quality of coatings of injection molded parts based on machine vision according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Bright spot defect detection method and device, computer equipment and storage medium

    CN115330704A

  • Online injection mold quality detection system based on machine vision

    CN117764981A