Image enhancement method for automobile injection molding part detection

By calculating weighted local contrast and directional correction of gray levels, the problem of information loss in flow mark detection in traditional methods is solved, and high-quality flow mark enhancement effect is achieved.

CN120707455BActive Publication Date: 2025-11-11XIAN WEIER PRECISION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511158990.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-19
Publication Date
2025-11-11
Estimated Expiration
2045-08-19

AI Technical Summary

Technical Problem

Traditional image enhancement methods are difficult to effectively distinguish and enhance weak flow mark defects, which can easily lead to information loss or false detection.

Method used

By calculating the weighted local contrast of gray levels, and combining spatial distribution characteristics and gradient direction consistency, gray levels of interest and gray levels of non-interest are divided, and the gray levels of non-interest are directionally corrected to generate an enhanced image.

Benefits of technology

It significantly improves the accuracy and robustness of flow mark detection, avoids the loss of defect information caused by gray-level merging, preserves the details of the region of interest, and increases the distinction from the background.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120707455B_ABST
    Figure CN120707455B_ABST
Patent Text Reader

Abstract

This application relates to the field of image processing technology, and in particular to an image enhancement method for inspecting automotive injection molded parts. The method includes: acquiring a surface image of the automotive injection molded part; calculating the weighted local contrast of each gray level in the surface image; dividing the gray levels of the surface image into gray levels of interest and gray levels of non-interest based on the distribution of the weighted local contrast; generating a corrected gray value for each of the non-interest gray levels; and generating an enhanced image based on the gray levels of interest and the corrected gray values. The technical solution of this application can effectively amplify the contrast between subtle defects such as flow marks and the background, improving the accuracy of defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image enhancement method for the inspection of automotive injection molded parts. Background Technology

[0002] The production of automotive injection molded parts typically involves melting plastic particles at high temperatures and then injecting them into a mold to cool and solidify. However, during this process, improper control of the melt temperature or uneven filling speed can easily lead to the formation of fine lines, or flow marks, on the surface of the injection molded part, aligned with the direction of melt flow. These flow marks not only damage the product's appearance but may also potentially affect the mechanical properties and long-term durability of the injection molded part. Therefore, efficient and accurate quality inspection of injection molded parts to promptly detect flow mark defects is crucial for optimizing production processes and ensuring product quality.

[0003] Since a key characteristic of flow mark defects is that their grayscale difference from the normal surface of the injection molded part is very small, they are difficult to identify directly and reliably even under good lighting conditions. Therefore, before automated inspection, it is usually necessary to enhance the acquired surface image of the injection molded part to improve the contrast between the flow mark area and the background area.

[0004] However, traditional image enhancement methods, such as histogram equalization, while improving overall image contrast, involve rounding during quantization. This can cause regions with subtle gray-level differences to be merged into the same gray level. For example, a flow mark region with a gray value of 120 and a normal region with a gray value of 121 might both be mapped to a new gray value of 150 after equalization. This smooths out the characteristics of flow mark defects, easily leading to missed detections. Conversely, minute gray-level fluctuations in normal regions may be over-amplified and misjudged as defects, resulting in false positives. Summary of the Invention

[0005] To address the technical problem that traditional image enhancement methods in the prior art are unable to effectively distinguish and enhance weak flow mark defects, which can easily lead to information loss or the introduction of interference, this application provides an image enhancement method for the inspection of automotive injection molded parts, which can effectively avoid the problem of defect information loss caused by gray-level merging in traditional methods.

[0006] This application provides an image enhancement method for inspecting automotive injection molded parts. The method includes: acquiring a surface image of the automotive injection molded part; calculating the weighted local contrast of each gray level in the surface image, wherein the weighted local contrast is obtained by weighting an initial local contrast based on the spatial distribution characteristics and gradient direction consistency of pixels within the gray level; dividing the gray levels of the surface image into gray levels of interest and gray levels of non-interest based on the distribution of the weighted local contrast; generating a corrected gray value for each gray level of non-interest, wherein the corrected gray value is obtained by adjusting the difference between the gray level of non-interest and the nearest gray level of interest; and generating an enhanced image based on the gray levels of interest and the corrected gray values ​​to enhance the display effect of surface flow mark defects on the automotive injection molded part.

