Method and device for visual tracking and shooting of moving targets on a conveyor line at the same speed
By deploying two-degree-of-freedom motion modules and position sensors on the conveyor line to catch up and shoot moving targets at the same speed, it solves the smear and motion blur problems of traditional visual sensors when shooting moving targets, and achieves high-precision detection and measurement. Improved cost performance.
Patent Information
- Application Number
- CN202311513217.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-11-14
AI Technical Summary
In the manufacturing process, traditional manual visual inspection or spot inspection has low efficiency, poor accuracy and high cost. Existing visual sensors are prone to smear and motion blur when shooting moving targets, and high-speed visual sensors are costly and affect production efficiency.
A two-degree-of-freedom motion module is used to deploy the visual sensor, the position sensor is used to trigger the motion module to chase the target object, and the visual sensor is controlled through the target recognition algorithm and PID algorithm to achieve simultaneous shooting, ensuring image clarity and detection accuracy.
It realizes the use of non-high-speed visual sensors for high-precision detection and measurement without disturbing the production rhythm, improves the cost performance, and ensures image quality and clarity of target objects.
Smart Images

Figure CN117750204B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer vision and image processing, and in particular relates to a method and a device for visually tracking and shooting a moving target on a conveyor line at the same speed. Background Art
[0002] In the manufacturing process, there is a general demand for appearance quality inspection or size measurement of products on the conveyor line. The traditional manual visual inspection or random inspection method is not only inefficient, but also has poor accuracy and high labor costs. Using visual sensors can replace manual work and automatically detect and measure moving targets on the conveyor line. However, since the target object is in continuous motion, ordinary visual sensors will produce problems such as smear and motion blur when shooting images, resulting in the inability to accurately detect and measure. There are two existing solutions: 1. According to the position sensor signal, after judging that the target object enters the field of view of the visual sensor, the conveyor line is controlled to stop moving and the image is shot in a static state; although this method can obtain clear and accurate images, it is necessary to change the movement mode of the conveyor line, break the original production rhythm, and affect production efficiency. 2. Use high-speed visual sensors to shoot moving targets. The problem with this method is that the cost of high-speed visual sensors is high. Therefore, it is urgent to develop a new shooting method that uses non-high-speed visual sensors to achieve online shooting of moving targets on the conveyor line without interfering with the original production rhythm. Summary of the invention
[0003] In order to solve the above problems, the present invention proposes a method and device for visually tracking and photographing moving targets on a conveyor line at the same speed.
[0004] The method comprises the following steps:
[0005] Step S1: deploying a two-degree-of-freedom motion module equipped with a visual sensor at an appropriate position of the conveyor line to avoid motion interference between the motion module and the conveyor line, and ensuring that the visual sensor can completely capture the target object arriving below;
[0006] Step S2: Fix the position sensor at an appropriate position of the conveyor line to detect whether the target object moves into the field of view of the visual sensor. When the position sensor detects the target object, a start signal is triggered, and the motion module starts to move in the horizontal direction to catch up with the moving target, and turns on the visual sensor to collect the image of the target object;
[0007] Step S3: Identify the target object in the captured image, obtain the position and speed of the target object, use it as a feedback signal, control the motion module to drive the visual sensor to move horizontally, and achieve target pursuit and same-speed shooting;
[0008] Furthermore, step S3 specifically includes the following steps:
[0009] Step 3-1: using a target recognition algorithm to identify the target object in the captured image, the target recognition algorithm includes but is not limited to YOLO, FasterRCNN based on deep learning algorithms and template matching, feature recognition based on image processing algorithms;
[0010] The coordinates of the center position of the identified target object in the image are (x O ,y O ), the center coordinate of the captured image is (x I ,y I ), x I =W / 2,y I =H / 2, where W and H represent the width and height of the captured image respectively.
[0011] Step 3-2: Calculate the X coordinate difference between the center position of the target object and the center position of the image, e = x O -x I , and use the pre-calibrated proportionality coefficient s x (Unit: mm / pixel), convert the relative coordinate difference e in pixels to the relative position difference E in mm = e×s x ;
[0012] Step 3-3: Use the difference method to calculate the relative speed difference v between the visual sensor and the moving target at the current time k k :
[0013]
[0014] Among them, E k and E k-1 are the relative position differences between the current time k and the previous time k-1, and T is the sampling time interval;
[0015] Step 3-4: Use the PID algorithm to control the horizontal movement of the motion module. The horizontal motion speed control value u at the kth moment k The calculation process is as follows:
[0016]
[0017] Among them, v k and v k-1 are the relative speed differences between the current time k and the previous time k-1, K p , K i , K dThey are proportional gain, integral gain, and differential gain respectively. The three gain coefficients can be obtained through trial and error method, response curve method, critical proportionality method, fuzzy adaptive method, reinforcement learning method, etc.
[0018] The control quantity u k The motor controller of the motion module is inputted cyclically to drive the visual sensor to chase the moving target object;
[0019] Step 3-5: Repeat the above steps 3-1 to 3-4 until the relative position difference E is less than the threshold value M and is maintained for a certain time N. At this time, the visual sensor and the target object are at the same speed, that is, in a relatively stationary state.
[0020] Step S4: According to the target recognition result and the preset target specification data, match and judge the specifications of the target object, then determine the optimal shooting distance corresponding to the target object under the current specifications according to the preset calibration data, control the vertical motion module to drive the visual sensor to adjust the shooting height, then collect images that meet the detection and measurement requirements, complete the detection or measurement of the target, finally, the motion module drives the visual sensor to reset, wait for the next target object to arrive, and repeat steps S3 and S4.
[0021] The visual same-speed tracking and shooting device for moving targets on a conveyor line includes a visual sensor and a position sensor deployed on the conveyor line; wherein the visual sensor is installed on a two-degree-of-freedom motion module for shooting the target object arriving below it, and the position sensor is arranged below the initial position of the visual sensor and on both sides of the conveyor line to detect whether the target object moves into the field of view of the visual sensor.
[0022] The two-degree-of-freedom motion module consists of a horizontal motion module and a vertical motion module. The horizontal motion module is provided with a horizontal motion slide and driven by the horizontal motion module motor. The vertical motion module is provided with a vertical motion slide and driven by the vertical motion module motor. The visual sensor is fixed on the vertical motion slide and can move in the vertical direction with the vertical motion slide. The whole composed of the visual sensor and the vertical motion module is installed on the horizontal motion slide and can move in the horizontal direction with the horizontal motion slide.
[0023] The visual sensor includes but is not limited to an industrial camera and an infrared camera; the position sensor includes but is not limited to a proximity switch and a photoelectric sensor.
[0024] Beneficial effect: By using the principle of relative motion, the visual sensor is driven to move in an accelerated straight line to catch up with the target on the conveyor line at a uniform speed until it catches up with the target, keeps relative stillness with the target and shoots at the same speed. Compared with the existing solutions, this solution has a higher cost-effectiveness. It does not require the use of high-speed and high-performance visual sensors. Only non-high-speed visual sensors can ensure the quality of the collected images and the clarity of the target object imaging, and can complete online high-precision detection and measurement tasks without interfering with the original production rhythm. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of the structure of a two-degree-of-freedom motion module;
[0026] Figure 2 This is a schematic diagram of the deployment position of the two-degree-of-freedom motion module on the conveyor line;
[0027] Figure 3 It is a flow chart of the method involved in the present invention. DETAILED DESCRIPTION
[0028] In order to fully explain the visual same-speed tracking and shooting process of the moving target on the conveyor line of the present invention, the present invention introduces a specific embodiment: visual same-speed tracking and shooting and size measurement of the steel wire head on the conveyor line. The present invention is further described in detail below with reference to the accompanying drawings.
[0029] like Figure 1 As shown, the visual tracking and shooting device for moving targets on the conveyor line of the present invention is based on the hardware foundation in the visual tracking and shooting and dimension measurement embodiment of the steel wire head: the two-degree-of-freedom motion module 1 includes two linear slide motion modules, namely the horizontal motion module 2 and the vertical motion module 3, the visual sensor 4 is fixed on the slide 5 of the vertical motion module 3, and can move along the vertical direction with the slide, and the vertical motion module 3 with the visual sensor 4 is integrally installed on the slide 6 of the horizontal motion module 2, and can move along the horizontal direction with the slide. The visual sensor 4 includes but is not limited to industrial cameras, infrared cameras and other visual acquisition devices for collecting images of moving targets. In the embodiment of the present invention, the visual sensor 4 adopts an industrial camera. The position sensor 8 is arranged below the initial position of the visual sensor 4 and on both sides of the conveyor line to detect whether the target object moves into the field of view of the visual sensor 4. The position sensor 8 includes but is not limited to contact or non-contact sensors such as proximity switches and photoelectric sensors. In the embodiment of the present invention, the position sensor 8 adopts a beam-type photoelectric sensor.
[0030] Based on the above hardware system, the visual same-speed tracking and shooting method of a moving target on a conveyor line of this embodiment includes the following steps:
[0031] Step S1: deploy the two-degree-of-freedom motion module 1 equipped with the visual sensor 4 at an appropriate position of the conveyor line to avoid motion interference between the motion module and the conveyor line, and ensure that the visual sensor 4 can completely capture the target object arriving below. Figure 2 As shown, in the embodiment of the present invention, the two-degree-of-freedom motion module 1 is installed above the conveyor line 7, and the horizontal motion module 2 is parallel to the conveyor line 7.
[0032] Step S2: When the position sensor 8 detects the target object, a start signal is triggered, the motion module 2 starts to move in the horizontal direction to catch up with the moving target, and the visual sensor 4 is turned on to collect the image of the target object.
[0033] The flowchart of the method involved in the present invention is as follows Figure 3 As shown, the following steps are included:
[0034] Step S3: Identify the target object in the captured image, obtain the position and speed of the target object, use it as a feedback signal, control the motion module to drive the visual sensor to move horizontally, and achieve target pursuit and same-speed shooting;
[0035] Furthermore, step S3 specifically includes the following steps:
[0036] Step 3-1: using a target recognition algorithm to identify the target object in the captured image, the target recognition algorithm includes but is not limited to YOLO, FasterRCNN, deep learning-based algorithms, and template matching, feature recognition, and image processing-based algorithms. In the embodiment of the present invention, the YOLOv4-tiny target recognition algorithm is used to realize the recognition of the steel wire head 9;
[0037] The coordinates of the center position of the identified target object in the image are (x O ,y O ), the center coordinate of the captured image is (x I ,y I ), x I =W / 2,y I =H / 2, where W and H represent the width and height of the captured image respectively. In the embodiment of the present invention, the values of W and H are 3072 and 2048 respectively (unit: pixel);
[0038] Step 3-2: Calculate the X coordinate difference between the center position of the target object and the center position of the image, e = x O -x I , and use the pre-calibrated proportionality coefficient s x (Unit: mm / pixel), convert the relative coordinate difference e in pixels to the relative position difference E in mm = e×s x , proportionality coefficient sx It can be obtained by calibration calculation using a chessboard calibration plate with known size;
[0039] Step 3-3: Use the difference method to calculate the relative speed difference v between the visual sensor and the moving target at the current time k k :
[0040]
[0041] Among them, E k and E k-1 are the relative position differences between the current time k and the previous time k-1, T is the sampling time interval, and in the embodiment of the present invention, the sampling time interval T=1 / 17s;
[0042] Step 3-4: Use the PID algorithm to control the horizontal movement of the motion module. The horizontal motion speed control value u at the kth moment k The calculation process is as follows:
[0043]
[0044] Among them, v k and v k-1 are the relative speed differences between the current time k and the previous time k-1, K p , K i , K d They are proportional gain, integral gain, and differential gain respectively. The three gain coefficients can be obtained by trial and error, response curve method, critical proportionality method, fuzzy adaptive method, reinforcement learning method, etc. In the embodiment of the present invention, the gain coefficient is calculated by Actor-Critic adaptive PID algorithm;
[0045] The control quantity u k The motor controller of the cyclic input motion module controls the motor 10 to rotate so as to drive the visual sensor to chase the moving target object;
[0046] Step 3-5: Repeat the above steps 3-1 to 3-4 until the relative position difference E is less than the threshold value M and is maintained for a certain time N. At this time, the visual sensor and the target object are at the same speed, that is, in a relatively static state. In the embodiment of the present invention, M=2mm, N=1s.
[0047] Step S4: According to the target recognition result and the preset target specification data, match and judge the specifications of the target object, then determine the optimal shooting distance corresponding to the target object under the current specifications according to the preset calibration data, and control the vertical motion module to drive the visual sensor to adjust the shooting height. In an embodiment of the present invention, the target object steel wire head includes a variety of diameter specifications such as 28mm, 32mm, 36mm, etc. In order to ensure the accuracy of the size measurement, it is necessary to ensure that the steel wire head is within the depth of field of the industrial camera. In the target recognition stage of step 3-1, the preliminary judgment of the specifications of the steel wire head is completed synchronously, and the optimal shooting distance corresponding to the current specification of the steel wire head is obtained according to the pre-calibrated results. The motor 11 of the vertical motion module rotates to drive the industrial camera to move to the optimal shooting position.
[0048] Next, images that meet the detection and measurement requirements are collected to complete the detection or measurement of the target. In the embodiment of the present invention, the thread pitch diameter, major diameter, pitch and thread angle of the steel wire head need to be measured.
[0049] Finally, the motion module drives the visual sensor to reset, waits for the next target object to arrive, and repeats steps S3 and S4.
Claims
1. A method for visually tracking and photographing a moving target on a conveyor line at the same speed, characterized in that: Using the principle of relative motion, the visual sensor driven by the two-degree-of-freedom motion module accelerates and moves in a straight line to catch up with the target transmitted at a uniform speed on the conveyor line. After catching up with the target, it maintains the same speed as the target and performs relatively static shooting to complete the online detection or measurement task. The method specifically includes the following steps: Step S1: deploying a two-degree-of-freedom motion module equipped with a visual sensor at an appropriate position of the conveyor line to avoid motion interference between the motion module and the conveyor line, and ensuring that the visual sensor can completely capture the target object arriving below; Step S2: Fix the position sensor at an appropriate position of the conveyor line to detect whether the target object moves into the field of view of the visual sensor. When the position sensor detects the target object, a start signal is triggered, and the motion module starts to move in the horizontal direction to catch up with the moving target, and turns on the visual sensor to collect the image of the target object; Step S3: Identify the target object in the image captured by the visual sensor, obtain the position and speed of the target object, use it as a feedback signal, control the motion module to drive the visual sensor to move horizontally, and achieve target pursuit and same-speed shooting; Step S3 specifically includes the following steps: Step 3-1: Use a target recognition algorithm to identify the target object in the captured image. The target recognition algorithm includes a deep learning-based algorithm such as YOLO and FasterRCNN and an image processing-based algorithm such as template matching and feature recognition. The coordinates of the center position of the identified target object in the image are (x O ,y O ), the center coordinate of the captured image is (x I ,y I ), x I =W / 2,y I =H / 2, where W and H represent the width and height of the captured image respectively; Step 3-2: Calculate the X coordinate difference between the center position of the target object and the center position of the image, e = x O -x I , and use the pre-calibrated proportionality coefficient s x ; The proportionality coefficient s x The unit is millimeter / pixel. The relative coordinate difference e in pixels is converted into the relative position difference E in millimeters. x ; Step 3-3: Use the difference method to calculate the relative speed difference v between the visual sensor and the moving target at the current time k k : Among them, E k and E k-1 are the relative position differences between the current time k and the previous time k-1, and T is the sampling time interval; Step 3-4: Use the PID algorithm to control the horizontal movement of the motion module. The horizontal motion speed control value u at the kth moment k The calculation process is as follows: Among them, v k and v k-1 are the relative speed differences between the current time k and the previous time k-1, K p , K i , K d They are proportional gain, integral gain, and differential gain respectively. The three gain coefficients can be obtained by trial and error method, response curve method, critical proportionality method, fuzzy adaptive method, and reinforcement learning method; The control quantity u k The motor controller of the motion module is inputted cyclically to drive the visual sensor to chase the moving target object; Step 3-5: Repeat the above steps 3-1 to 3-4 until the relative position difference E is less than the threshold value M and is maintained for a certain time N. At this time, the visual sensor and the target object have the same speed, that is, a relatively stationary state; Step S4: According to the target recognition result and the preset target specification data, match and judge the specifications of the target object, then determine the optimal shooting distance corresponding to the target object under the current specifications according to the preset calibration data, control the vertical motion module to drive the visual sensor to adjust the shooting height, then collect images that meet the detection and measurement requirements, complete the detection or measurement of the target, and finally, the motion module drives the visual sensor to reset, wait for the next target object to arrive, and repeat steps S3 and S4.
2. A device for visual tracking and shooting of moving targets on a conveyor line according to claim 1, characterized in that: The photographing device comprises a visual sensor (4) and a position sensor (8) arranged on a conveyor line (7); wherein the visual sensor (4) is mounted on a two-degree-of-freedom motion module (1) for photographing a target object (9) arriving below it, and the position sensor (8) is arranged below the initial position of the visual sensor (4) and on both sides of the conveyor line (7) for detecting whether the target object (9) moves into the field of view of the visual sensor (4).
3. The visual same-speed tracking and shooting device for moving targets on a conveyor line according to claim 2 is characterized in that: The two-degree-of-freedom motion module (1) is composed of a horizontal motion module (2) and a vertical motion module (3); the horizontal motion module (2) is provided with a horizontal motion slide (6) driven by a horizontal motion module motor (10); the vertical motion module (3) is provided with a vertical motion slide (5) driven by a vertical motion module motor (11); the visual sensor (4) is fixed on the vertical motion slide (5) and can move in a vertical direction along with the vertical motion slide (5); the visual sensor (4) and the vertical motion module (3) are integrally mounted on the horizontal motion slide (6) and can move in a horizontal direction along with the horizontal motion slide (6).
4. The visual same-speed tracking and shooting device for moving targets on a conveyor line according to claim 2 is characterized in that: The visual sensor (4) includes an industrial camera and an infrared camera; the position sensor (8) includes a proximity switch and a photoelectric sensor.
