Metal sheet detection method, detection system and detection device based on watershed algorithm
Patent Information
- Application Number
- CN202611042845.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-09-25
AI Technical Summary
1、本发明针对金属板表面气孔团粘连严重、边缘模糊等金属板表面缺陷检测难题,创新性地结合质心引导的分水岭算法与距离图优化策略,通过提取极小值标记的质心作为分水岭种子点,并基于像素到质心的最小欧氏距离构建距离图,从而具备高精度地粘连气孔分割能力,有效避免了传统分水岭方法中因简单极小值标记导致的过分割或欠分割难题,实现气孔缺陷位置、几何特征的准确获取,显著提升了对密集、紧密堆叠气孔团的分离准确率。
Smart Images

Figure CN122820657A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of detection technology, specifically relating to a metal plate detection method, detection system and detection device based on the watershed algorithm, which has high detection efficiency and segmentation accuracy, good separation effect of adhesion and pores and strong timeliness. Background Technology
[0002] In the metal processing industry, the conveying and surface quality inspection of metal sheets are core links in ensuring product qualification rates. Among these, the accurate detection of surface porosity defects is a key technical point for screening qualified products. During the metal sheet production process, due to the influence of processes such as smelting and rolling, pores are easily formed on the surface. Multiple pores often stack to form pore clusters, resulting in blurred pore edges and severe adhesion. This not only increases the difficulty of pore counting but also affects the accurate acquisition of the location and geometric characteristics of unqualified pores, thus restricting the reliability of quality grading.
[0003] In existing technologies, the conveying and inspection of metal plates are often separate processes: traditional conveying devices mostly use simple conveyor belt structures, with limited functionality, only capable of material handling, and cannot provide stable and accurate bearing and positioning for inspection operations. This leads to metal plates easily shifting during inspection, affecting image acquisition accuracy. The inspection process mainly relies on manual inspection or single-sensor inspection. Manual inspection is not only inefficient and labor-intensive, but also susceptible to subjective experience, resulting in high rates of missed and false detections. Single sensors, due to their limited detection dimensions, cannot fully capture the subtle features of pores, resulting in insufficient inspection accuracy and failing to meet the high-quality inspection requirements of metal plates. Therefore, there is an urgent need for an integrated device that can effectively coordinate stable conveying and high-precision inspection.
[0004] With the development of machine vision technology, its application in defect detection is gradually increasing. However, specialized research on the detection of porosity defects on metal plate surfaces remains relatively scarce, and the core technological bottleneck mainly lies in the accurate segmentation of adhered porosity clusters. Currently, machine vision methods for segmenting adhered targets can be divided into three categories: The first category is segmentation methods based on contour information. These methods identify and match the concave points of the target contour to separate the adhered targets. They have been applied in scenarios such as segmentation of adhered cells. However, for pore defects with irregular edges and indistinct contour features, the segmentation accuracy is difficult to guarantee, and problems such as incomplete segmentation or over-segmentation are likely to occur.
[0005] The second category is segmentation methods based on active contours. These methods construct an energy function to drive the contour curve to approximate the target boundary, which has a certain segmentation effect on contact targets with uneven intensity. However, the time complexity of the algorithm increases with the number of pores. When the pore density on the metal plate surface is high, the real-time performance cannot meet the requirements of online detection. Although some improved algorithms improve the segmentation boundary contour by coupling overlap penalty and volume conservation constraint, they are only applicable to loosely bonded targets and have poor separation effect on tightly stacked pore clusters. There is also a segmentation method based on the combination of Chan-Vase model and Sobel operator, which performs well in the segmentation of specific targets such as cucumber leaves. However, due to insufficient generalization ability, it is easily affected by surface texture, reflection and other interference when applied to the segmentation of metal plate pores, resulting in a significant decrease in segmentation accuracy.
[0006] The third category is segmentation methods based on the watershed algorithm. Due to its simple principle and advantage in segmenting adhered targets, this type of method has been tried in some defect detection scenarios, such as using a fixed threshold to determine the aphid region in a single channel and using a new threshold to segment milk cells. However, due to the complex surface background of the metal plate (with reflections, texture interference, and diverse defect morphologies), global threshold segmentation is difficult to accurately define the pore boundaries, resulting in poor segmentation results. Another study has combined generative adversarial networks with the watershed algorithm to improve the segmentation. Although it can achieve good segmentation of targets such as red blood cells, it requires a large amount of labeled data and long training time, resulting in high engineering application costs and long cycles, making it unsuitable for the real-time detection needs of metal plate production sites. There are also segmentation methods based on morphological reconstruction and Gaussian mixture models, which have a certain robustness to noisy images. However, when faced with highly overlapping pore clusters, there are still problems such as incomplete separation of overlapping parts and blurred boundaries, which cannot meet the needs of accurate quantification of pore defects.
[0007] Furthermore, in existing watershed-related defect detection technologies, some schemes use morphological operations (such as expansion and filling) to assist in defect extraction (such as CN111931647B and CN117314925B), but they do not optimize the preprocessing process for the characteristics of pores and lack targeted grayscale enhancement strategies to improve the contrast between pores and the background. At the same time, in the marker-guided watershed segmentation stage, conventional methods often use simple minimum value markers, which are prone to oversegmentation or undersegmentation problems, and do not combine centroid calculation and distance map to optimize the segmentation logic, making it difficult to accurately separate densely connected pore clusters.
[0008] Furthermore, existing metal defect detection devices primarily focus on a single detection function, failing to achieve a synergistic design of stable conveying and high-precision porosity detection, thus failing to meet the demands of continuous industrial production. Therefore, developing a metal plate detection technology that combines stable conveying with high-precision adhesion porosity segmentation capabilities is crucial for addressing current industry pain points. Summary of the Invention
[0009] To address the shortcomings of existing technologies, this invention proposes a metal plate detection method based on the watershed algorithm, which features high detection efficiency and segmentation accuracy, good separation of adhesion pores, and strong timeliness. It also provides a metal plate detection system based on the watershed algorithm and a metal plate detection device based on the watershed algorithm.
[0010] The metal plate detection method based on the watershed algorithm of this invention is implemented as follows: it includes image acquisition, pore region extraction, image processing, overlapping part separation, and quality detection steps, specifically as follows: A. Image Acquisition: Acquire images of the surface of the metal plate; B. Stomatal region extraction: The surface image is sequentially processed through binarization, connected component filtering, and morphological operations to extract the pore region from the surface image. C. Image processing: The watershed segmentation method is used to process the images of the adhesion points in the extracted pore areas; D. Separation of overlapping parts: Separate the overlapping parts of the segmented regions after image processing to obtain an image of the metal plate surface including the pore region; E. Quality Inspection: Based on the surface image of the metal plate obtained in step D, determine the surface quality of the metal plate.
[0011] Furthermore, step B is preceded by an image preprocessing step. This image preprocessing step involves applying a piecewise transformation to the acquired surface image to enhance the grayscale range, resulting in an image with higher contrast that includes pores. The formula for the piecewise transformation is: , In the formula: L ( i , j )and L' ( i , j () represent the first and second parts of the surface image before and after piecewise transformation. i Line number j The grayscale values of the column pixels, a, b, c, d, e, and f are all stretching interval parameter values of the piecewise transformation of the surface image.
[0012] Furthermore, in step B, after the surface image is binarized, the specific process of extracting the pore region from the surface image using connected component filtering and morphological operations is as follows: B10. Area Filtering: The connected component area selection method is used to select all pore connected components with an area greater than the threshold after binarization of the surface image. B20, Edge Connection: Morphological dilation of the surface image after area screening is performed using 3×3 structuring elements to connect the edges of broken pores; B30, Hole Filling: Morphological reconstruction is used to fill the closed hole areas in the surface image after edge connection, resulting in a surface image containing pore areas.
[0013] Furthermore, step C includes centroid extraction and distance transformation sub-steps; C10. Centroid Extraction: Subtract the image after hole filling from the image before hole filling to obtain the original minimum value marker image. Treat each original minimum value marker as a connected region, calculate the nth order central moment for each pixel in the original minimum value marker, and then calculate the centroid from the central moment to obtain the centroid marker. C20. Distance Transformation: Calculate the minimum distance from each pixel in the foreground region to the centroid marker in the foreground region, and then use the watershed algorithm to process the image based on the aforementioned minimum distance to obtain the image after distance transformation, including the adhesion points in the pore region.
[0014] Furthermore, the formula for calculating the nth-order central moment of each pixel in the original minimum value marker in the C10 sub-step is as follows: , , , , , , In the formula: M pq Let be the (p+q)th order central moment of the surface image, used to describe the level of detail in the image; V ( i , j ) represents the first local minimum value in the connected component. i Line number j Column pixels; M 00 It represents the zeroth moment of the image, which is the sum of all pixel values; M 10 The sum of the x-coordinates of all pixels within the connected region of the original minimum value is given. M 01 The sum of the ordinates of all pixels within the connected region of the original minimum value is given by ( x c , y c (x) represents the extracted centroid coordinates. p This indicates a weighted average on the x-coordinate, and the y-coordinate is... p This indicates that the y-coordinate is weighted. f ( x , y ) is in coordinates (x , y The pixel grayscale value at position () is where n is the total number of rows in the image and m is the total number of columns in the image.
[0015] Further, in step C20, calculating the minimum distance from each pixel within the foreground region to the centroid marker within the foreground region involves setting A and B to the set of pixel coordinates and the set of centroid coordinates within the foreground region, respectively. The distance map calculation formula is then: , , In the formula: p and c These are points within sets A and B, respectively. d ( p , c )for p and c Euclidean distance between points; Δ( p , A The result of the internal distance transformation is the minimum distance. x p Let x be the x-coordinate of a point within set A. x c Let x be the x-coordinate of a point within set B. y p Let be the ordinate of a point within set A. y c Let be the ordinate of a point within set B.
[0016] Furthermore, in the C20 sub-step, image processing is performed using the watershed algorithm based on the aforementioned minimum distance. Let S be the set of N extracted centroid markers {S=S i (i∈[1,…,N])}, M is the set of connected components of the input stomata {M=M j (j∈[1,…,K])}, then the specifics are as follows: C21. Read the image containing the stomata region; C22. Extract the set of connected components of the stomatal region M'={M j | j∈[1,…,k]} and the set of centroid labels S'={S i | i∈[1,…,n]}; C23. Extract the j-th connected component from set M'; C24. Select the current stomatal connectivity region M from set S'. j Mark G centroids in the sample set C and construct a sample set C. j ={C j (i), i=1,…,G}; C25. If G = Ø, then proceed to step C26; otherwise, proceed to step C27; where Ø is the empty set. C26, Connect the stomata to region M j Add the centroid to set C j Then proceed to step C25; C27. Calculate the current stomatal connectivity M. j Each pixel in set C j Δ(p, A) is used to obtain the distance map H; C28. Calculate j = j + 1 and go to step C23 until j > k; C29. The watershed algorithm is used to process the distance map H, denoted as R, i.e.: R = cv 2. watershed ( H In the formula: cv 2. watershed This represents a function call to the watershed image segmentation algorithm in the OpenCV library. After execution, it returns a label matrix R of the same size as the original image, where different values represent different segmented regions.
[0017] The metal plate detection system based on the watershed algorithm of this invention is implemented as follows: it includes a pore region extraction module, an image processing module, an overlapping part separation module, and a quality detection module. The image acquisition module is used to acquire surface images of the metal plate; The pore region extraction module is used to extract the pore region from the surface image by sequentially performing binarization, connected component filtering and morphological operations on the surface image. In this process, after the surface image is processed by the binarization unit, the connected component filtering unit and morphological operation unit in the module are used to extract the pore region in the surface image. The connected component filtering unit is used to select all pore connected components with an area greater than a threshold by using a connected component area selection method on the binarized surface image. The morphological operation unit is used to perform morphological dilation on the surface image after area screening using a 3×3 structuring element to connect the edges of the broken pores, and then use morphological reconstruction to fill the closed hole region in the surface image after edge connection to obtain a surface image containing the pore region. The image processing module is used to perform image processing on the adhesion points of the extracted pore regions using the watershed segmentation method; The image processing module includes a centroid extraction unit and a distance transformation unit. The centroid extraction unit is used to obtain the original minimum value marker image by subtracting the image after hole filling from the image before hole filling, and to treat each original minimum value marker as a connected region. The nth-order central moment is calculated for each pixel in the original minimum value marker, and the centroid is calculated from the central moment, thus obtaining the centroid marker. The distance transformation unit is used to calculate the minimum distance from each pixel in the foreground region to the centroid marker in the foreground region, and then perform image processing based on the aforementioned minimum distance using the watershed algorithm to obtain an image after distance transformation, including the adhesion points in the pore region. The overlapping part separation module is used to separate the overlapping parts of the segmented regions after image processing to obtain a metal plate surface image including the pore region. The quality inspection module is used to determine the surface quality of the metal plate based on the metal plate surface image obtained by the overlapping part separation module.
[0018] The metal plate detection device based on the watershed algorithm of the present invention is implemented as follows: it includes a main frame, on which a conveying mechanism for conveying metal plates is provided, and detection mechanisms are respectively provided on both sides of the main frame along the conveying direction of the metal plates, and also includes a control system. The conveying mechanism includes a conveyor frame, a conveyor roller assembly, and a drive assembly. The conveyor frame is a portal or gantry-type structural frame. The conveyor roller assembly includes a drive sprocket, a driven sprocket, a transmission chain, and a clapper carrier. The drive sprocket and driven sprocket are respectively located at both ends of the conveyor frame. The transmission chain is sleeved on the drive sprocket and driven sprocket. Multiple clapper carriers for clamping metal plates are hinged at intervals on the transmission chain. The drive assembly includes a motor and a reducer. The motor is fixed at one end of the conveyor frame where the drive sprocket is located, and the motor shaft is connected to the input shaft of the reducer. The output shaft of the reducer is connected to the drive sprocket. The motor is electrically connected to the control system. The detection mechanism includes a sub-frame, an industrial camera, and a light source. The sub-frame is fixedly installed on one side of the main frame along the metal plate conveying direction. The industrial camera and the light source are respectively installed on the sub-frame and respectively connected to the control system signal. The control system stores a computer program, which, when executed by a processor, implements the aforementioned metal plate detection method based on the watershed algorithm.
[0019] Furthermore, the output shaft of the reducer is connected to a drive pulley, the drive sprocket is coaxially fixed with a driven pulley, and a belt is sleeved between the drive pulley and the driven pulley; the end of the clapper carrier away from the transmission chain is provided with a slot in the shape of an inverted trapezoid that clamps a metal plate, and the surface of the slot is covered with a rubber layer.
[0020] The beneficial effects of this invention are: 1. This invention addresses the challenge of detecting surface defects in metal plates, such as severely adhered pore clusters and blurred edges. It innovatively combines a centroid-guided watershed algorithm with a distance map optimization strategy. By extracting the centroid marked with a minimum value as the seed point for the watershed, and constructing a distance map based on the minimum Euclidean distance from the pixel to the centroid, it achieves high-precision segmentation of adhered pores. This effectively avoids the over-segmentation or under-segmentation problems caused by simple minimum value marking in traditional watershed methods, and achieves accurate acquisition of the location and geometric features of pore defects, significantly improving the separation accuracy of densely packed pore clusters.
[0021] 2. This invention introduces segmented grayscale transformation to preprocess the original image. By precisely stretching the grayscale range where the pores are located, the contrast between the pore area and the complex background (such as reflection and texture) is greatly improved, laying a high-quality foundation for subsequent binarization and defect extraction. This overcomes the problem of segmentation failure caused by poor image quality in the prior art.
[0022] 3. This invention employs a multi-stage processing flow of "binarization → area screening → morphological expansion to connect broken edges → morphological reconstruction to fill pores" to effectively eliminate noise interference and repair broken pore contours. This enables the effective extraction of pore regions, ensuring the integrity and accuracy of subsequent segmentation objects and making the pore region extraction process highly robust.
[0023] 4. The algorithm design of this invention focuses on online detection needs. By improving the centroid extraction and distance map calculation methods and combining them with the improved watershed, it avoids relying on methods such as deep learning that require a large amount of labeled data and long training time. Thus, while ensuring segmentation accuracy, it can also meet the requirements of timeliness and low deployment cost in industrial sites, achieving a balance between real-time performance and engineering applicability.
[0024] 5. The present invention provides a matching detection device, which integrates a highly stable conveying mechanism (including an inverted trapezoidal clapper carrier with a rubber layer) and a high-precision visual inspection system (industrial camera + dedicated light source) to realize continuous conveying and synchronous image acquisition of metal plates in a state of no offset and no vibration, thus solving the problems of inaccurate positioning and blurred images caused by the separation of traditional conveying and inspection.
[0025] 6. The detection device of the present invention has a complete algorithm flow of the detection method embedded in the control system, realizing fully automatic closed-loop detection from image acquisition, defect segmentation to quality judgment, which greatly improves detection efficiency and significantly reduces manual intervention, thus making it suitable for industrial continuous production lines.
[0026] In summary, this invention, through integrated transport-detection collaborative design and improved watershed image segmentation technology, effectively overcomes the bottlenecks of existing technologies in areas such as accurate segmentation of adherent pores, suppression of complex background interference, and insufficient detection-transportation collaboration. It achieves high accuracy, high efficiency, and high stability in online detection of pore defects on metal plate surfaces, demonstrating significant technological advancements and industrial application value. Attached Figure Description
[0027] Figure 1 This is a flowchart of the metal plate detection method based on the watershed algorithm of the present invention; In the diagram: S100 - Image acquisition, S200 - Preprocessing, S300 - Stomatal region extraction, S400 - Image processing, S500 - Separation of overlapping parts, S600 - Quality inspection; Figure 2 This is a schematic diagram of the metal plate detection device based on the watershed algorithm of the present invention; In the diagram: 1-Main frame, 2-Conveying mechanism, 21-Conveying frame, 22-Conveying roller group, 221-Drive chain, 222-Platform carrier, 223-Belt cover, 23-Drive assembly, 231-Motor, 232-Reducer, 3-Detection mechanism, 31-Sub-frame, 32-Industrial camera, 33-Light source, 4-Metal plate; Figure 3 This is a comparison of the algorithmic distance maps of the ideal pore images of adhesion in the embodiments of the present invention; In the figure: 3a - traditional distance image, 3b - distance image of the detection method of the present invention; Figure 4 This is the separation result of the ideal overlapping pore image in the embodiment of the present invention; In the figure: 4a - traditional segmentation result image, 3b - segmentation result image of the detection method of the present invention; Figure 5 This is a schematic diagram of the error in an embodiment of the present invention; Figure 6 These are comparison images of the processing results of different algorithms in the embodiments of the present invention; In the figure: 6a - original image, 6b - gradient watershed processing result image, 6c - marker control watershed processing result image, 6d - traditional distance watershed processing result image, 6e - processing result image of the detection method of this invention. Detailed Implementation
[0028] The present invention will be further described below with reference to the accompanying drawings and embodiments, but this does not limit the present invention in any way. Any changes or improvements made based on the teachings of the present invention shall fall within the protection scope of the present invention.
[0029] like Figure 1As shown, the metal plate detection method based on the watershed algorithm of this invention includes image acquisition, pore region extraction, image processing, overlapping part separation, and quality detection steps. The specific steps are as follows: A. Image Acquisition: Acquire images of the surface of the metal plate; B. Stomatal region extraction: The surface image is sequentially processed through binarization, connected component filtering, and morphological operations to extract the pore region from the surface image. C. Image processing: The watershed segmentation method is used to process the images of the adhesion points in the extracted pore areas; D. Separation of overlapping parts: Separate the overlapping parts of the segmented regions after image processing to obtain an image of the metal plate surface including the pore region; E. Quality Inspection: Based on the surface image of the metal plate obtained in step D, determine the surface quality of the metal plate.
[0030] It should be noted that the watershed algorithm is a method commonly used to segment contiguous images. Its basic principle is to equate the grayscale image with undulating mountains, where local minima and their neighborhoods are imagined as water basins. The grayscale value of each pixel in the image represents the altitude of that point. The formation of the watershed is based on the process of water inundation. Water is poured in starting from the local minima in the image region, and the water level gradually rises and submerges the water basins. A dam is built between two adjacent basins, and this dam is the watershed.
[0031] The step B is preceded by an image preprocessing step, which involves applying a piecewise transformation to the acquired surface image to enhance the grayscale range, resulting in an image with higher contrast that includes pores. The formula for the piecewise transformation is: , In the formula: L ( i , j )and L' ( i , j () represent the first and second parts of the surface image before and after piecewise transformation. i Line number j The gray values of the column pixels, a, b, c, d, e, and f are all stretching interval parameter values of the piecewise transformation of the surface image (the determination of the parameter values can be found in: Li Xiaobing. An adaptive piecewise linear gray-scale transformation method for infrared measurement images [J]. Optoelectronics Technology, 2011, 31 (4):236-239).
[0032] It should be noted that the image preprocessing step uses piecewise transformation to distribute the grayscale range where the pores are located over a wider range of grayscale values. This enhances the grayscale range where the pores are located while reducing the contrast of darker or brighter grayscale ranges in areas of less interest in the surface image, thus obtaining a pore image with higher contrast.
[0033] In step B, after the surface image is binarized, the specific process of extracting the pore region from the surface image using connected component filtering and morphological operations is as follows: B10. Area Filtering: Due to interference from small connected components introduced by adaptive binarization in areas other than stomata, the connected component area selection method is adopted for the surface image after binarization (see Jia Wenhang. Non-cooperative satellite image segmentation based on YOLO [J]. China New Technologies & New Products, 2024 (8):16-18.), retaining all stomata connected components with an area greater than the threshold (the threshold is determined according to user requirements, and unqualified stomata areas need to be filtered out, while qualified stomata areas are excluded). B20. Edge Connection: To form closed edges for pores in the connected binary graph, a 3×3 structuring element is used to morphologically dilate the surface image after area filtering to connect the broken edges of the pores, thus preserving more edge information and smoothing the pore edges (see Lei Tao, Li Yuntong, Zhou Wenzheng, et al. Data and Model Jointly Driven Grain Segmentation of Ceramic Materials [J]. Acta Automatica Sinica, 2022, 48 (4): 1137-1152.). B30. Pore Filling: Due to the presence of bright areas within the pore region, pores are generated within the connected domain after threshold segmentation. Morphological reconstruction is used to fill the closed pore regions in the surface image after edge connection (see Liu Xiaoyan, Wu Xin, Sun Wei, et al. Image segmentation of pellets based on morphological reconstruction and GMM [J]. Journal of Instrumentation, 2019, 40 (3):230-238.), resulting in a surface image containing the pore region.
[0034] It should be noted that, based on the brightness, contrast, texture, and other features of local image regions, different thresholds are dynamically calculated and assigned to each pixel or small neighborhood, thereby solving segmentation problems that fixed thresholds cannot handle, such as uneven lighting, complex backgrounds, and local shadows. The thresholds are determined without manual setting, based on the local window containing the pixel: first, the mean, median, and Gaussian weighted mean of the pixels within the window are calculated; then, a constant compensation value is subtracted from these statistics to obtain the local adaptive threshold for the current location. Each pixel is compared with its corresponding local threshold; if it is greater, it is classified as foreground; if less, it is classified as background, ultimately achieving adaptive binarization of the image.
[0035] Step C includes centroid extraction and distance transformation sub-steps; C10. Centroid Extraction: Subtract the image after hole filling from the image before hole filling to obtain the original minimum value marker image. Treat each original minimum value marker as a connected region, calculate the nth order central moment for each pixel in the original minimum value marker, and then calculate the centroid from the central moment to obtain the centroid marker. C20. Distance Transformation: Calculate the minimum distance from each pixel in the foreground region (i.e., the pore region to be segmented) to the centroid marker in the foreground region. Then, based on the aforementioned minimum distance, use the watershed algorithm to perform image processing to obtain an image with distance transformation, including the adhesion points of the pore region.
[0036] It should be noted that in the field of image segmentation, the foreground region refers to the target region that the algorithm needs to identify, extract, and segment, i.e., the region of interest. In the C10 segmentation step, the foreground region refers to the pore region to be segmented.
[0037] It should be noted that the original minimum value marker is the image obtained by subtracting the image before and after the hole is filled. Essentially, it is the pixel area that was "filled in", that is, the image that only contains the hole, i.e., the original minimum value marker image. Each marker is composed of multiple pixels.
[0038] Minimum marker: Calculate the nth order central moment of the original minimum marker, and then calculate the centroid from the central moment to obtain the minimum marker. Each minimum marker has only one pixel.
[0039] Each local minimum marker is calculated from the original local minimum marker.
[0040] The formula for calculating the nth-order central moment of each pixel in the original minimum value marker in the C10 sub-step is as follows: , , , , , , In the formula: M pq Let be the (p+q)th order central moment of the surface image, used to describe the level of detail in the image; V ( i , j ) represents the first local minimum value in the connected component. i Line 1 j Column pixels; M 00 It represents the zeroth moment of the image, which is the sum of all pixel values; M 10The sum of the x-coordinates of all pixels within the connected region of the original minimum value is given. M 01 The sum of the ordinates of all pixels within the connected region of the original minimum value is given by ( x c , y c (x) represents the extracted centroid coordinates. p This indicates a weighted average on the x-coordinate, and the y-coordinate is... p This indicates that the y-coordinate is weighted. f ( x , y ) is in coordinates ( x , y The pixel grayscale value at position () is where n is the total number of rows in the image and m is the total number of columns in the image.
[0041] In step C20, the minimum distance from each pixel within the foreground region to the centroid marker within the foreground region is calculated. At this point, the pixel values outside the region are all 0. Let A and B be the set of pixel coordinates in the foreground region and the set of centroid coordinates within the foreground region, respectively. Then, the distance map calculation formula is: , , In the formula: p and c These are points within sets A and B, respectively. d ( p , c )for p and c Euclidean distance between points; Δ( p , A The result of the internal distance transformation (see Zhang Wenfei, Han Jianhai, Guo Bingjing, et al. Application of the improved watershed algorithm in the segmentation of adherent images [J]. Computer Applications and Software, 2021, 38 (06):243-248.), is the minimum distance; x p Let x be the x-coordinate of a point within set A. x c Let x be the x-coordinate of a point within set B. y p Let be the ordinate of a point within set A. y c Let be the ordinate of a point within set B.
[0042] In the C20 sub-step, image processing is performed using the watershed algorithm based on the aforementioned minimum distance. Let S be the set of N extracted centroid markers {S=S...} i (i∈[1,…,N])}, M is the set of connected components of the input stomata {M=M j(j∈[1,…,K])}, then the specifics are as follows: C21. Read the image containing the stomata region; C22. Extract the set of connected components of the stomatal region M'={M j | j∈[1,…,k]} and the set of centroid labels S'={S i | i∈[1,…,n]}; C23. Extract the j-th connected component from set M'; C24. Select the current stomatal connectivity region M from set S'. j Mark G centroids in the sample set C and construct a sample set C. j ={C j (i), i=1,…,G}; C25. If G = Ø, then proceed to step C26; otherwise, proceed to step C27; where Ø is the empty set. C26, Connect the stomata to region M j Add the centroid to set C j Then proceed to step C25; C27. Calculate the current stomatal connectivity M. j Each pixel in set C j Δ(p, A) is used to obtain the distance map H; C28. Calculate j = j + 1 and go to step C23 until j > k; C29. The watershed algorithm is used to process the distance map H, denoted as R, i.e.: R = cv 2. watershed ( H In the formula: cv 2. watershed This represents a function call to the watershed image segmentation algorithm in the OpenCV library. After execution, it returns a label matrix R of the same size as the original image, where different values represent different segmented regions.
[0043] In the C20 sub-step, K is the total number of theoretical / preset connected regions of the pore region (i.e., the total number of pore connected regions initially defined by the algorithm), k is the actual number of pore connected regions extracted (i.e., the effective number after actual image reading and processing), N is the total number of theoretical / preset centroid markers (i.e., the total number of centroid markers initially defined by the algorithm), and n is the actual number of centroid markers extracted (the effective number after actual image reading and processing); where n≤N, k≤K (i.e., the actual number extracted will not exceed the theoretically preset total).
[0044] In step D, the overlapping portions of the segmented regions after image processing are separated, as follows: D10, Terrain Modeling: Map the gray values of image pixels in the segmented regions after image processing to altitude, forming areas with low gray values as "valleys" and areas with high gray values as "peaks". D20, Water Injection Process: The pixel grayscale values are mapped to segmented regions of altitude. Water is "injected" starting from each local minimum (i.e., the lowest point of the valley), and the water level rises gradually with altitude.
[0045] D30. Dam Construction and Division: When the water flow from different catchment basins in the division area comes into contact with different marked or uncertain areas, it stops spreading and a "dam" is built at the confluence line. The line connecting the dams is the division boundary (watershed). The remaining areas are classified according to the markings to complete the target division.
[0046] This invention relates to a metal plate detection system based on the watershed algorithm, comprising a pore region extraction module, an image processing module, an overlapping region separation module, and a quality detection module. The image acquisition module is used to acquire surface images of the metal plate; The pore region extraction module is used to extract the pore region from the surface image by sequentially performing binarization, connected component filtering and morphological operations on the surface image. In this process, after the surface image is processed by the binarization unit, the connected component filtering unit and morphological operation unit in the module are used to extract the pore region in the surface image. The connected component filtering unit is used to select all pore connected components with an area greater than a threshold by using a connected component area selection method on the binarized surface image. The morphological operation unit is used to perform morphological dilation on the surface image after area screening using a 3×3 structuring element to connect the edges of the broken pores, and then use morphological reconstruction to fill the closed hole region in the surface image after edge connection to obtain a surface image containing the pore region. The image processing module is used to perform image processing on the adhesion points of the extracted pore regions using the watershed segmentation method; The image processing module includes a centroid extraction unit and a distance transformation unit. The centroid extraction unit is used to obtain the original minimum value marker image by subtracting the image after hole filling from the image before hole filling, and to treat each original minimum value marker as a connected region. The nth-order central moment is calculated for each pixel in the original minimum value marker, and the centroid is calculated from the central moment, thus obtaining the centroid marker. The distance transformation unit is used to calculate the minimum distance from each pixel in the foreground region to the centroid marker in the foreground region, and then perform image processing based on the aforementioned minimum distance using the watershed algorithm to obtain an image after distance transformation, including the adhesion points in the pore region. The overlapping part separation module is used to separate the overlapping parts of the segmented regions after image processing to obtain a metal plate surface image including the pore region. The quality inspection module is used to determine the surface quality of the metal plate based on the metal plate surface image obtained by the overlapping part separation module.
[0047] like Figure 2 As shown, the metal plate detection device based on the watershed algorithm of the present invention includes a main frame 1, a conveying mechanism 2 for conveying metal plates 4 is provided on the main frame 1, detection mechanisms 3 are respectively provided on both sides of the main frame 1 along the conveying direction of the metal plates 4, and a control system is also included. The conveying mechanism 2 includes a conveying frame 21, a conveying roller assembly 22, and a drive assembly 23. The conveying frame 21 is a portal or gantry-type structural frame. The conveying roller assembly 22 includes a drive sprocket, a driven sprocket, a transmission chain 221, and a clapper carrier 222. The drive sprocket and the driven sprocket are respectively located at both ends of the conveying frame 21. The transmission chain 221 is sleeved on the drive sprocket and the driven sprocket. Multiple clapper carriers 222 for clamping metal plates 4 are hinged at intervals on the transmission chain 221. The drive assembly 23 includes a motor 231 and a reducer 232. The motor 231 is fixed at one end of the conveying frame 21 where the drive sprocket is located, and the motor shaft is connected to the input shaft of the reducer 232. The output shaft of the reducer 232 is connected to the drive sprocket. The motor 231 is electrically connected to the control system. The detection mechanism 3 includes a sub-frame 31, an industrial camera 32, a light source 33, and a control system. The sub-frame 31 is fixedly installed on one side of the main frame 1 along the conveying direction of the metal plate 4. The industrial camera 32 and the light source 33 are respectively installed on the sub-frame 31 and are respectively connected to the control system. The control system stores a computer program, which, when executed by a processor, implements the aforementioned metal plate detection method based on the watershed algorithm.
[0048] The output shaft of the reducer 232 is connected to a drive pulley, and a driven pulley is coaxially fixed to the drive sprocket. A belt is fitted between the drive pulley and the driven pulley. The end of the pallet carrier 222 away from the transmission chain 221 is provided with an inverted trapezoidal slot for clamping the metal plate 4. The surface of the slot is covered with a rubber layer. The rubber layer increases the friction between the slot and the metal plate 4, preventing the metal plate 4 from sliding or shifting during transport.
[0049] The light source 33 is preferably a ring light source of model MV-HLH70R / G / B / W / 90, the industrial camera 32 is preferably model MV-GEF1205GC, and the lens of the industrial camera 32 is preferably model MV-LD-16-5M-F.
[0050] Example
[0051] The experimental hardware platform consisted of an i5-10400 processor and 16GB of RAM. The implementation used OpenCV-Python and a Windows system environment. To verify the effectiveness of the algorithm, ideal and real stomatal images were used to test the separation accuracy and segmentation rate of overlapping stomatal areas. Figure 1 The experimental procedure is as follows: S100: Adopted Figure 2 The metal plate detection device based on the watershed algorithm shown acquires images of the surface of the metal plate 4 suspended by the plate carrier 222.
[0052] S200: The acquired surface image is subjected to piecewise transformation to distribute the grayscale range where the pores are located over a wider range of grayscale values. This enhances the grayscale range where the pores are located while reducing the contrast of darker or brighter grayscale ranges in areas of less interest in the surface image, resulting in an image containing the pores with higher contrast. The formula for the piecewise transformation is: , In the formula: L(i, j) and L'(i, j) are the gray values of the i-th row and j-th column pixels before and after the piecewise transformation of the surface image, respectively, and a, b, c, d, e, and f are the stretching interval parameter values of the piecewise transformation of the surface image.
[0053] S300: The surface image is sequentially processed through binarization, connected component filtering, and morphological operations to extract the pore regions. The specific process is as follows: S310: Adaptive binarization processing is performed on the surface image.
[0054] S320: Due to the interference of small connected regions introduced by adaptive binarization processing in areas other than pores, a connected region area selection method is used for the surface image after binarization to retain the pore connected regions in areas other than pores that are higher than a set threshold.
[0055] S330: In order to form closed edges of pores in the connected binary graph, a 3×3 structuring element is used to perform morphological dilation on the surface image after area filtering to connect the broken edges of the pores, so as to retain more edge information of the pores and smooth the pore edges. S340: Since there are bright areas inside the pore region, holes are generated inside the connected domain after threshold segmentation. Morphological reconstruction is used to fill the closed hole regions in the surface image after edge connection, and a surface image containing the pore region is obtained.
[0056] S400: Watershed segmentation is used for image processing at the adhesion points of the extracted stomata. This specifically includes centroid extraction and distance transformation steps. S410, Centroid Extraction: The original minimum value marker image is obtained by subtracting the image after hole filling from the image before hole filling. Each original minimum value marker is treated as a connected region. The nth-order central moment is calculated for each pixel in the original minimum value marker, and the centroid is then calculated from the central moments, thus obtaining the centroid marker. The specific calculation formula is as follows: , , , , , , In the formula: M pq Let be the (p+q)th order central moment of the surface image, used to describe the level of detail in the image; V ( i , j ) represents the first local minimum value in the connected component. i Line number j Column pixels; M 00 It represents the zeroth moment of the image, which is the sum of all pixel values; M 10 The sum of the x-coordinates of all pixels within the connected region of the original minimum value is given. M 01 The sum of the ordinates of all pixels within the connected region of the original minimum value is given by ( x c , y c (x) represents the extracted centroid coordinates. p This indicates a weighted average on the x-coordinate, and the y-coordinate is... p This indicates that the y-coordinate is weighted. f ( x , y ) is in coordinates ( x , y The pixel grayscale value at position () is where n is the total number of rows in the image and m is the total number of columns in the image.
[0057] S420, Distance Transformation: Calculate the minimum distance from each pixel in the foreground region to the centroid marker in the foreground region, and then use the watershed algorithm to process the image based on the aforementioned minimum distance to obtain the image after distance transformation, including the adhesion points in the pore region.
[0058] The calculation involves finding the minimum distance from each pixel within the foreground region to the centroid marker within that region, where all pixel values outside the region are 0. Let A and B be the set of pixel coordinates in the foreground region and the set of centroid coordinates within that region, respectively. The distance map calculation formula is then: , , In the formula: p and c These are points within sets A and B, respectively. d ( p , c )for p and c Euclidean distance between points; Δ( p , A The result of the internal distance transformation is the minimum distance. x p Let x be the x-coordinate of a point within set A. x c Let x be the x-coordinate of a point within set B. y p Let be the ordinate of a point within set A. y c Let be the ordinate of a point within set B.
[0059] Among them, the watershed algorithm for image processing based on the aforementioned minimum distance is defined as follows: Let S be the set of N extracted centroid markers {S=S i (i∈[1,…,N])}, M is the set of connected components of the input stomata {M=M j (j∈[1,…,K])}, then the specifics are as follows: S421: Read the image containing the pore region; S422, Extract the set of connected components of the stomatal region M'={M j | j∈[1,…,k]} and the set of centroid labels S'={S i | i∈[1,…,n]}; S423. Extract the j-th connected component from set M'; S424. Select the current stomatal connectivity region M from set S'. j Mark G centroids in the sample set C and construct a sample set C. j ={C j (i), i=1,…,G}; S425. If G = Ø, then proceed to step S426; otherwise, proceed to step S427; where Ø is the empty set. S426, Connect the pores to region M j Add the centroid to set C jThen proceed to step S425; S427. Calculate the current stomatal connectivity M. j Each pixel in set C j Δ(p, A) is used to obtain the distance map H; S428. Calculate j = j + 1 and go to step S423 until j > k; S429. The watershed algorithm is used to process the distance map H, denoted as R, that is: R = cv 2. watershed ( H In the formula: cv 2. watershed This represents a function call to the watershed image segmentation algorithm in the OpenCV library. After execution, it returns a label matrix R of the same size as the original image, where different values represent different segmented regions.
[0060] S500: Separate the overlapping parts of the segmented regions after image processing to obtain the surface image of the metal plate 4, including the pore region.
[0061] S600: Based on the surface image of the metal plate 4 obtained in S500, determine the surface quality of the metal plate 4 using existing technology or according to a preset surface quality grading table.
[0062] (1) Experimental results of ideal stomatal images Adhesive ideal pore images are used to compare the impact of different distance maps on the separation accuracy of overlapping pore images, such as Figure 3 and Figure 4 As shown, traditional distance images generate lines connecting minimum values, resulting in segmentation effects with offset edges. However, the distance image calculated by the detection method of this invention does not form connecting lines between two points, resulting in better segmentation between adhering pores.
[0063] To quantify the accuracy of the algorithm for the ideal pore segmentation line, this embodiment calculates the separation error of the segmentation line between two adhered pores; the separation error is defined as follows: Figure 5 The area enclosed by the shaded region represents the error between the theoretical and actual dividing lines. The number of pixels in the shaded region is proportional to the dividing error. θ represents the angle between the centroid marker line and the horizontal line.
[0064] After observing a large number of pores, it was found that the distance between adjacent centroid markers within the adhered pores was approximately 4. Therefore, Table 1 shows the number of pixels in the shaded area corresponding to different yc / xc values when the distance is 4 (Note: θ = arctan( y c / x c As shown in Table 1, the segmentation error of the detection method of the present invention is better than that obtained by traditional distance images.
[0065] Table 1
[0066] (2) Experimental results of real stomatal images To verify the effectiveness of the detection method proposed in this invention, images of pores on the surface of a real metal plate were selected. Figure 6 a) Conduct overlapping stomatal segmentation experiments, and test results for different segmentation methods are provided by... Figure 6 As shown.
[0067] Depend on Figure 6 It can be seen that, as Figure 6 In the image shown in b, which employs the gradient watershed algorithm, the good response to changes in image intensity leads to significant oversegmentation; for example... Figure 6 As shown in image c, the marker-controlled watershed algorithm eliminates most spurious minima and improves oversegmentation. However, it causes undersegmentation for pores with high adhesion, missegmenting multiple adhered pores into single pores. Figure 6 As shown in d, the traditional distance watershed algorithm improves undersegmentation and oversegmentation in the image, but the segmentation lines between adhering pores are shifted; for example... Figure 6 As shown in e, the oversegmentation and undersegmentation phenomena in the image detected by the present invention are improved, and the offset of the segmentation line between pores is alleviated, resulting in a more accurate pore segmentation result.
[0068] To further illustrate the segmentation accuracy of the detection method of the present invention, the correct segmentation rate is used. ACC Oversegmentation rate OVER and under-segmentation rate UNDER The formula for evaluating the segmentation results is as follows: , , , In the formula: N ALL This represents the total number of pores in the surface image. N ACC This represents the number of correctly segmented pores in the surface image. N OVER This represents the number of oversegmented pores in the surface image. N UNDER This represents the number of under-segmented pores in the surface image.
[0069] As shown in Table 2, the comparative segmentation statistics show that all four methods exhibit varying degrees of oversegmentation and undersegmentation. The detection method of this invention correctly segments more pores than the other three methods. The label control watershed algorithm and the distance watershed algorithm have better correct segmentation rates than the gradient watershed algorithm, and their oversegmentation rates are relatively close to those of the detection method of this invention, both being less than 5%. However, some clustered pores are still not correctly separated.
[0070] Table 2
[0071] (3) Conclusion
[0072] To address the challenges of detecting porosity defects on metal plates in industrial applications, such as complex image backgrounds, overlapping segmented targets, and segmentation line misalignment, this invention presents a metal plate detection device based on the watershed algorithm, built using machine vision. A corresponding method based on this algorithm is also proposed, employing an adaptive algorithm to extract porosity regions and calculating distance maps using centroids marked with minimum values. Experiments on ideal and real porosity images demonstrate that the proposed method effectively suppresses segmentation line misalignment and achieves more accurate porosity segmentation. Compared to several existing algorithms, the proposed method achieves a porosity segmentation accuracy of 94.7%.
[0073] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for detecting metal plates based on the watershed algorithm, characterized in that: The process includes image acquisition, stomatal region extraction, image processing, overlapping region separation, and quality inspection. The specific steps are as follows: A. Image Acquisition: Acquire images of the surface of the metal plate; B. Stomatal region extraction: The surface image is sequentially processed through binarization, connected component filtering, and morphological operations to extract the pore region from the surface image. C. Image processing: The watershed segmentation method is used to process the images of the adhesion points in the extracted pore areas; D. Separation of overlapping parts: Separate the overlapping parts of the segmented regions after image processing to obtain an image of the metal plate surface including the pore region; E. Quality Inspection: Based on the surface image of the metal plate obtained in step D, determine the surface quality of the metal plate.
2. The metal plate detection method based on the watershed algorithm according to claim 1, characterized in that: The step B is preceded by an image preprocessing step, which involves applying a piecewise transformation to the acquired surface image to enhance the grayscale range, resulting in an image with higher contrast that includes pores. The formula for the piecewise transformation is: , In the formula: L ( i , j )and L' ( i , j () represent the first and second parts of the surface image before and after piecewise transformation. i Line 1 j The gray values of the column pixels, a, b, c, d, e, and f are all stretching interval parameter values of the piecewise transformation of the surface image.
3. The metal plate detection method based on the watershed algorithm according to claim 1 or 2, characterized in that: In step B, after the surface image is binarized, the specific process of extracting the pore region from the surface image using connected component filtering and morphological operations is as follows: B10. Area Filtering: The connected component area selection method is used to select all pore connected components with an area greater than the threshold after binarization of the surface image. B20, Edge Connection: Morphological dilation of the surface image after area screening is performed using 3×3 structuring elements to connect the edges of broken pores; B30, Hole Filling: Morphological reconstruction is used to fill the closed hole areas in the surface image after edge connection, resulting in a surface image containing pore areas.
4. The metal plate detection method based on the watershed algorithm according to claim 3, characterized in that: Step C includes centroid extraction and distance transformation sub-steps; C10. Centroid Extraction: Subtract the image after hole filling from the image before hole filling to obtain the original minimum value marker image. Treat each original minimum value marker as a connected region, calculate the nth order central moment for each pixel in the original minimum value marker, and then calculate the centroid from the central moment to obtain the centroid marker. C20. Distance Transformation: Calculate the minimum distance from each pixel in the foreground region to the centroid marker in the foreground region, and then use the watershed algorithm to process the image based on the aforementioned minimum distance to obtain the image after distance transformation, including the adhesion points in the pore region.
5. The metal plate detection method based on the watershed algorithm according to claim 4, characterized in that: The formula for calculating the nth-order central moment of each pixel in the original minimum value marker in the C10 sub-step is as follows: , , , , , , In the formula: M pq Let be the (p+q)th order central moment of the surface image, used to describe the level of detail in the image; V ( i , j ) represents the first local minimum value in the connected component. i Line 1 j Column pixels; M 00 It represents the zeroth moment of the image, which is the sum of all pixel values; M 10 The sum of the x-coordinates of all pixels within the connected region of the original minimum value is given. M 01 The sum of the ordinates of all pixels within the connected region of the original minimum value is given by ( x c , y c (x) represents the extracted centroid coordinates. p This indicates a weighted average on the x-coordinate, and the y-coordinate is... p This indicates that the y-coordinate is weighted. f ( x , y ) is in coordinates ( x , y The pixel grayscale value at position () is where n is the total number of rows in the image and m is the total number of columns in the image.
6. The metal plate detection method based on the watershed algorithm according to claim 5, characterized in that: In step C20, the minimum distance from each pixel within the foreground region to the centroid marker within the foreground region is calculated. Let A and B be the set of pixel coordinates and the set of centroid coordinates within the foreground region, respectively. Then the distance map calculation formula is: , , In the formula: p and c These are points within sets A and B, respectively. d ( p , c )for p and c Euclidean distance between points; Δ( p , A The result of the internal distance transformation is the minimum distance. x p Let x be the x-coordinate of a point within set A. x c Let x be the x-coordinate of a point within set B. y p Let be the ordinate of a point within set A. y c Let be the ordinate of a point within set B.
7. The metal plate detection method based on the watershed algorithm according to claim 6, characterized in that: In the C20 sub-step, image processing is performed using the watershed algorithm based on the aforementioned minimum distance. Let S be the set of N extracted centroid markers {S=S...} i (i∈[1,…,N])}, M is the set of connected components of the input stomata {M=M j (j∈[1,…,K])}, where G is the number of centroid labels contained within a single stomatal connected region, as follows: C21. Read the image containing the stomata region; C22. Extract the set of connected components of the stomatal region M'={M j | j∈[1,…,k]} and the set of centroid labels S'={S i | i∈[1,…,n]}; C23. Extract the j-th connected component from set M'; C24. Select the current stomatal connectivity region M from set S'. j Mark G centroids in the sample set C and construct a sample set C. j ={C j (i), i=1,…,G}; C25. If G = Ø, then proceed to step C26; otherwise, proceed to step C27; where Ø is the empty set. C26, Connect the stomata to region M j Add the centroid to set C j Then proceed to step C25; C27. Calculate the current stomatal connectivity M. j Each pixel in the set C j Δ(p, A) is used to obtain the distance map H; C28. Calculate j = j + 1 and go to step C23 until j > k; C29. The watershed algorithm is used to process the distance map H, denoted as R, i.e.: R = cv 2. watershed ( H In the formula: cv 2. watershed This represents a function call to the watershed image segmentation algorithm in the OpenCV library. After execution, it returns a label matrix R of the same size as the original image, where different values represent different segmented regions.
8. A metal plate detection system based on the watershed algorithm, characterized in that: It includes a stomatal region extraction module, an image processing module, an overlapping region separation module, and a quality detection module. The image acquisition module is used to acquire surface images of the metal plate; The pore region extraction module is used to extract the pore region from the surface image by sequentially performing binarization, connected component filtering and morphological operations on the surface image. In this process, after the surface image is processed by the binarization unit, the connected component filtering unit and morphological operation unit in the module are used to extract the pore region in the surface image. The connected component filtering unit is used to select all pore connected components with an area greater than a threshold by using a connected component area selection method on the binarized surface image. The morphological operation unit is used to perform morphological dilation on the surface image after area screening using a 3×3 structuring element to connect the edges of the broken pores, and then use morphological reconstruction to fill the closed hole region in the surface image after edge connection to obtain a surface image containing the pore region. The image processing module is used to perform image processing on the adhesion points of the extracted pore regions using the watershed segmentation method; The image processing module includes a centroid extraction unit and a distance transformation unit. The centroid extraction unit is used to obtain the original minimum value marker image by subtracting the image after hole filling from the image before hole filling, and to treat each original minimum value marker as a connected region. The nth-order central moment is calculated for each pixel in the original minimum value marker, and the centroid is calculated from the central moment, thus obtaining the centroid marker. The distance transformation unit is used to calculate the minimum distance from each pixel in the foreground region to the centroid marker in the foreground region, and then perform image processing based on the aforementioned minimum distance using the watershed algorithm to obtain an image after distance transformation, including the adhesion points in the pore region. The overlapping part separation module is used to separate the overlapping parts of the segmented regions after image processing to obtain a metal plate surface image including the pore region. The quality inspection module is used to determine the surface quality of the metal plate based on the metal plate surface image obtained by the overlapping part separation module.
9. A metal plate detection device based on watershed algorithm, comprising a main frame (1), a conveying mechanism (2) for conveying metal plates (4) is provided on the main frame (1), and detection mechanisms (3) are respectively provided on both sides of the main frame (1) along the conveying direction of the metal plates (4), and a control system; Its features are: The conveying mechanism (2) includes a conveying frame (21), a conveying roller group (22), and a drive assembly (23). The conveying frame (21) is a portal or gantry structure frame. The conveying roller group (22) includes a drive sprocket, a driven sprocket, a transmission chain (221), and a clapper carrier (222). The drive sprocket and the driven sprocket are respectively set at both ends of the conveying frame (21). The transmission chain (221) is sleeved on the drive sprocket and the driven sprocket. Multiple clapper carriers (222) for clamping metal plates (4) are hinged at intervals on the transmission chain (221). The drive assembly (23) includes a motor (231) and a reducer (232). The motor (231) is fixed at one end of the conveying frame (21) where the drive sprocket is located, and the motor shaft is connected to the input shaft of the reducer (232). The output shaft of the reducer (232) is connected to the drive sprocket. The motor (231) is electrically connected to the control system. The detection mechanism (3) includes a sub-frame (31), an industrial camera (32), a light source (33), and a control system. The sub-frame (31) is fixedly installed on one side of the main frame (1) along the conveying direction of the metal plate (4). The industrial camera (32) and the light source (33) are respectively installed on the sub-frame (31) and are respectively connected to the control system. The control system stores a computer program, which, when executed by a processor, implements the metal plate detection method based on the watershed algorithm as described in any one of claims 1 to 7.
10. The metal plate detection device based on the watershed algorithm according to claim 9, characterized in that: The output shaft of the reducer (232) is connected to a drive pulley, and the drive sprocket is coaxially fixed with a driven pulley. A belt is sleeved between the drive pulley and the driven pulley. The end of the clapper carrier (222) away from the transmission chain (221) is provided with a slot in the shape of an inverted trapezoid that holds a metal plate (4). The surface of the slot is covered with a rubber layer.
Citation Information
Patent Citations
Equipment, method and storage medium for identifying, extracting and evaluating rust pits on steel structure surfaces
CN111931647B
Metal workpiece surface defect detection method based on computer vision
CN117314925B