[0007] This application can preserve the details of the region of interest and increase its distinction from the background by directionally correcting the gray levels that are not of interest. This enhances the target while effectively avoiding the loss of defect information caused by gray level merging in traditional methods, and significantly improves the accuracy and robustness of flow mark detection.

[0008] In one embodiment, the initial local contrast satisfies the following relationship: ;in, Indicates the first Initial local contrast of each grayscale pixel; Indicates the first The first gray level grayscale value of each pixel; Indicates the first The first gray level Within the eight-neighbor area of ​​the pixel, the first grayscale value of each pixel; n represents the index value of the pixels in the eight neighboring regions of the current pixel and the total number of pixels, respectively; These represent the pixel index and total number at the current grayscale level, respectively. This represents the standard normalization function.

[0009] By calculating the degree of drastic local gray-level changes of pixels within each gray level, the correlation between different gray levels and image details can be preliminarily assessed, providing a basis for subsequent weighted processing.

[0010] In one embodiment, the step of weighting the initial local contrast based on the spatial distribution characteristics and gradient direction consistency of pixels within the gray level includes: for any gray level, obtaining the position information of all pixels at that gray level, and spatially clustering the position information to obtain a final cluster; obtaining the gradient direction angle of each pixel at the gray level, and calculating the standard deviation of the mean gradient direction angle of pixels within each final cluster; calculating a local contrast weight value based on the number of final clusters and the standard deviation; and weighting the initial local contrast based on the local contrast weight value to obtain a weighted local contrast.

[0011] By utilizing the prior knowledge that flow marks typically present as substantial stripes, and therefore the gradient direction within clusters is consistent and multiple lines may appear, resulting in a large number of clusters, we can effectively distinguish real flow mark defects from other high-contrast normal structures on injection molded parts, significantly reducing interference from subsequent processing.

[0012] In one embodiment, the spatial clustering of the location information includes: performing iterative self-organizing clustering on the location information; and after each iteration, calculating the minimum Euclidean distance between any two clusters, and stopping the iteration if all minimum Euclidean distances are greater than 1, thereby obtaining the final clusters.

[0013] In one embodiment, the local contrast weight values ​​satisfy the following relationship: ;in, Indicates the first Local contrast weight value of each grayscale pixel; Indicates the first The final number of clusters for all pixels at each gray level; This represents the maximum value among the final number of clusters at each gray level; Indicates the first The standard deviation of the mean gradient direction angle of pixels in each final cluster of all pixels at a gray level, where h represents the index value of the final cluster at that gray level. This represents the maximum value of the standard deviation for each gray level.

[0014] By combining the number of clusters in spatial distribution and the standard deviation of gradient direction through summation and unified adjustment, a reasonable weight is generated for each gray level, making the weight calculation process more robust.

[0015] In one embodiment, dividing the gray levels of the surface image into gray levels of interest and gray levels of non-interest includes: sorting the weighted local contrast of all gray levels; finding the two weighted local contrasts with the largest adjacent interval in the sorted results, and calculating their average as a segmentation threshold; marking gray levels with a weighted local contrast greater than the segmentation threshold as gray levels of interest, and marking gray levels with a weighted local contrast less than or equal to the segmentation threshold as gray levels of non-interest.

[0016] By finding the maximum natural discontinuity in the weighted contrast distribution as the threshold, gray levels can be adaptively divided into classes of interest that are highly correlated with potential defects and classes of non-interest that represent the background, avoiding the difficulty and inaccuracy of manually setting fixed thresholds.

[0017] In one embodiment, the corrected grayscale value satisfies the following relationship: ;in, Indicates the first The corrected values ​​of non-interesting gray levels; Indicates the first The original values ​​of the non-interesting gray levels; Indicates the first The most recently interested gray level value among the non-interesting gray levels; , They represent the first The absolute difference between a non-interesting gray level and its nearest interested gray level to the left, and the absolute difference between it and its nearest interested gray level to the right; Represents a symbolic function.

