Dust leakage detection method based on image processing
By calculating the matching coefficient and error coefficient of edge lines, combined with the difference in grayscale mean value, the accuracy of dust detection is improved, the problem of dust in the air affecting edge lines matching is solved, and more accurate dust leakage detection is achieved.
Patent Information
- Application Number
- CN202510758767.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-09
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-09
AI Technical Summary
In the prior art, due to the presence of dust in the air, the accuracy of edge line matching is low, which affects the accuracy of dust detection results.
By acquiring the reference image and real-time image of the device, calculate the matching coefficient and error coefficient of the edge line, combine the difference in grayscale mean value to judge the degree of dust leakage and improve the edge line matching effect.
It improves the accuracy of dust detection results, enhances the accuracy of edge line matching, and can more accurately judge the degree of dust leakage.
Smart Images

Figure CN120298394B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of dust detection, and in particular to a dust leakage detection method based on image processing. Background Art
[0002] During the injection molding process, dust is easily leaked due to factors such as broken plastic raw materials, insufficient sealing of the feeding and mold parting surfaces, and aging dust seals in the hydraulic system. Furthermore, low humidity, electrostatic adsorption, and insufficient coverage of exhaust gas treatment devices exacerbate dust suspension. Dust, when diffused in the air, not only reduces production safety but also poses a health risk to operators. Therefore, dust levels must be monitored throughout the production process to facilitate environmental management.
[0003] Chinese patent application publication number CN119147429A discloses an intelligent dust concentration detection method and system. The method includes: acquiring a grayscale image based on a preset sampling interval, using edge detection to obtain at least one region in the grayscale image, and calculating the boundary clarity of the target area; dividing the target area into two sub-areas, and determining the regional consistency of the target area based on the regional consistency of the two sub-areas; using the inverse of the product of the boundary clarity and regional consistency as a dust score. When the dust score is greater than a preset threshold, the target area is classified as a dust area; traversing the grayscale image to obtain the total area of the dust area, using the ratio of the total area of the dust area to the area of the grayscale image as the particle density, and calculating the final concentration value based on the particle density to complete the dust concentration detection.
[0004] In the existing technology, edge detection is performed on the grayscale image acquired in real time, and the extracted edge lines are matched and compared with the standard edge lines, so that the dust content in the air can be detected. When matching the edge lines, if the air is filled with dust, the edge lines of the object are blurred, resulting in low accuracy of edge line matching, and further low accuracy of the dust detection results. Summary of the Invention
[0005] In order to solve the problem of low accuracy of edge line matching caused by dust in the air, the present invention provides a dust leakage detection method based on image processing.
[0006] In a first aspect, the present invention provides a dust leakage detection method based on image processing, which adopts the following technical solutions:
[0007] A reference image of the device and a real-time image of the device during operation are obtained; edge detection is performed on the reference image and the real-time image to obtain multiple reference edge lines and multiple real-time edge lines respectively; a matching coefficient between each real-time edge line and multiple reference edge lines is calculated, and multiple matching coefficients are further obtained, where the matching coefficient represents the degree of similarity between the real-time edge line and the reference edge line; an error coefficient of the matching coefficient is calculated, and when the error coefficient is greater than a preset error threshold, the real-time edge line and the reference edge line with the largest matching coefficient are used as matching edge lines; in the matching edge lines, the difference between the grayscale mean values of the real-time edge line pixel points and the reference edge line pixel points is calculated, and the normalized result of the difference is used as a fuzzy evaluation to detect the degree of dust leakage.
[0008] The matching coefficient between the real-time edge line and the reference edge line is calculated, and the real-time edge line and the reference edge line are matched according to the matching coefficient to obtain the matching edge line. By comparing the difference in the grayscale mean in the matching edge line, the degree of dust leakage can be judged, which improves the matching effect between the real-time edge line and the reference edge line and further improves the accuracy of the dust detection results.
[0009] Preferably, the method also includes: mapping the real-time image and the reference image into a coordinate system respectively, further obtaining the position coordinates of each pixel point in the reference edge line and the real-time edge line, and calculating the distance between each pixel point in the real-time edge line and each pixel point in the reference edge line based on the position coordinates of the pixel point.
[0010] By calculating the distance between the pixel points in the real-time edge line and the pixel points in the reference edge line, a theoretical basis is provided for calculating the matching coefficient.
[0011] Preferably, the expression of the matching coefficient is:
[0012]
[0013] Where r represents the matching coefficient between the real-time edge line and the reference edge line, represents the distance between the nth pixel in the real-time edge line and the k+nth pixel in the reference edge line, m represents the total number of pixels in the real-time edge line, and mid represents the median. Indicates the distance between the mth pixel in the real-time edge line and the k+mth pixel in the reference edge line.
[0014] By calculating the matching coefficient, the real-time edge line and the reference edge line can be matched to obtain the matching edge line, which is convenient for detecting the dust concentration in the air.
[0015] Preferably, the expression of the error coefficient is:
[0016]
[0017] Where w represents the error coefficient of the matching coefficient between the real-time edge line and multiple reference edge lines, Represents the maximum value among multiple matching coefficients, Indicates the second largest value among multiple matching coefficients.
[0018] The error coefficient is obtained by calculation, and the accuracy of the matching coefficient can be measured by the error coefficient.
[0019] Preferably, the method also includes: when the error coefficient of the matching coefficient is less than a preset coefficient threshold, calculating the difference distance and similarity speed between the reference edge line and the real-time edge line, the similarity speed is negatively correlated with the difference distance, the difference distance represents the difference between the reference edge line and the real-time edge line, and the real-time edge line and the reference edge line with the largest similarity speed are used as matching edge lines.
[0020] Preferably, the method also includes: moving the real-time edge line to obtain a first auxiliary area; intercepting a sub-edge line on the reference edge line, the length of the sub-edge line is the same as the length of the real-time edge line, moving the sub-edge line to obtain a second auxiliary area, the first auxiliary area and the second auxiliary area are the same size, calculating the difference in grayscale values of pixels at the same position in the first auxiliary area and the second auxiliary area, and further obtaining a difference area.
[0021] Preferably, the expression of the difference distance is:
[0022]
[0023] Where, is the difference between the real-time edge line and the reference edge line when the width of the difference area is c, a is the number of columns in the difference area, b is the number of rows in the difference area, is the value of the xth row and yth column in the difference area.
[0024] The difference distance can reflect the difference between the real-time edge line and the area near the reference edge line, and can further determine whether the corresponding real-time edge line and the reference edge line are matching edge lines, thereby improving the accuracy of the edge line matching result.
[0025] Preferably, the expression of similar speed is:
[0026]
[0027] Where q is the similarity speed when the width of the difference area between the real-time edge line and the reference edge line is c, is the difference distance between the real-time edge line and the reference edge line when the width of the difference area is c, The difference distance between the real-time edge line and the reference edge line when the width of the difference area is 1, is the width of the difference region, and tanh represents the hyperbolic tangent function.
[0028] The similarity speed can be used to measure the similarity between the real-time edge line and the area near the reference edge line, providing a basis for judging whether the real-time edge line and the reference edge line are matching edge lines.
[0029] Preferably, edge detection is performed on the reference image and the real-time image using a Canny algorithm to obtain a plurality of reference edge lines and a plurality of real-time edge lines respectively.
[0030] Preferably, before edge detection is performed on the reference image and the real-time image, a step of denoising the reference image and the real-time image is also included.
[0031] The present invention has the following technical effects:
[0032] 1. Calculate the matching coefficient between the real-time edge line and the reference edge line, match the real-time edge line and the reference edge line according to the matching coefficient to obtain the matching edge line. By comparing the difference in the grayscale mean in the matching edge line, the degree of dust leakage can be judged, which improves the matching effect between the real-time edge line and the reference edge line and further improves the accuracy of the dust detection results.
[0033] 2. By calculating the similarity speed, it is possible to further determine whether the real-time edge line and the reference edge line are matching edge lines, thereby improving the accuracy of the matching edge line calculation results and further improving the accuracy of the dust detection results. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 The figure is a flow chart of the dust leakage detection method based on image processing of the present invention. DETAILED DESCRIPTION
[0035] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.
[0036] The embodiment of the present invention discloses a dust leakage detection method based on image processing, referring to Figure 1 , including the following steps:
[0037] S1: Acquire a reference image of the device and a real-time image of the device during operation, perform edge detection on the reference image and the real-time image to obtain a plurality of reference edge lines and a plurality of real-time edge lines, respectively.
[0038] An industrial camera is set up in the injection molding workshop. When the equipment in the injection molding workshop is in a shutdown state, the industrial camera is used to take an image of the workshop as a reference image. The reference image is an image when there is no dust in the air, and the reference image has clear edges. When the equipment in the injection molding workshop is in a production state, the image of the workshop is obtained in real time. The real-time image of the workshop obtained in real time is used as the real-time image. The real-time image and the reference image are denoised, and the Canny algorithm is used to obtain multiple reference edge lines from the reference image. The Canny algorithm is used to perform edge detection on the real-time image to obtain multiple real-time edge lines. When dust leakage occurs in the workshop, the edges in the real-time image will become blurred. Therefore, when the Canny algorithm is used to perform edge detection on the real-time image, the detected edges will appear discontinuous.
[0039] S2: Calculate the matching coefficient between each real-time edge line and multiple reference edge lines, and further obtain multiple matching coefficients, where the matching coefficients represent the degree of similarity between the real-time edge line and the reference edge line.
[0040] A rectangular coordinate system is constructed in the reference image to obtain the position coordinates of each pixel point in the reference edge line. A rectangular coordinate system is constructed in the real-time image to obtain the position coordinates of each pixel point in the real-time edge line. The distance between each pixel point in the real-time edge line and each pixel point in the reference edge line is calculated based on the position coordinates of the pixel points.
[0041] The expression of the matching coefficient is:
[0042]
[0043] Where r represents the matching coefficient between the real-time edge line and the reference edge line, Indicates the distance between the nth pixel point in the real-time edge line and the k+nth pixel point in the reference edge line. It represents the distance between the mth pixel in the real-time edge line and the k+mth pixel in the reference edge line. m represents the total number of pixels in the real-time edge line, mid represents the median, and the denominator is set to 0.1 to prevent the denominator from being zero.
[0044] The distance sequence between the pixel points on the real-time edge line and the pixel points on the reference edge line is expressed by the median value;
[0045] This represents the average of the differences between the other distance values and this median value, indicating the degree of alignment between the pixels 1 to m on the real-time edge line and the pixels k to k+m on the reference edge line. A larger matching coefficient indicates that the real-time and reference edge lines are located at the same location on the equipment. It should be understood that each real-time edge line in the real-time image and each reference edge line in the reference image has a corresponding matching coefficient.
[0046] S3: Calculate the error coefficient of the matching coefficient. When the error coefficient is greater than a preset error threshold, use the real-time edge line and the reference edge line with the largest matching coefficient as the matching edge line.
[0047] The expression of the error coefficient is:
[0048]
[0049] Where w represents the error coefficient of the matching coefficient between the real-time edge line and multiple reference edge lines, Represents the maximum value among multiple matching coefficients, The error threshold is set manually based on the actual situation. For example, the error threshold is 0.3.
[0050] Because multiple similar edges may exist in the real-time image and the reference image, matching edges individually can result in a high matching error rate, potentially resulting in several edges with similar matching coefficients, meaning that a single real-time edge line is matched to multiple reference edge lines. The error coefficient represents the difference between the largest matching coefficients. A large difference between the maximum and second-largest matching coefficients indicates a good matching result for the corresponding real-time edge line. In this case, the real-time edge line with the largest matching coefficient and the reference edge line are used as the matching edge lines, meaning that the real-time edge line with the largest matching coefficient corresponds to the same edge line at the same location as the reference edge line.
[0051] S4: When the error coefficient of the matching coefficient is less than the preset coefficient threshold, the difference distance and similarity speed between the reference edge line and the real-time edge line are calculated. The similarity speed is negatively correlated with the difference distance. The real-time edge line and the reference edge line with the largest similarity speed are used as the matching edge lines.
[0052] When the error coefficient of the matching coefficient is less than the preset coefficient threshold, it indicates that the matching effect between the real-time edge line and the reference edge line is poor, and further verification of the real-time edge line and the reference edge line with a larger matching coefficient is required.
[0053] For example, the error coefficients of multiple matching coefficients corresponding to the first real-time edge line in the real-time image are less than 0.3, wherein the matching coefficient between the first real-time edge line in the real-time image and the third reference edge line in the reference image is the largest, and the matching coefficient between the first real-time edge line and the fourth reference edge line is the second largest. At this time, it is necessary to calculate the difference distance and similarity speed between the first real-time edge line and the third and fourth reference edge lines respectively.
[0054] The calculation method of the difference distance and similarity speed is as follows: move the real-time edge line to obtain the first auxiliary area; intercept a sub-edge line on the reference edge line, the length of the sub-edge line is the same as the length of the real-time edge line, move the sub-edge line to obtain the second auxiliary area, the first auxiliary area and the second auxiliary area are the same size, calculate the difference in the grayscale value of the pixel at the same position in the first auxiliary area and the second auxiliary area, and further obtain the difference area.
[0055] The expression of difference distance is:
[0056]
[0057] Where, is the difference between the real-time edge line and the reference edge line when the width of the difference area is c, a is the number of columns in the difference area, b is the number of rows in the difference area, is the value of the xth row and yth column in the difference area.
[0058] is the distance from the difference area to the zero point. The smaller the value, the smaller the overall difference in the grayscale values of the two auxiliary areas between the real-time edge line and the reference edge line when the width is c, indicating that the similarity between the first auxiliary area and the second auxiliary area is greater, and the corresponding matching degree between the real-time edge line and the reference edge line is higher.
[0059] The expression for similar speed is:
[0060]
[0061] Where q is the similarity speed when the width of the difference area between the real-time edge line and the reference edge line is c, is the difference distance between the real-time edge line and the reference edge line when the width of the difference area is c, The difference distance between the real-time edge line and the reference edge line when the width of the difference area is 1, is the width of the difference region, and tanh represents the hyperbolic tangent function. is the speed of change of the difference between the difference area with a width of c and the difference area with a width of 1, Used to limit the infinite growth of the difference change rate.
[0062] When there is dust in the air, the real-time edge line is blurred, resulting in the problem that edge pixels cannot be detected during real-time edge line detection. Therefore, the length of the real-time edge line at the same position will be less than or equal to the length of the reference edge line. Based on this background, the following example is given to facilitate understanding of this solution.
[0063] For example, the number of pixels of the first real-time edge line in the real-time image is 5, distributed in the vertical direction, and the number of pixels of the third reference edge line in the reference image is 8, distributed in the vertical direction. At this time, the first real-time edge line is moved 3 pixels on both sides to obtain the first auxiliary area. It can be understood that the value of c is 6 at this time; in the third reference edge line in the reference image, 5 pixels are intercepted starting from the first pixel on the upper side as sub-edge lines, and the third reference edge line is moved 3 pixels on both sides to obtain the second auxiliary area, and the difference area and the similarity speed corresponding to the difference area are further obtained.
[0064] Next, starting from the second pixel on the upper side, five pixels are intercepted as sub-edge lines. The third reference edge line is shifted three pixels to the left and right to obtain a second auxiliary region. The difference region and the corresponding similarity velocity are further obtained. ... Starting from the fourth pixel on the upper side, five pixels are intercepted as sub-edge lines. The third reference edge line is shifted three pixels to the left and right to obtain a second auxiliary region. The difference region and the corresponding similarity velocity are further obtained. Among the multiple similarity velocities obtained, the maximum value is used as the similarity velocity between the first real-time edge line, the third reference edge line, and the real-time edge line.
[0065] Similarly, calculate the similarity velocity between the first real-time edge line and the fourth reference edge line. If the similarity velocity between the first real-time edge line and the fourth reference edge line is greater than the similarity velocity between the first real-time edge line and the third reference edge line, then the first real-time edge line and the fourth reference edge line are used as matching edge lines.
[0066] S5: In the edge line matching, the difference between the grayscale mean values of the real-time edge line pixel points and the reference edge line pixel points is calculated, and the normalized result of the difference is used as a fuzzy evaluation to detect the degree of dust leakage.
[0067] In the matching edge line, the grayscale mean of the real-time edge line pixel points and the grayscale mean of the reference edge line pixel points are calculated, and the difference is calculated based on the two grayscale means. Multiple difference values are further obtained, and the difference values are normalized to evaluate the degree of dust leakage.
[0068] For example, among the multiple differences after normalization, the more differences that are greater than the leakage threshold, the more serious the degree of dust leakage in the workshop. If the number of differences greater than the leakage threshold is 0, it indicates that there is no dust leakage in the workshop. The leakage threshold is set artificially according to the actual situation. For example, the leakage threshold is 0.3.
[0069] 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 dust leakage detection method based on image processing, characterized in that: Including steps: Acquiring a reference image of the device and a real-time image of the device during operation; performing edge detection on the reference image and the real-time image to obtain a plurality of reference edge lines and a plurality of real-time edge lines, respectively; calculating a matching coefficient between each real-time edge line and the plurality of reference edge lines, and further obtaining a plurality of matching coefficients, wherein the matching coefficients represent a degree of similarity between the real-time edge line and the reference edge line; Calculate the error coefficient of the matching coefficient. When the error coefficient is greater than a preset error threshold, use the real-time edge line and the reference edge line with the largest matching coefficient as the matching edge line. In edge line matching, the difference between the grayscale mean of the real-time edge line pixel and the reference edge line pixel is calculated, and the normalized result of the difference is used as a fuzzy evaluation to detect the degree of dust leakage; When the error coefficient of the matching coefficient is less than the preset coefficient threshold, the difference distance and similarity speed between the reference edge line and the real-time edge line are calculated. The similarity speed is negatively correlated with the difference distance. The difference distance represents the difference between the reference edge line and the real-time edge line. The real-time edge line and the reference edge line with the largest similarity speed are taken as the matching edge lines. Moving the real-time edge line to obtain the first auxiliary area; A sub-edge line is intercepted on the reference edge line. The length of the sub-edge line is the same as that of the real-time edge line. The sub-edge line is moved to obtain a second auxiliary area. The first auxiliary area and the second auxiliary area are the same size. The difference in the grayscale value of the pixel at the same position in the first auxiliary area and the second auxiliary area is calculated to further obtain the difference area. The expression of similarity speed is: Where q is the similarity speed when the width of the difference area between the real-time edge line and the reference edge line is c, is the difference distance between the real-time edge line and the reference edge line when the width of the difference area is c, The difference distance between the real-time edge line and the reference edge line when the width of the difference area is 1, is the width of the difference region, and tanh represents the hyperbolic tangent function.
2. The dust leakage detection method based on image processing according to claim 1, characterized in that: The method also includes: mapping the real-time image and the reference image into a coordinate system respectively, further obtaining the position coordinates of each pixel point in the reference edge line and the real-time edge line, and calculating the distance between each pixel point in the real-time edge line and each pixel point in the reference edge line based on the position coordinates of the pixel point.
3. The dust leakage detection method based on image processing according to claim 2, characterized in that: The expression of the matching coefficient is: Where r represents the matching coefficient between the real-time edge line and the reference edge line, represents the distance between the nth pixel in the real-time edge line and the k+nth pixel in the reference edge line, m represents the total number of pixels in the real-time edge line, and mid represents the median. Indicates the distance between the mth pixel in the real-time edge line and the k+mth pixel in the reference edge line.
4. The dust leakage detection method based on image processing according to claim 1, characterized in that: The expression of the error coefficient is: Where w represents the error coefficient of the matching coefficient between the real-time edge line and multiple reference edge lines, Represents the maximum value among multiple matching coefficients, Indicates the second largest value among multiple matching coefficients.
5. The dust leakage detection method based on image processing according to claim 1, characterized in that: The expression of difference distance is: Where, is the difference between the real-time edge line and the reference edge line when the width of the difference area is c, a is the number of columns in the difference area, b is the number of rows in the difference area, is the value of the xth row and yth column in the difference area.
6. The dust leakage detection method based on image processing according to claim 1, characterized in that: The Canny algorithm is used to perform edge detection on the reference image and the real-time image to obtain multiple reference edge lines and multiple real-time edge lines respectively.
7. The dust leakage detection method based on image processing according to claim 1, characterized in that: Before edge detection is performed on the reference image and the real-time image, a step of denoising the reference image and the real-time image is also included.
Citation Information
Patent Citations
Dust concentration intelligent detection method and system
CN119147429A
Adaptive template matching algorithm based on edge detection
CN105704496A
Part installation detection method and device, electronic equipment and storage medium
CN116721047A