Rebar end face identification and counting device and method
Through the steel bar end surface identification counting device and algorithm, the problems of large errors and low efficiency in the counting of steel bars are solved, and efficient and accurate steel bar counting is achieved, which is suitable for complex industrial environments.
Patent Information
- Application Number
- CN202310143727.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-15
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2043-02-15
AI Technical Summary
The prior art has problems of large errors and low efficiency in the counting of steel bars, especially in the counting of small diameters and short lengths of steel bars, the weighting method has a large error, the automatic counting of point-branch electronics is time-consuming and labor-intensive, and the linear laser scanning is easy to misjudgment. The neural network-based method is complex and difficult to identify special end faces.
The end-face recognition counting device of steel bars is adopted, including a roller conveyor mechanism, an end-face collision baffle, a transport mechanism, a lifting and lowering blind, an annular spotlight, a collection lens and a laser sensor. Combined with the weighted average method, Gamma transformation, background elimination, Gaussian filtering noise reduction and structural similarity calculation algorithms, a steel bar end-face template library is established to achieve accurate counting.
It improves the accuracy and efficiency of steel bar counting, avoids background light occlusion and image adhesion problems, and is suitable for bundled steel bar counting in complex industrial environments.
Smart Images

Figure CN116443335B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of steel bar counting, and in particular relates to a device and method for identifying and counting steel bar end faces. Background Art
[0002] Over the years, my country's construction industry has continued to grow rapidly, and rebar, a necessary component of construction, has maintained a significant economic impact. Accurately counting rebar quantities is crucial in rebar production and sales. Therefore, being able to quickly and accurately count rebar quantities during bundle marking is crucial for improving on-site production efficiency and reducing labor costs.
[0003] Initial counting accuracy during rebar bundling is low, necessitating a re-inspection process. Currently, companies typically use weighing, electronic automatic counting pens, and line laser scanning for rebar re-inspection. Due to negative tolerance production processes, weighing methods are prone to errors when working with small rebar diameters and short lengths, a significant pain point in rebar production lines. Electronic automatic counting pens, on the other hand, require manual inspection, which is time-consuming and labor-intensive. Line laser scanning can easily connect different end faces, leading to misidentification. As machine vision image processing technology matures and finds widespread application across various industries, scholars have recently conducted research on algorithms for identifying and counting rebar end faces, proposing a variety of counting methods, including connected area counting, edge detection, and neural network-based approaches. Each method achieves a high degree of automated rebar identification, driving the digital development and upgrading of the rebar industry. However, each has its limitations. Edge detection and area methods are significantly affected by the confluence of end face images. Neural network-based methods are labor-intensive and algorithmically complex, and struggle to effectively identify occasionally unusual end faces. Therefore, further improvements in rebar end face identification and counting methods are urgently needed. Summary of the Invention
[0004] In view of the above problems, the present invention provides a device and method for identifying and counting steel bar end faces.
[0005] In order to achieve the above-mentioned purpose, the present invention adopts the following technical solutions:
[0006] The steel bar end face identification and counting device includes a steel bar conveying mechanism, wherein end face alignment baffles are provided at the front and rear of the steel bar conveying mechanism, a transfer mechanism is provided below the steel bar conveying mechanism, and is used to convey bundled steel bars with aligned ends to a detection platform, and a liftable blackout curtain is provided above the front of the detection platform, the upper end of the blackout curtain is wound on a reel, and the two ends of the reel are rotatably provided on a mounting frame, a rolling curtain motor is provided on one side of the mounting frame, the reel is fixedly connected to the output shaft of the rolling curtain motor, and the mounting frame is fixedly connected to the box through a connecting rod. The box is arranged in front of the detection table, and legs are arranged on the lower surface of the box. A position adjustment mechanism is arranged inside the box, and a slide is arranged on the position adjustment mechanism. A ring spotlight is arranged on the slide, and a collection lens is arranged in the middle of the ring spotlight. A laser sensor is arranged on the side of the box close to the steel bar conveying mechanism, and the laser sensor is used to sense the position of the steel bar bundle. The steel bar conveying mechanism, the transfer machine, the roller shutter motor, the position adjustment mechanism, the ring spotlight, the collection lens and the laser sensor are all controlled by the console.
[0007] Furthermore, the steel bar conveying mechanism is a roller conveying mechanism.
[0008] Furthermore, the transfer mechanism includes two chain shafts, on which a plurality of one-to-one corresponding sprockets are provided, a chain is provided between the two corresponding sprockets, and the chain shafts are jointly supported by a plurality of bearing seats, and a telescopic cylinder is provided under each bearing seat for driving the chain shaft to move up and down, and the cylinder body of the telescopic cylinder is installed on the ground, and a chain drive motor is provided at the end of one of the chain shafts for driving the chain shaft to rotate, and the chain drive motor is installed on the telescopic cylinder.
[0009] Furthermore, the lower edge of the blackout curtain is in an arc shape corresponding to the steel bar bundle.
[0010] Furthermore, the position adjustment mechanism includes a transverse fixed seat, a transverse guide rod and a transverse screw are installed on the transverse fixed seat, a transverse motor is arranged on one side of the transverse fixed seat, the output shaft of the transverse motor is connected to the transverse screw, a slider is threadedly connected to the transverse screw, the slider is slidingly connected to the transverse guide rod, a longitudinal guide rod is fixedly provided on the upper surface of the slider, a longitudinal seat is provided at the upper end of the longitudinal guide rod, a longitudinal screw is also provided between the longitudinal seat and the slider, a longitudinal motor for driving the longitudinal screw to rotate is provided on the upper surface of the longitudinal seat, the slide is threadedly connected to the longitudinal screw, and the slide is slidingly connected to the longitudinal guide rod.
[0011] The steel bar end face identification and counting method comprises the following steps:
[0012] Step 1: Create a reinforcement end template library, specifically:
[0013] Step 1.1, collect multiple end face images of steel bar bundles to form a data set, and divide the data set into a training set and a test set;
[0014] Step 1.2, select an end face image of a steel bar bundle from the training set, and grayscale the selected end face image of the steel bar bundle using a weighted average method;
[0015] The formula for the weighted average method is:
[0016] Gray(x, y) = W R R(x, y)+W G G(x, y)+W B B(x, y)
[0017] Among them, x and y represent the coordinates of each point, Gray(x,y) is the result of weighted grayscale, R(x,y), G(x,y), B(x,y) are the red, green and blue component values of each point, and W R 、W G 、W B is the corresponding weight;
[0018] Step 1.3, performing Gamma transformation on the grayscale processed end face image of the steel bar bundle;
[0019] The Gamma function formula is as follows:
[0020]
[0021] Among them, Gamma(x,y) is the normalized grayscale image after Gamma transformation, and γ is the correction parameter;
[0022] In step 1.4, the following calculation formula is used to eliminate the interference of debris in the background of the end face image of the steel bar bundle after the Gamma transformation, and the dark background is eliminated:
[0023]
[0024] Where f(x,y) is the end face image of the steel bar bundle after de-impurity, and M is the background elimination threshold;
[0025] Step 1.5, performing Gaussian filtering on the image of the end face of the steel bar bundle after removing impurities to reduce noise;
[0026] Step 1.6: Extract a partial image that is identical to the positive template from the end face image of the steel bar bundle pixel by pixel, and calculate the matching degree with each positive template in the positive template library one by one. If there is no positive template in the positive template library, proceed directly to step 1.9;
[0027] All matching results are output as a two-dimensional matrix, and the matching degree is calculated as follows:
[0028]
[0029] Where w and h are the width and height of the positive template, respectively; T(x',y') is the value at coordinate (x',y') of the positive template; I(x,y) is the value at coordinate (x,y) on the preprocessed image; and R(x,y) is the output matrix; where the position of T(x',y') on the positive template is the same as the position of I(x,y) on the preprocessed image;
[0030] The matching degree in the two-dimensional matrix is compared with the matching threshold C. If it is greater than or equal to the matching threshold C, it is identified as a steel bar end face image, which is recorded as 1. If it is less than the threshold, it is identified as a non-steel bar end face, which is recorded as 0. Finally, the recognition result matrix Flag(x,y) is obtained:
[0031]
[0032] Step 1.7, remove duplicate results; set a point in the local graph as the coordinate of the local graph, and calculate the distance between adjacent recognition results H = [(x2-x1) 2 +(y2-y1) 2 ] 0.5 , where x1, x2, y1, and y2 are the horizontal and vertical coordinates of two adjacent recognition results respectively. The steel bar radius R is selected as the judgment threshold. If H is less than R, it is considered a duplicate result and one is discarded. Repeat the judgment action, delete all duplicate results, and output the remaining recognition results as the identification results.
[0033] Step 1.8: Perform SSIM error correction on each local graph in the recognition result, and calculate the structural similarity between the local graph in the recognition result and each anti-template in the anti-template library. If there is no anti-template in the anti-template library, proceed directly to step 1.9.
[0034]
[0035] where μ x is the mean value of x, μ y is the mean value of y, σ x 2 is the variance of x, σ y 2 is the variance of y, σ xy is the covariance of x and y, c1 = 0.0001L 2 ,c2=0.0009L 2 is a constant used to maintain stability, and L is the dynamic range of pixel values;
[0036] Compare the calculated SSIM value with the SSIM threshold, delete the results that are greater than or equal to the SSIM threshold, and output the final result;
[0037] Step 1.9: Determine whether the number of steel bars identified in the final result is correct. If it is correct, select the next image in the training set and repeat steps 1.2 to 1.9. If it is incorrect, perform manual correction. Cut out the single steel bar end view of the unidentified steel bar and add it to the positive template library. Cut out the error view of the position that is incorrectly identified as steel bar and add it to the negative template library. Then repeat steps 1.7 to 1.9 until all images in the training set are correctly identified.
[0038] Step 1.10: Repeat steps 1.2 to 1.8 for the rebar bundle end face images in the test set. If the number of rebars in the rebar bundle end face images in the test set is correctly identified, the rebar end face template library is successfully established. If the number of rebars in the rebar bundle end face images in the test set is incorrectly identified, repeat steps 1.1 to 1.10 until the rebar end face template library is successfully established.
[0039] Step 2: Create a template library for the end face of the steel bar bundle and calculate the translation coefficient, specifically:
[0040] Step 2.1, collect end-face images of multiple bundled rebars to establish a library of bundled rebar end-face images: manually control the acquisition camera to focus on the center of the bundled rebars, and collect end-face images of the bundled rebars as a template image of the rebar bundle. The image range must closely follow the top, bottom, left, and right poles of the bundle.
[0041] Step 2.2, calculate the translation coefficient K:
[0042]
[0043] Where L is the actual distance the acquisition lens moves;
[0044] Step 3, aligning the end faces of the bundled steel bars; placing the bundled steel bars to be counted on the steel bar conveying mechanism, and driving the bundled steel bars to align their end faces through the steel bar conveying mechanism, and the last collision is the front collision, so as to ensure that the front ends of the steel bars in the bundled steel bars are located in the same plane during technical identification. When the steel bar conveying mechanism rotates forward, the bundled steel bars are driven forward and collide with the front end face collision baffle, and when the steel bar conveying mechanism rotates reversely, the bundled steel bars are driven backward and collide with the rear end face collision baffle;
[0045] Step 4, the bundled steel bars are transported after being aligned; after the end faces of the bundled steel bars are aligned, the transport mechanism transports the aligned bundled steel bars to the testing table;
[0046] Step 5: When the bundled steel bars pass by the laser sensor during transportation, the laser sensor collects signals from the bundled steel bars and transmits the signals to the control console. The control console controls the roller shutter motor to lower the light-shielding curtain based on the signals collected by the laser sensor.
[0047] Step 6: After the bundle of steel bars is in place and the light-shielding curtain is lowered, the center position of the bundle of steel bars is determined. After the center position of the bundle of steel bars is determined, the control console controls the position adjustment mechanism to operate so that the acquisition lens is aligned with the center position of the bundle of steel bars;
[0048] Step 7: Turn on the ring spotlight. Under the illumination of the ring spotlight, use the acquisition lens to collect the end face images of the bundled steel bars, upload the collected end face images to the console, and perform recognition processing on the collected end face images to obtain the number of steel bars.
[0049] Furthermore, in step 6, the specific steps of determining the center position of the bundled steel bars are as follows:
[0050] Collect the end face images of the bundled steel bars and perform template matching between the collected images and the images in the end face image library in step 2. The matching formula is as follows:
[0051]
[0052] Among them, w 整捆 and h 整捆 are the width and height of the steel bundle template, T(i′, j′) is the value at coordinate (i′, j′) of the steel bundle template, I(i, j) is the value at coordinate (i, j) on the preprocessed image, and R(i, j) is the output matrix; the position of T(i′, j′) on the steel bundle template is the same as the position of I(i, j) on the preprocessed image;
[0053] If the matching is successful, that is, R(i, j) ≥ C1, where C1 is the matching threshold of the entire bundle of steel bars, then the four poles of the upper, lower, left, and right are determined to be u, d, l, and r respectively. The center of the steel bar bundle at this time is center(i, j):
[0054]
[0055] If the matching is unsuccessful, the image is recaptured for matching. If the matching is unsuccessful for five consecutive times, the acquisition lens is aimed at the center position of the bundled steel bars, and the image is captured according to the capture requirements of the steel bar bundle template. The captured image is added to the end face image library, and then the image is recaptured to determine the center position of the bundled steel bars.
[0056] Furthermore, in step 7, the collected end face image is identified and processed to obtain the number of steel bars, which specifically includes the following steps:
[0057] Step 7.1, grayscale processing is performed on the collected end face image using the weighted average method;
[0058] The formula for the weighted average method is:
[0059] Gray(x, y) = W R R(x, y)+W G G(x, y)+W B B(x, y)
[0060] Among them, x and y represent the coordinates of each point, Gray(x, y) is the result of weighted grayscale, R(x, y), G(x, y), B(x, y) are the red, green and blue component values of each point, and W R 、W G 、W B is the corresponding weight;
[0061] Step 7.2, performing Gamma transformation on the grayscale processed end face image of the steel bar bundle;
[0062] The Gamma function formula is as follows:
[0063]
[0064] Among them, Gamma(x,y) is the normalized grayscale image after Gamma transformation, and γ is the correction parameter;
[0065] Step 7.3: Use the following formula to eliminate the interference of debris in the background of the back-end image after Gamma transformation and complete the background dark area elimination:
[0066]
[0067] Where f(x,y) is the end face image after de-impurity, and M is the background removal threshold;
[0068] Step 7.4, performing Gaussian filtering on the end face image after removing impurities to reduce noise;
[0069] In step 7.5, a partial image identical to the positive template is intercepted pixel by pixel from the end face image of the steel bar bundle, and the matching degree with each positive template in the positive template library is calculated one by one. All matching results are output as a two-dimensional matrix. The matching degree calculation formula is as follows:
[0070]
[0071] Where w and h are the width and height of the positive template, respectively; T(x',y') is the value at the coordinate (x',y') of the positive template; I(x,y) is the value at the coordinate (x,y) on the preprocessed image; and R(x,y) is the output matrix.
[0072] The matching degree in the two-dimensional matrix is compared with the matching threshold C. If it is greater than or equal to the matching threshold C, it is identified as a steel bar end face image, which is recorded as 1. If it is less than the threshold, it is identified as a non-steel bar end face, which is recorded as 0. Finally, the recognition result matrix Flag(x,y) is obtained:
[0073]
[0074] Step 7.6, remove duplicate results; set a point in the local graph as the coordinate of the local graph, and calculate the distance between adjacent recognition results H = [(x2-x1) 2 +(y2-y1) 2 ] 0.5 , where x1, x2, y1, and y2 are the horizontal and vertical coordinates of two adjacent recognition results respectively. The steel bar radius R is selected as the judgment threshold. If H is less than R, it is considered a duplicate result and one is discarded. Repeat the judgment action, delete all duplicate results, and output the remaining recognition results as the identification results.
[0075] Step 7.7, perform SSIM error correction on each local graph in the recognition result, and calculate the structural similarity between the local graph in the recognition result and each anti-template in the anti-template library one by one;
[0076]
[0077] where μ x is the mean value of x, μ y is the mean value of y, is the variance of x, is the variance of y, σ xy is the covariance of x and y, c1 = 0.0001L 2 ,c2=0.0009L 2 is a constant used to maintain stability, and L is the dynamic range of pixel values;
[0078] Compare the calculated SSIM value with the SSIM threshold, delete the results that are greater than or equal to the SSIM threshold, and output the final result.
[0079] Compared with the prior art, the present invention has the following advantages:
[0080] In terms of hardware, the present invention adopts a lifting blackout curtain, which can not only block the background light, but also make it convenient for the operator to observe the operation of the equipment at any time, avoiding the disadvantage of the traditional blackout hood with too large blind spots; at the same time, the acquisition lens and the annular spotlight can be adjusted by the control position adjustment mechanism to face the center position of the bundled steel bars, avoiding the mutual blocking and uneven fill light between the steel bars during the image acquisition process.
[0081] In terms of algorithms, the present invention has the advantages of fast calculation speed and high recognition accuracy, avoiding the image adhesion problem of traditional algorithms. At the same time, the establishment and optimization process of the template library is easy to operate, and is suitable for counting bundled steel bars in complex industrial environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] Figure 1 Schematic diagram of the installation of the steel bar conveying mechanism and the transfer mechanism of the present invention;
[0083] Figure 2 Schematic diagram of the installation of the transfer mechanism and the detection platform of the present invention;
[0084] Figure 3 It is a structural schematic diagram of the transfer mechanism of the present invention;
[0085] Figure 4 It is a structural schematic diagram of the detection platform of the present invention;
[0086] Figure 5 Schematic diagram of the structure of the position adjustment mechanism of the present invention;
[0087] Figure 6 This is a schematic structural diagram of the blackout curtain of the present invention;
[0088] Figure 7 is a flow chart of the present invention;
[0089] Figure 8 A flow chart for establishing a steel bar end template library for the present invention;
[0090] In the figure, there are the steel bar conveying mechanism 1, the end face collision baffle 2, the transfer mechanism 3, the inspection platform 4, the blackout curtain 5, the reel 6, the mounting frame 7, the curtain motor 8, the connecting rod 9, the box 10, the support leg 11, the position adjustment mechanism 12, the slide 13, the ring spotlight 14, the collection lens 15, the laser sensor 16, the control console 17, the chain shaft 301, the telescopic cylinder 302, the chain 303, the sprocket 304, the bearing seat 305, the chain drive motor 306, the transverse fixing seat 121, the transverse guide rod 122, the transverse screw 123, the transverse motor 124, the slider 125, the longitudinal guide rod 126, the longitudinal seat 127, the longitudinal screw 128, and the longitudinal motor 129. DETAILED DESCRIPTION
[0091] In order to further illustrate the technical solution of the present invention, the present invention is further described below through examples.
[0092] like Figures 1 to 6As shown, the steel bar end face identification and counting device includes a steel bar conveying mechanism 1, which is a roller conveying mechanism. End face alignment baffles 2 are provided at the front and rear of the steel bar conveying mechanism 1. A transfer mechanism 3 is provided below the steel bar conveying mechanism 1 for conveying bundles of steel bars with aligned ends to a testing platform 4. A liftable blackout curtain 5 is provided above the front of the testing platform 4. The upper end of the blackout curtain 5 is wound around a reel 6. The lower edge of the blackout curtain 5 is in an arc shape corresponding to the steel bar bundle. The two ends of the reel 6 are rotatably arranged on a mounting frame 7. A rolling motor 8 is provided on one side of the mounting frame 7. The reel 6 is fixedly connected to the output shaft of the rolling motor 8. The mounting frame 7 is connected by The rod 9 is fixedly connected to the box 10, and the box 10 is arranged in front of the detection platform 4. The support legs 11 are arranged on the lower surface of the box 10, and a position adjustment mechanism 12 is arranged inside the box 10. A slide 13 is arranged on the position adjustment mechanism 12, and a ring spotlight 14 is arranged on the slide 13. A collection lens 15 is arranged in the middle of the ring spotlight 14, and a laser sensor 16 is arranged on the side of the box 10 close to the steel bar conveying mechanism 1. The laser sensor 16 is used to sense the position of the steel bar bundle. The steel bar conveying mechanism 1, the transfer machine, the roller shutter motor 8, the position adjustment mechanism 12, the ring spotlight 14, the collection lens 15 and the laser sensor 16 are all controlled by the console 17.
[0093] The transfer mechanism 3 includes two chain shafts 301, on which a plurality of one-to-one corresponding sprockets 304 are arranged, and a chain 303 is arranged between the two corresponding sprockets 304. The chain shafts 301 are jointly supported by a plurality of bearing seats 305, and a telescopic cylinder 302 is arranged under each bearing seat 305 for driving the chain shaft 301 to move up and down. The cylinder body of the telescopic cylinder 302 is installed on the ground, and a chain drive motor 306 is provided at the end of one of the chain shafts 301 for driving the chain shaft 301 to rotate, and the chain drive motor 306 is installed on the telescopic cylinder 302.
[0094] The position adjustment mechanism 12 includes a transverse fixed seat 121, on which a transverse guide rod 122 and a transverse lead screw 123 are installed, and a transverse motor 124 is arranged on one side of the transverse fixed seat 121, and the output shaft of the transverse motor 124 is connected to the transverse lead screw 123, and a slider 125 is threadedly connected to the transverse lead screw 123, and the slider 125 is slidingly connected to the transverse guide rod 122, and a longitudinal guide rod 126 is fixedly provided on the upper surface of the slider 125, and a longitudinal seat 127 is provided at the upper end of the longitudinal guide rod 126, and a longitudinal lead screw 128 is further provided between the longitudinal seat 127 and the slider 125, and a longitudinal motor 129 for driving the longitudinal lead screw 128 to rotate is provided on the upper surface of the longitudinal seat 127, and the slide 13 is threadedly connected to the longitudinal lead screw 128, and the slide 13 is slidingly connected to the longitudinal guide rod 126.
[0095] The steel bar end face identification and counting method comprises the following steps:
[0096] Step 1: Create a reinforcement end template library, specifically:
[0097] Step 1.1, collect multiple end face images of steel bar bundles to form a data set, and divide the data set into a training set and a test set;
[0098] Step 1.2, select an end face image of a steel bar bundle from the training set, and grayscale the selected end face image of the steel bar bundle using a weighted average method;
[0099] The formula for the weighted average method is:
[0100] Gray(x, y) = W R R(x, y)+W G G(x, y)+W B B(x, y)
[0101] Among them, x and y represent the coordinates of each point, Gray(x,y) is the result of weighted grayscale, R(x,y), G(x,y), B(x,y) are the red, green and blue component values of each point, and W R 、W G 、W B is the corresponding weight;
[0102] Step 1.3, performing Gamma transformation on the grayscale processed end face image of the steel bar bundle;
[0103] The Gamma function formula is as follows:
[0104]
[0105] Among them, Gamma(x,y) is the normalized grayscale image after Gamma transformation, and γ is the correction parameter;
[0106] In step 1.4, the following calculation formula is used to eliminate the interference of debris in the background of the end face image of the steel bar bundle after the Gamma transformation, and the dark background is eliminated:
[0107]
[0108] Where f(x,y) is the end face image of the steel bar bundle after de-impurity, and M is the background elimination threshold;
[0109] Step 1.5, performing Gaussian filtering on the image of the end face of the steel bar bundle after removing impurities to reduce noise;
[0110] Step 1.6: Extract a partial image that is identical to the positive template from the end face image of the steel bar bundle pixel by pixel, and calculate the matching degree with each positive template in the positive template library one by one. If there is no positive template in the positive template library, proceed directly to step 1.9;
[0111] All matching results are output as a two-dimensional matrix, and the matching degree is calculated as follows:
[0112]
[0113] Where w and h are the width and height of the positive template, respectively; T(x',y') is the value at coordinate (x',y') of the positive template; I(x,y) is the value at coordinate (x,y) on the preprocessed image; and R(x,y) is the output matrix; where the position of T(x',y') on the positive template is the same as the position of I(x,y) on the preprocessed image;
[0114] The matching degree in the two-dimensional matrix is compared with the matching threshold C. If it is greater than or equal to the matching threshold C, it is identified as a steel bar end face image, which is recorded as 1. If it is less than the threshold, it is identified as a non-steel bar end face, which is recorded as 0. Finally, the recognition result matrix Flag(x,y) is obtained:
[0115]
[0116] Step 1.7, remove duplicate results; set a point in the local graph as the coordinate of the local graph, and calculate the distance between adjacent recognition results H = [(x2-x1) 2 +(y2-y1) 2 ] 0.5 , where x1, x2, y1, and y2 are the horizontal and vertical coordinates of two adjacent recognition results respectively. The steel bar radius R is selected as the judgment threshold. If H is less than R, it is considered a duplicate result and one is discarded. Repeat the judgment action, delete all duplicate results, and output the remaining recognition results as the identification results.
[0117] Step 1.8: Perform SSIM error correction on each local graph in the recognition result, and calculate the structural similarity between the local graph in the recognition result and each anti-template in the anti-template library. If there is no anti-template in the anti-template library, proceed directly to step 1.9.
[0118]
[0119] where μ x is the mean value of x, μ y is the mean value of y, is the variance of x, is the variance of y, σ xy is the covariance of x and y, c1 = 0.0001L 2 ,c2=0.0009L 2 is a constant used to maintain stability, and L is the dynamic range of pixel values;
[0120] Compare the calculated SSIM value with the SSIM threshold, delete the results that are greater than or equal to the SSIM threshold, and output the final result;
[0121] Step 1.9: Determine whether the number of steel bars identified in the final result is correct. If it is correct, select the next image in the training set and repeat steps 1.2 to 1.9. If it is incorrect, perform manual correction. Cut out the single steel bar end view of the unidentified steel bar and add it to the positive template library. Cut out the error view of the position that is incorrectly identified as steel bar and add it to the negative template library. Then repeat steps 1.7 to 1.9 until all images in the training set are correctly identified.
[0122] Step 1.10: Repeat steps 1.2 to 1.8 for the rebar bundle end face images in the test set. If the number of rebars in the rebar bundle end face images in the test set is correctly identified, the rebar end face template library is successfully established. If the number of rebars in the rebar bundle end face images in the test set is incorrectly identified, repeat steps 1.1 to 1.10 until the rebar end face template library is successfully established.
[0123] Step 2: Create a template library for the end face of the steel bar bundle and calculate the translation coefficient, specifically:
[0124] Step 2.1, collecting end-face images of multiple bundled steel bars to establish a library of end-face images of bundled steel bars: manually control the acquisition lens 15 to focus on the center of the bundled steel bars, and collect end-face images of the bundled steel bars as a template image of the steel bar bundle. The image range is required to closely follow the top, bottom, left, and right poles of the steel bar bundle;
[0125] Step 2.2, calculate the translation coefficient K
[0126]
[0127] Wherein L is the actual distance moved by the acquisition lens 15;
[0128] Step 3, aligning the end faces of the bundled steel bars; placing the bundled steel bars to be counted on the steel bar conveying mechanism 1, and driving the bundled steel bars to align their end faces through the steel bar conveying mechanism 1, and the last collision is the front collision, so as to ensure that the front ends of the steel bars in the bundled steel bars are located in the same plane during technical identification. When the steel bar conveying mechanism 1 rotates forward, it drives the bundled steel bars forward and hits the front end face alignment baffle 2. When the steel bar conveying mechanism 1 rotates backward, it drives the bundled steel bars backward and hits the rear end face alignment baffle 2.
[0129] Step 4, the bundled steel bars are transported after being aligned; after the end faces of the bundled steel bars are aligned, the transport mechanism 3 transports the aligned bundled steel bars to the testing station 4;
[0130] Step 5: When the bundled steel bars pass through the laser sensor 16 during transportation, the laser sensor 16 collects a signal from the bundled steel bars, and transmits the signal to the control console 17. The control console 17 controls the roller shutter motor 8 to operate according to the signal collected by the laser sensor 16, and lowers the blackout curtain 5.
[0131] Step 6: After the bundle of steel bars is in place and the shade curtain 5 is lowered, the center position of the bundle of steel bars is determined. After the center position of the bundle of steel bars is determined, the control console 17 controls the position adjustment mechanism 12 to operate so that the acquisition lens 15 is aligned with the center position of the bundle of steel bars;
[0132] The specific steps for determining the center position of bundled steel bars are as follows:
[0133] Collect the end face images of the bundled steel bars and perform template matching between the collected images and the images in the end face image library in step 2. The matching formula is as follows:
[0134]
[0135] Among them, w 整捆 and h 整捆 are the width and height of the steel bundle template, T(i',j') is the value at coordinate (i',j') of the steel bundle template, I(i,j) is the value at coordinate (i,j) on the preprocessed image, and R(i,j) is the output matrix; the position of T(i',j') on the steel bundle template is the same as the position of I(i,j) on the preprocessed image;
[0136] If the matching is successful, that is, R(i,j)≥C1, where C1 is the matching threshold of the entire bundle of steel bars, then the four poles of the upper, lower, left, and right are determined to be u, d, l, and r respectively. The center of the steel bar bundle at this time is center(i,j):
[0137]
[0138] If the matching is unsuccessful, re-collect the image for matching. If the matching is unsuccessful for 5 consecutive times, aim the acquisition lens 15 at the center of the bundled steel bars, and capture the image according to the capture requirements of the steel bar bundle template. The captured image is added to the end face image library, and then the image is re-collected to determine the center position of the bundled steel bars.
[0139] Step 7: Turn on the ring spotlight 14. Under the illumination of the ring spotlight 14, collect the end face image of the bundled steel bars through the collection lens 15, upload the collected end face image to the console 17, and perform recognition processing on the collected end face image to obtain the number of steel bars. The specific recognition processing steps are:
[0140] Step 7.1, grayscale processing is performed on the collected end face image using the weighted average method;
[0141] The formula for the weighted average method is:
[0142] Gray(x, y) = W R R(x, y)+W G G(x, y)+W B B(x, y)
[0143] Among them, x and y represent the coordinates of each point, Gray(x,y) is the result of weighted grayscale, R(x,y), G(x,y), B(x,y) are the red, green and blue component values of each point, and W R 、W G 、W B is the corresponding weight;
[0144] Step 7.2, performing Gamma transformation on the grayscale processed end face image of the steel bar bundle;
[0145] The Gamma function formula is as follows:
[0146]
[0147] Among them, Gamma(x,y) is the normalized grayscale image after Gamma transformation, and γ is the correction parameter;
[0148] Step 7.3: Use the following formula to eliminate the interference of debris in the background of the back-end image after Gamma transformation and complete the background dark area elimination:
[0149]
[0150] Where f(x,y) is the end face image after de-impurity, and M is the background removal threshold;
[0151] Step 7.4, performing Gaussian filtering on the end face image after removing impurities to reduce noise;
[0152] In step 7.5, a partial image identical to the positive template is intercepted pixel by pixel from the end face image of the steel bar bundle, and the matching degree with each positive template in the positive template library is calculated one by one. All matching results are output as a two-dimensional matrix. The matching degree calculation formula is as follows:
[0153]
[0154] Where w and h are the width and height of the positive template, respectively; T(x',y') is the value at the coordinate (x',y') of the positive template; I(x,y) is the value at the coordinate (x,y) on the preprocessed image; and R(x,y) is the output matrix.
[0155] The matching degree in the two-dimensional matrix is compared with the matching threshold C. If it is greater than or equal to the matching threshold C, it is identified as a steel bar end face image, which is recorded as 1. If it is less than the threshold, it is identified as a non-steel bar end face, which is recorded as 0. Finally, the recognition result matrix Flag(x,y) is obtained:
[0156]
[0157] Step 7.6, remove duplicate results; set a point in the local graph as the coordinate of the local graph, and calculate the distance between adjacent recognition results H = [(x2-x1) 2 +(y2-y1) 2 ] 0.5 , where x1, x2, y1, and y2 are the horizontal and vertical coordinates of two adjacent recognition results respectively. The steel bar radius R is selected as the judgment threshold. If H is less than R, it is considered a duplicate result and one is discarded. Repeat the judgment action, delete all duplicate results, and output the remaining recognition results as the identification results.
[0158] Step 7.7, perform SSIM error correction on each local graph in the recognition result, and calculate the structural similarity between the local graph in the recognition result and each anti-template in the anti-template library one by one;
[0159]
[0160] where μ x is the mean value of x, μ y is the mean value of y, is the variance of x, is the variance of y, σ xy is the covariance of x and y, c1 = 0.0001L 2 ,c2=0.0009L 2 is a constant used to maintain stability, and L is the dynamic range of pixel values;
[0161] Compare the calculated SSIM value with the SSIM threshold, delete the results that are greater than or equal to the SSIM threshold, and output the final result.
[0162] The foregoing shows and describes the principal features and advantages of the present invention. It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the present invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the present invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the present invention is defined by the appended claims, not the foregoing description, and all variations that come within the meaning and range of equivalents of the claims are intended to be embraced therein.
[0163] In addition, it should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.
Claims
1. A method for identifying and counting steel bar ends, characterized by: Apply steel bar end face identification and counting device; The steel bar end face identification and counting device comprises a steel bar conveying mechanism (1), wherein the steel bar conveying mechanism (1) is a roller conveying mechanism, and end face collision baffles (2) are provided at the front and rear of the steel bar conveying mechanism (1). A transfer mechanism (3) is provided below the steel bar conveying mechanism (1) for conveying bundles of steel bars with their ends aligned to a detection platform (4). A liftable blackout curtain (5) is provided above the front of the detection platform (4), the upper end of the blackout curtain (5) is wound on a reel (6), and the lower edge of the blackout curtain (5) is in an arc shape corresponding to the steel bar bundle. The two ends of the reel (6) are rotatably arranged on a mounting frame (7), and a rolling curtain motor (8) is provided on one side of the mounting frame (7). The reel (6) is fixedly connected to the output shaft of the rolling curtain motor (8), and the mounting frame (7) is fixedly connected to the reel via a connecting rod (9). The invention relates to a housing (10) connected to the housing (10), wherein the housing (10) is arranged in front of the detection platform (4), a support leg (11) is arranged on the lower surface of the housing (10), a position adjustment mechanism (12) is arranged inside the housing (10), a slide (13) is arranged on the position adjustment mechanism (12), an annular spotlight (14) is arranged on the slide (13), a collection lens (15) is arranged in the middle of the annular spotlight (14), a laser sensor (16) is arranged on the side of the housing (10) close to the steel bar conveying mechanism (1), and the laser sensor (16) is used to sense the position of the steel bar bundle. The steel bar conveying mechanism (1), the transfer machine, the roller shutter motor (8), the position adjustment mechanism (12), the annular spotlight (14), the collection lens (15) and the laser sensor (16) are all controlled by a control console (17); The transfer mechanism (3) includes two chain shafts (301), a plurality of sprockets (304) corresponding to each other are provided on the two chain shafts (301), a chain (303) is provided between the two corresponding sprockets (304), the chain shafts (301) are supported by a plurality of bearing seats (305), a telescopic cylinder (302) is provided below each bearing seat (305), and is used to drive the chain shaft (301) to move up and down, the cylinder body of the telescopic cylinder (302) is installed on the ground, a chain drive motor (306) is provided at the end of one of the chain shafts (301), and is used to drive the chain shaft (301) to rotate, and the chain drive motor (306) is installed on the telescopic cylinder (302); The position adjustment mechanism (12) includes a transverse fixed seat (121), a transverse guide rod (122) and a transverse lead screw (123) are installed on the transverse fixed seat (121), a transverse motor (124) is provided on one side of the transverse fixed seat (121), an output shaft of the transverse motor (124) is connected to the transverse lead screw (123), a slider (125) is threadedly connected to the transverse lead screw (123), the slider (125) is slidably connected to the transverse guide rod (122), and the slider A longitudinal guide rod (126) is fixedly provided on the upper surface of the (125), a longitudinal seat (127) is provided at the upper end of the longitudinal guide rod (126), a longitudinal screw (128) is further provided between the longitudinal seat (127) and the slider (125), a longitudinal motor (129) for driving the longitudinal screw (128) to rotate is provided on the upper surface of the longitudinal seat (127), the slide (13) is threadedly connected to the longitudinal screw (128), and the slide (13) is slidably connected to the longitudinal guide rod (126); The following steps are involved: Step 1: Create a reinforcement end template library, specifically: Step 1.1, collect multiple images of the end faces of steel bar bundles to form a data set, and divide the data set into a training set and a test set; Step 1.2: Select an end face image of a steel bar bundle from the training set, and grayscale the selected end face image of the steel bar bundle using a weighted average method; The formula for the weighted average method is: Gray(x,y)=W R ·R(x,y)+W G ·G(x,y)+W B ·B(x,y) Among them, x and y represent the coordinates of each point, Gray(x,y) is the result of weighted grayscale, R(x,y), G(x,y), B(x,y) are the red, green and blue component values of each point, and W R 、W G 、W B is the corresponding weight; Step 1.3, performing Gamma transformation on the grayscale processed end face image of the steel bar bundle; The Gamma function formula is as follows: Among them, Gamma(x,y) is the normalized grayscale image after Gamma transformation, and γ is the correction parameter; In step 1.4, the following calculation formula is used to eliminate the interference of debris in the background of the end face image of the steel bar bundle after the Gamma transformation, and the dark background is eliminated: Where f(x,y) is the end face image of the steel bar bundle after de-impurity, and M is the background elimination threshold; Step 1.5, performing Gaussian filtering on the image of the end face of the steel bar bundle after removing impurities to reduce noise; Step 1.6: Extract a partial image that is identical to the positive template from the end face image of the steel bar bundle pixel by pixel, and calculate the matching degree with each positive template in the positive template library one by one. If there is no positive template in the positive template library, proceed directly to step 1.9; All matching results are output as a two-dimensional matrix, and the matching degree is calculated as follows: Where w and h are the width and height of the positive template, respectively; T(x',y') is the value at coordinate (x',y') of the positive template; I(x,y) is the value at coordinate (x,y) on the preprocessed image; and R(x,y) is the output matrix; where the position of T(x',y') on the positive template is the same as the position of I(x,y) on the preprocessed image; The matching degree in the two-dimensional matrix is compared with the matching threshold C. If it is greater than or equal to the matching threshold C, it is identified as a steel bar end face image, which is recorded as 1. If it is less than the threshold, it is identified as a non-steel bar end face, which is recorded as 0. Finally, the recognition result matrix Flag(x,y) is obtained: Step 1.7, remove duplicate results; set a point in the local graph as the coordinate of the local graph, and calculate the distance between adjacent recognition results H = [(x2-x1) 2 +(y2-y1) 2 ] 0.5 , where x1, x2, y1, and y2 are the horizontal and vertical coordinates of two adjacent recognition results respectively. The steel bar radius R is selected as the judgment threshold. If H is less than R, it is considered a duplicate result and one is discarded. Repeat the judgment action, delete all duplicate results, and output the remaining recognition results as the identification results. Step 1.8: Perform SSIM error correction on each local graph in the recognition result, and calculate the structural similarity between the local graph in the recognition result and each anti-template in the anti-template library. If there is no anti-template in the anti-template library, proceed directly to step 1.
9. where μ x is the mean value of x, μ y is the mean value of y, is the variance of x, is the variance of y, σ xy is the covariance of x and y, c1 = 0.0001L 2 ,c2=0.0009L 2 is a constant used to maintain stability, and L is the dynamic range of pixel values; Compare the calculated SSIM value with the SSIM threshold, delete the results that are greater than or equal to the SSIM threshold, and output the final result; Step 1.9: Determine whether the number of steel bars identified in the final result is correct. If it is correct, select the next image in the training set and repeat steps 1.2 to 1.
9. If it is incorrect, perform manual correction. Cut out the single steel bar end view of the unidentified steel bar and add it to the positive template library. Cut out the error view of the position that is incorrectly identified as steel bar and add it to the negative template library. Then repeat steps 1.7 to 1.9 until all images in the training set are correctly identified. Step 1.10: Repeat steps 1.2 to 1.8 for the rebar bundle end face images in the test set. If the number of rebars in the rebar bundle end face images in the test set is correctly identified, the rebar end face template library is successfully established. If the number of rebars in the rebar bundle end face images in the test set is incorrectly identified, repeat steps 1.1 to 1.10 until the rebar end face template library is successfully established. Step 2: Create a template library for the end face of the steel bar bundle and calculate the translation coefficient, specifically: Step 2.1, collecting end-face images of a plurality of bundled steel bars to establish an end-face image library of the bundled steel bars: manually control the collection lens (15) to align with the center position of the bundled steel bars, and collect the end-face images of the bundled steel bars as a template image of the steel bar bundle, requiring that the image range is close to the upper, lower, left, and right four poles of the steel bar bundle; Step 2.2, calculate the translation coefficient K Where L is the actual distance the acquisition lens (15) moves; Step 3, aligning the end faces of the bundled steel bars; placing the bundled steel bars to be counted on the steel bar conveying mechanism (1), and driving the bundled steel bars to align their end faces through the steel bar conveying mechanism (1), and the last collision is the front collision, so as to ensure that the front ends of the steel bars in the bundled steel bars are located in the same plane when the technical identification is performed, and the steel bar conveying mechanism (1) drives the bundled steel bars forward when rotating forward and collides with the front end face collision baffle (2), and drives the bundled steel bars backward when rotating reversely and collides with the rear end face collision baffle (2); Step 4, the bundled steel bars are transported after being aligned; after the end faces of the bundled steel bars are aligned, the transport mechanism (3) transports the aligned bundled steel bars to the inspection station (4); Step 5, when the bundled steel bars pass through the laser sensor (16) during the transportation process, the laser sensor (16) collects a signal from the bundled steel bars, and transmits the signal to the control console (17). The control console (17) controls the roller shutter motor (8) to operate according to the signal collected by the laser sensor (16), and lowers the blackout curtain (5); Step 6: After the bundle of steel bars is in place and the light-shielding curtain (5) is lowered, the center position of the bundle of steel bars is determined. After the center position of the bundle of steel bars is obtained, the control console (17) controls the position adjustment mechanism (12) to operate so that the acquisition lens (15) is aligned with the center position of the bundle of steel bars; Step 7, turning on the annular spotlight (14), under the illumination of the annular spotlight (14), collecting the end face image of the bundled steel bars through the collection lens (15), uploading the collected end face image to the console (17), and performing recognition processing on the collected end face image to obtain the number of steel bars.
2. The method for identifying and counting steel bar ends according to claim 1, wherein: In step 6, the specific steps of determining the center position of the bundled steel bars are as follows: Collect the end face images of the bundled steel bars and perform template matching between the collected images and the images in the end face image library in step 2. The matching formula is as follows: Among them, w 整捆 and h 整捆 are the width and height of the steel bundle template, T(i',j') is the value at coordinate (i',j') of the steel bundle template, I(i,j) is the value at coordinate (i,j) on the preprocessed image, and R(i,j) is the output matrix; the position of T(i',j') on the steel bundle template is the same as the position of I(i,j) on the preprocessed image; If the matching is successful, that is, R(i,j)≥C1, where C1 is the matching threshold of the entire bundle of steel bars, then the four poles of the upper, lower, left, and right are determined to be u, d, l, and r respectively. The center of the steel bar bundle at this time is center(i,j): If the matching is unsuccessful, the image is recaptured for matching. If the matching is unsuccessful for five consecutive times, the acquisition lens (15) is aligned with the center position of the bundled steel bars, and the image is captured according to the capture requirements of the steel bar bundle template diagram, and the captured image is added to the end face image library, and then the image is recaptured to determine the center position of the bundled steel bars.
3. The method for identifying and counting steel bar ends according to claim 2, wherein: In the step 7, the collected end face image is identified and processed to obtain the number of steel bars, which specifically includes the following steps: Step 7.1, grayscale processing is performed on the collected end face image using the weighted average method; The formula for the weighted average method is: Gray(x,y)=W R ·R(x,y)+W G ·G(x,y)+W B ·B(x,y) Among them, x and y represent the coordinates of each point, Gray(x,y) is the result of weighted grayscale, R(x,y), G(x,y), B(x,y) are the red, green and blue component values of each point, and W R 、W G 、W B is the corresponding weight; Step 7.2, performing Gamma transformation on the grayscale processed end face image of the steel bar bundle; The Gamma function formula is as follows: Among them, Gamma(x,y) is the normalized grayscale image after Gamma transformation, and γ is the correction parameter; In step 7.3, the following calculation formula is used to eliminate the interference of debris in the background of the back-end image after the Gamma transformation, and the background dark area is eliminated: Where f(x,y) is the end face image after de-impurity, and M is the background removal threshold; Step 7.4, performing Gaussian filtering on the end face image after removing impurities to reduce noise; In step 7.5, a partial image identical to the positive template is intercepted pixel by pixel from the end face image of the steel bar bundle, and the matching degree with each positive template in the positive template library is calculated one by one. All matching results are output as a two-dimensional matrix. The matching degree calculation formula is as follows: Where w and h are the width and height of the positive template, respectively; T(x',y') is the value at the coordinate (x',y') of the positive template; I(x,y) is the value at the coordinate (x,y) on the preprocessed image; and R(x,y) is the output matrix. The matching degree in the two-dimensional matrix is compared with the matching threshold C. If it is greater than or equal to the matching threshold C, it is identified as a steel bar end face image, which is recorded as 1. If it is less than the threshold, it is identified as a non-steel bar end face, which is recorded as 0. Finally, the recognition result matrix Flag(x,y) is obtained: Step 7.6, remove duplicate results; set a point in the local graph as the coordinate of the local graph, and calculate the distance between adjacent recognition results H = [(x2-x1) 2 +(y2-y1) 2 ] 0.5 , where x1, x2, y1, and y2 are the horizontal and vertical coordinates of two adjacent recognition results respectively. The steel bar radius R is selected as the judgment threshold. If H is less than R, it is considered a duplicate result and one is discarded. Repeat the judgment action, delete all duplicate results, and output the remaining recognition results as the identification results. Step 7.7, perform SSIM error correction on each local graph in the recognition result, and calculate the structural similarity between the local graph in the recognition result and each anti-template in the anti-template library one by one; where μ x is the mean value of x, μ y is the mean value of y, Yes, the variance, is the variance, σ xy is the covariance of x and y, c1 = 0.0001L 2 ,c2=0.0009L 2 is a constant used to maintain stability, and L is the dynamic range of pixel values; Compare the calculated SSIM value with the SSIM threshold, delete the results that are greater than or equal to the SSIM threshold, and output the final result.
Citation Information
Patent Citations
Counting equipment for bundles of copper tubes based on machine vision and counting method thereof
CN102306277A
Image acquisition device
CN212032163U
Bundled reinforcing steel bar aligning device
CN215591119U