[0018] It can maximize the visual difference between the gray level of interest and the background area without changing the information of the gray level itself, thereby achieving precise enhancement of defects and effectively preventing the loss of key details.

[0019] In one embodiment, acquiring the surface image of the automotive injection molded part includes:

[0020] The original image of the automotive injection molded part containing the background area is acquired, and edge detection and contour finding are performed on the original image; the largest edge-enclosed area is selected according to the number of pixels in the contour area, and the surface image of the automotive injection molded part is segmented using masking.

[0021] In one embodiment, the gradient direction angle is calculated using the Sobel operator.

[0022] In one embodiment, the initial number of cluster centers used in the iterative self-organizing clustering is determined according to a preset ratio based on the total number of pixels at the gray level.

[0023] The technical solution of this application has the following beneficial technical effects:

[0024] This application can intelligently identify gray levels that are more likely to represent real flow marks by introducing a weighting mechanism based on spatial distribution and gradient direction. Subsequently, by directional correction of non-interesting gray levels rather than global equalization, not only are the details of the region of interest preserved, but the distinction between them and the background is also increased. Thus, while enhancing the target, it effectively avoids the problem of loss of defect information caused by gray level merging in traditional methods, and significantly improves the accuracy and robustness of flow mark detection.

[0025] Furthermore, by first intelligently identifying potential defect gray levels by combining spatial and gradient features with weighted local contrast, and then enhancing these defects through directional, non-global gray-level correction, high-quality enhancement of weak flow marks on the surface of automotive injection molded parts was finally achieved. Attached Figure Description

[0026] Figure 1 This is a flowchart of an image enhancement method for inspecting automotive injection molded parts according to an embodiment of this application.

[0027] Figure 2 This is a schematic diagram comparing the enhancement effects according to the embodiments of this application. Detailed Implementation

[0028] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0029] Figure 1 This is a flowchart of an image enhancement method for inspecting automotive injection molded parts according to an embodiment of this application. Figure 1 As shown, the image enhancement method for automotive injection molded parts inspection includes steps S101 to S104, which are described in detail below.

[0030] S101: Acquire surface images of automotive injection molded parts and calculate the weighted local contrast of each gray level in the surface image. The weighted local contrast is obtained by weighting the initial local contrast based on the spatial distribution characteristics of pixels within the gray level and the consistency of gradient direction.

[0031] In one embodiment, an industrial camera can be used to acquire raw images of the surface of an automotive injection-molded part under uniform illumination provided by a ring-shaped shadowless light source. Since the shape of automotive injection-molded parts is often irregular, the acquired raw images will contain background areas such as workbenches. In order to accurately analyze the surface of the injection-molded part, it is necessary to segment the target area from the background.

[0032] Specifically, the acquired raw image can be processed by Gaussian filtering to remove random noise introduced by sensor or environmental factors; then, the Canny edge detection operator is used to perform edge detection on the filtered image to obtain a binary edge image containing the contour of the injection molded part and the edges of the internal structure; then, on this binary edge image, a contour search algorithm is applied to find all closed contours.

[0033] Furthermore, the process iterates through all found closed contours, calculates the area enclosed by each contour, selects the contour with the most pixels, and creates a mask based on this contour. This mask is then applied to the original image to accurately segment the injection-molded part area, obtaining the surface image of the automotive injection-molded part. Finally, the segmented surface image is converted to a grayscale image, and the total number of occurrences of each grayscale level in the image is counted, along with a list of coordinates of all pixels possessing that grayscale value.

[0034] In an optional embodiment, the pixel grayscale value variation in a localized area of ​​flow mark defects is more drastic than in a flat, normal area. Therefore, the average grayscale variation of the pixel group corresponding to each grayscale level in the localized area can be calculated first. For each grayscale level, its initial local contrast satisfies the following relationship:

[0035]

[0036] in, Indicates the first Initial local contrast of each grayscale pixel; Indicates the first The first gray level grayscale value of each pixel; Indicates the first The first gray level Within the eight-neighbor area of ​​the pixel, the first grayscale value of each pixel; n represents the index value of the pixels in the eight neighboring regions of the current pixel and the total number of pixels, respectively; These represent the pixel index and total number at the current grayscale level, respectively. This represents the standard normalization function.

[0037] In this alternative embodiment, since normal structural corners and other edge areas on the injection molded part also have high initial local contrast, which can interfere with flow mark identification, the morphological features of flow mark defects (multiple fine stripes in the same direction) can be used to distinguish between real flow marks and normal structural edges.

[0038] Specifically, for each gray level, iterative self-organizing clustering is performed on the coordinates of all its pixels. After each iteration, the minimum Euclidean distance between all pairs of clusters is checked. If the minimum distance between all clusters is greater than 1, the iteration stops, and the final number of clusters is recorded. The initial number of cluster centers used in the iterative self-organizing clustering is determined according to a preset proportion based on the total number of pixels at the gray level. For example, for each gray level, the position of each pixel in the image at that gray level is obtained, and 10% of the preset cluster centers for the pixels at the current gray level are randomly selected to perform iterative self-organizing clustering on all positions.

[0039] Next, the Sobel operator is used to calculate the gradient direction angle of each pixel in the image. For each final cluster at each gray level, the mean of the gradient direction angles of all pixels within the cluster is calculated, then the standard deviation of this mean is calculated, and finally the 1st... Local contrast weight value for each gray level Use it to adjust the initial local contrast. Weighting is performed to obtain the final weighted local contrast. The local contrast weight values ​​satisfy the following relationship:

[0040]

[0041] in, Indicates the first Local contrast weight value of each grayscale pixel; Indicates the first The final number of clusters for all pixels at each gray level; This represents the maximum value among the final number of clusters at each gray level; Indicates the first The standard deviation of the mean gradient direction angle of pixels in each final cluster of all pixels at a gray level, where h represents the index value of the final cluster at that gray level. This represents the maximum value of the standard deviation for each gray level.

[0042] Thus, through image acquisition and preprocessing, an interference-free grayscale image of the injection molded part surface is obtained. By combining the spatial distribution of pixels and the gradient direction, two unique morphological features of flow marks, the salience of the real flow mark area can be amplified, while effectively suppressing the interference caused by the edges of normal structures.

[0043] S102, based on the distribution of weighted local contrast, divide the gray levels of the surface image into gray levels of interest and gray levels of non-interest.

[0044] In one embodiment, the weighted local contrast of all gray levels can be sorted in ascending order, and the sorted result forms an ordered sequence. The values ​​in the sequence, from low to high, reflect the correlation strength between each gray level and image details. Specifically, the weighted local contrast values ​​of gray levels in normal, flat areas will be very small and concentrated at the beginning of the sequence, while the weighted local contrast values ​​of gray levels constituting flow marks or strong edges will be significantly higher and located at the end of the sequence.

[0045] Next, in the sorted results, the difference between every two adjacent values ​​is calculated. The two weighted local contrast values ​​with the largest adjacent intervals are found, and their average is calculated as the segmentation threshold. The logic is that there will be a natural maximum difference between the gray levels of interest and those of non-interest in the feature dimension of weighted local contrast. By locating this maximum difference, the optimal boundary point between the two gray levels can be found. The threshold determined by this method can be dynamically adjusted according to the specific situation of the current image, exhibiting strong adaptability.

[0046] In this optional embodiment, gray levels with a weighted local contrast greater than the segmentation threshold are marked as gray levels of interest, and gray levels with a weighted local contrast not greater than the segmentation threshold are marked as gray levels of non-interest.

[0047] In this way, by sorting the weighted local contrast, finding the maximum interval, and calculating the adaptive threshold, it is possible to achieve automatic and accurate classification of gray levels, thereby effectively distinguishing gray levels that may constitute flow mark defects from gray levels that represent the background.

[0048] S103, for each non-interesting gray level, generate a corrected gray level value, wherein the corrected gray level value is obtained by adjusting the difference between the non-interesting gray level and its nearest interested gray level.

[0049] In an optional embodiment, to avoid damaging the grayscale information of interest, only the grayscale levels of non-interest are corrected, moving them away from the grayscale levels of interest, thereby visually increasing the contrast. The corrected grayscale values ​​satisfy the following relationship:

[0050]

[0051] in, Indicates the first The corrected values ​​of non-interesting gray levels; Indicates the first The original values ​​of the non-interesting gray levels; Indicates the first The most recently interested gray level value among the non-interesting gray levels; , They represent the first The absolute difference between a non-interesting gray level and its nearest interested gray level to the left, and the absolute difference between it and its nearest interested gray level to the right; Represents a symbolic function.

[0052] For example, suppose the gray levels of interest are {..., 100, 105, 130, 132, ...}, and the gray levels of non-interest to be corrected are... The most recent grayscale level of interest is 115. The value is 105, and the correction direction is... (115-105)=+1, calculate the left and right difference variables as 115-105=10 and 115-130=-15, and calculate the correction magnitude. =10, generating a corrected grayscale value of 10. .

[0053] In this way, by making targeted and controlled corrections to non-target areas, conditions can be created for the final high contrast enhancement without losing the details of the defects.

[0054] S104, an enhanced image is generated based on the gray level of interest and the corrected gray value to enhance the display effect of surface flow mark defects in automotive injection molded parts.

[0055] In one embodiment, the values ​​of all gray levels marked as gray levels of interest can be kept unchanged, while the values ​​of all gray levels marked as gray levels of non-interest can be updated to the generated corrected gray values. By iterating through every pixel of the surface image grayscale, a final enhanced image is obtained once the values ​​of all pixels have been updated.

[0056] like Figure 2 The diagram shown is a comparison of enhancement effects according to an embodiment of this application. Compared with the enhanced image and histogram obtained by conventional methods, the enhanced image and histogram obtained by this application have a higher proportion of defects, clearer edges, and the background noise and irrelevant textures are not excessively amplified.

[0057] For example, suppose an image contains gray levels 0-9: frequency sequence Here, it is assumed that 4, 7, and 8 are gray levels of interest, 1 and 5 are normal edge gray levels (i.e., not of interest), and the others are normal regions (i.e., not of interest are 0, 1, 2, 3, 5, 6, and 9). The traditional processing procedure is as follows:

[0058] Using the cumulative distribution function of relative frequency for an image:

[0059]

[0060] Where k represents the k-th gray level, and K represents the total number of gray levels. This represents the cumulative frequency count at the k-th gray level, where N is the total frequency count. This is the cumulative distribution function.

[0061] Gray levels equalized using the cumulative distribution function arrive Grayscale value:

[0062]

[0063] The conclusion is that traditional processing would merge 3, 4, and 5, and 6 and 7 (which would blur some regions of interest).

[0064] The amendments to this application are:

[0065] right , , , While maintaining the original state, for the erroneously merged regions that are difficult to distinguish in regions 3, 4, 5, 6, and 7, the processing allows the regions of interest to be preserved, and neighboring regions of non-interest can be merged, thereby further highlighting the contrast of the regions of interest.

[0066] In this way, by recombining the retained details of the gray levels of interest with the corrected gray levels of non-interest, a high-quality enhanced image with prominent defect features is finally generated.

[0067] It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this patent application shall be determined by the appended claims.

Claims

1. An image enhancement method for inspecting automotive injection molded parts, characterized in that, include: A surface image of an automotive injection-molded part is acquired, and the weighted local contrast of each gray level in the surface image is calculated. The weighted local contrast is obtained by weighting an initial local contrast based on the spatial distribution characteristics and gradient direction consistency of pixels within each gray level. The initial local contrast satisfies the following relationship: in, Indicates the first Initial local contrast of each grayscale pixel; Indicates the first The first gray level grayscale value of each pixel; Indicates the first The first gray level Within the eight-neighbor area of ​​the pixel, the first grayscale value of each pixel; n represents the index value of the pixels in the eight neighboring regions of the current pixel and the total number of pixels, respectively; These represent the pixel index and total number at the current grayscale level, respectively. The standard normalization function is represented; the weighting of the initial local contrast based on the spatial distribution characteristics and gradient direction consistency of pixels within the gray level includes: For any gray level, obtain the position information of all pixels at that gray level, and perform spatial clustering on the position information to obtain the final cluster. Obtain the gradient direction angle of each pixel at the gray level, and calculate the standard deviation of the mean gradient direction angle of pixels in each final cluster. The local contrast weight value is calculated based on the number of final clusters and the standard deviation. The initial local contrast is weighted based on the local contrast weight values ​​to obtain the weighted local contrast. Based on the distribution of the weighted local contrast, the gray levels of the surface image are divided into gray levels of interest and gray levels of non-interest. For each of the non-interesting gray levels, a corrected gray level is generated, wherein the corrected gray level is obtained by adjusting the difference between the non-interesting gray level and the nearest interested gray level; An enhanced image is generated based on the gray level of interest and the corrected gray value to enhance the display effect of surface flow mark defects of the automotive injection molded part.

2. The image enhancement method for inspecting automotive injection molded parts according to claim 1, wherein... The characteristic is that, The spatial clustering of the location information includes: Iterative self-organizing clustering is performed on the location information; and After each iteration, the minimum Euclidean distance between any two clusters is calculated. If all minimum Euclidean distances are greater than 1, the iteration is stopped, and the final clusters are obtained.

3. The image enhancement method for inspecting automotive injection molded parts according to claim 1, characterized in that, The local contrast weight values ​​satisfy the following relationship: in, Indicates the first Local contrast weight value of each grayscale pixel; Indicates the first The final number of clusters for all pixels at each gray level; This represents the maximum value among the final number of clusters at each gray level; Indicates the first The standard deviation of the mean gradient direction angle of pixels in each final cluster of all pixels at a gray level, where h represents the index value of the final cluster at that gray level. This represents the maximum value of the standard deviation for each gray level.

4. The image enhancement method for inspecting automotive injection molded parts according to claim 1, characterized in that, The step of dividing the gray levels of the surface image into gray levels of interest and gray levels of non-interest includes: Sort the weighted local contrast of all gray levels; In the sorted results, find the two weighted local contrasts with the largest adjacent intervals and calculate their mean as the segmentation threshold. Gray levels with a weighted local contrast greater than the segmentation threshold are marked as gray levels of interest, and gray levels with a weighted local contrast not greater than the segmentation threshold are marked as gray levels of non-interest.

5. The image enhancement method for inspecting automotive injection molded parts according to claim 1, characterized in that, The corrected grayscale value satisfies the following relationship: in, Indicates the first The corrected values ​​of non-interesting gray levels; Indicates the first The original values ​​of the non-interesting gray levels; Indicates the first The most recently interested gray level value among the non-interesting gray levels; , They represent the first The absolute difference between a non-interesting gray level and its nearest interested gray level to the left, and the absolute difference between it and its nearest interested gray level to the right; Represents a symbolic function.

6. The image enhancement method for inspecting automotive injection molded parts according to claim 1, characterized in that, The acquisition of surface images of automotive injection molded parts includes: Acquire the original image of the automotive injection molded part containing the background area, and perform edge detection and contour finding on the original image; The largest edge-wrapped area is selected based on the number of pixels within the contour area, and the surface image of the automotive injection molded part is segmented using masking.

7. The image enhancement method for inspecting automotive injection molded parts according to claim 1, characterized in that, The gradient direction angle is calculated using the Sobel operator.

8. The image enhancement method for inspecting automotive injection molded parts according to claim 2, characterized in that, The initial number of cluster centers used in the iterative self-organizing clustering is determined according to a preset ratio based on the total number of pixels at the gray level.

Citation Information

Patent Citations

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

    CN117036205A

  • Intelligent detection method for parts produced by numerical control machine tool

    CN118570216A