Method for monocular dynamic tracking based on projective geometry
By employing projection geometry and motor control methods, 3D reconstruction and dynamic tracking under a monocular device were achieved, solving the problems of complex operation and high cost in existing technologies, improving the efficiency and accuracy of 3D reconstruction, and making it suitable for real-time tracking of supervised robots and moving objects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2026-03-24
AI Technical Summary
Existing 3D reconstruction methods are cumbersome to operate, costly, and their algorithm efficiency cannot meet the requirements. Monocular vision systems also face difficulties in dynamic tracking.
The method of achieving monocular dynamic tracking based on projection geometry obtains intrinsic parameters and distortion coefficients by calibrating the viewfinder, adjusts the position of the viewfinder by combining motor control, and calculates the three-dimensional coordinates and performs dynamic tracking using the optimal observation sphere.
Achieving 3D reconstruction using a monocular device simplifies operation, reduces costs, improves algorithm efficiency, and increases accuracy. It is suitable for supervising robot express sorting and real-time tracking of moving objects.
Smart Images

Figure CN115578415B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of projection geometry, the field of monocular machine vision and the field of automatic control principle, and particularly relates to a method for realizing monocular dynamic tracking based on projection geometry. BACKGROUND
[0002] When taking a picture using a viewing device, a series of images can be obtained. Through these images, two-dimensional image information of an object can be obtained, but three-dimensional coordinate information, speed information and size information of the object cannot be obtained, and most information can be calculated according to the coordinate information. In order to obtain the three-dimensional coordinate information, the two-dimensional coordinates of the object must be restored to the corresponding three-dimensional coordinates, that is, three-dimensional reconstruction. Three-dimensional reconstruction needs to convert three-dimensional space into two-dimensional space by means of a viewing device, and analyze the mathematical relationship between three-dimensional object points and two-dimensional image points.
[0003] There are several ways to reconstruct three-dimensional information as follows:
[0004] I. A calibrator is placed in a monitoring scene, and the corresponding relationship between a two-dimensional image and a three-dimensional object is determined by analyzing and processing an image containing the calibrator taken. Since it is required to place the calibrator in each monitoring scene and the calibrator must be placed in a suitable position, the operation is relatively troublesome.
[0005] II. More information is obtained by arranging multiple viewing devices in a scene. Since the cost of multiple viewing devices is high, it is not conducive to large-scale use.
[0006] III. According to some specific methods such as volume, three-dimensional point cloud, etc., three-dimensional coordinates are recovered or a mapping matrix of two spaces is found by means of numerous parameters.
[0007] The three-dimensional reconstruction technology commonly used in the industrial field includes positioning and pose, dense reconstruction, surface reconstruction and texture mapping, etc.
[0008] Monocular depth estimation is an important part of three-dimensional reconstruction. Since 2017, many neural networks for monocular depth estimation have been proposed.
[0009] In the aspect of automatic control, motors or servos are often used, and length or angle conversion is performed according to pulses.
[0010] In the aspect of dynamic tracking, a feasible solution is a multi-AGV cooperative dynamic tracking method and equipment. A cooperative dynamic tracking device is arranged inside an automatic guided vehicle (AGV), but it is not suitable for a monocular vision system.
[0011] As can be seen from the above, the current three-dimensional reconstruction method has problems such as troublesome operation, high cost and algorithm efficiency that cannot meet the demand. SUMMARY
[0012] The present application aims at the deficiencies of the prior art, and provides a method for realizing monocular dynamic tracking based on projection geometry, which first reconstructs three-dimensional information according to a two-dimensional image, and then performs monocular depth estimation according to the area estimation of the object in the image, and then dynamically adjusts the position of the shooting device according to the three-dimensional information.
[0013] In order to solve the above technical problems, the technical scheme of the present application is as follows:
[0014] A method for realizing monocular dynamic tracking based on projection geometry, comprising the following steps:
[0015] S1, calibrating the shooting device to obtain an internal parameter matrix and distortion coefficients;
[0016] S2, determining the position parameters of the shooting device in the process of shooting the two-dimensional image of the object, the position parameters of the shooting device including three-dimensional coordinate information of the shooting device and angle information for controlling the rotation of the motor on the shooting device;
[0017] S3, determining the distance between the shooting device and the point in the two-dimensional image;
[0018] S4, obtaining the coordinates of the object in the two-dimensional image coordinate system, the origin of the two-dimensional image coordinate system being the geometric center of the two-dimensional image;
[0019] S5, determining the optimal observation sphere, obtaining the optimal observation circle through the optimal observation sphere, and calculating the radius of the optimal observation circle, the optimal observation circle being a spherical surface intersected by the plane where the shooting device is located;
[0020] S6, calculating the overhead coordinates of the center of the observation sphere;
[0021] S7, obtaining the three-dimensional coordinates of the object according to the overhead coordinates;
[0022] S8, adjusting the position of the shooting device according to the three-dimensional coordinates of the object to realize dynamic tracking, with the goal of minimizing the moving distance.
[0023] As a preferred, the step S1 comprises the following sub-steps:
[0024] S1-1, printing a checkerboard as a calibration object when calibrating;
[0025] S1-2, determining an optimal observation distance according to the parameters of the shooting device, the parameters including focal length and image distance;
[0026] S1-3, obtaining different photos, extracting the corner points from the photos, estimating the internal parameters under ideal non-distortion conditions, and establishing an internal parameter matrix;
[0027] S1-4, estimating the actually existing distortion coefficient by using the least square method.
[0028] As preferred, in the step S1-4, the actually existing distortion coefficient is estimated by using the maximum likelihood method.
[0029] As preferred, in the step S2, two motors are arranged on the framing device, both of which are servo motors, and are used to control the rotation of the elevation angle and the horizontal angle of the framing device.
[0030] The step S2 comprises the following sub-steps:
[0031] S2-1, resetting the motors on the framing device, selecting a direction as the positive direction, and setting the position array of the framing device to zero;
[0032] S2-2, recording the pulse signals returned by the servo motors in real time during the movement of the framing device, and performing addition and subtraction operations on the position array according to the direction signals, so as to reflect the relative attitude of the two motors when the position is reset in real time;
[0033] S2-3, after the resetting is completed, waiting, and calculating the horizontal movement distance, the elevation angle and the horizontal angle of the bottom two directions by using the image algorithm;
[0034] S2-4, obtaining the position parameters of the framing device in the process of shooting the two-dimensional image of the object according to the horizontal movement distance, the elevation angle and the horizontal angle.
[0035] As preferred, the step S4 comprises the following sub-steps:
[0036] S4-1, identifying the target object to obtain the boundary rectangle of the contour of the target object;
[0037] S4-2, calculating the geometric center of the rectangle by using the vertex coordinates of the boundary rectangle, and considering that the coordinates are the coordinates of the target object in the two-dimensional image.
[0038] As preferred, in the step S4-1, the identification method of the target object is:
[0039] S4-1-1, using the opencv library to call the camera of the framing device and input the two-dimensional image;
[0040] S4-1-2, using the cvtColor function to convert the image to the HSV space, creating an object detector of a specific object, and finding the range of the three values of H, S and V of the target object theme color.
[0041] S4-1-3, using the previously obtained HSV parameters, using the cvtColor function to convert the image to the corresponding HSV space of the target object;
[0042] S4-1-4, a Gaussian blur is added by using a GaussianBlur function, a Canny edge is detected by using a Canny function, and the image is preprocessed by dilating the edge by using a dilate function;
[0043] S4-1-5, contours are extracted from the preprocessed image by using a findContours function, contourArea functions are used to remove some contours with small areas, and a boundingRect function is used to pass in the object contour to obtain the bounding rectangle of the object contour.
[0044] Preferably, the optimal observation sphere is a sphere with the object as the center and the optimal observation distance as the radius.
[0045] Preferably, the parameters for position adjustment of the viewfinder device include the change amount of the translation distance of the viewfinder device on the x-axis and the y-axis, and the change amount of the pitch angle and the horizontal rotation angle of the viewfinder device.
[0046] Preferably, the adjustment method of the viewfinder device is as follows:
[0047] Let the gear number of the motor be N1, the gear number of the viewfinder device be N2, and the radius of the motor gear on the two horizontal axes be r. First, the motion direction of the motor is determined according to the positive and negative of the data. Second, the angle that the motor should rotate is calculated, Finally, the angle that the motor needs to rotate to control the horizontal movement of the viewfinder device is calculated where θ v is the pitch angle of the motor operation, and θ h is the horizontal angle of the motor operation.
[0048] Preferably, in the dynamic tracking in step S8, a short time is set as a time period, and an interrupt is set. The angle that the viewfinder device needs to move in the next time period is calculated at each interrupt, the angle is multiplied by the number of pulses required for the motor to rotate one round, the number of pulses that the motor needs to move in the next time period is calculated, and the motor is controlled to move according to the number of pulses.
[0049] The present application has the following characteristics and advantages:
[0050] By using the above technical solution, three-dimensional reconstruction is performed on the premise of using one viewfinder device, and two-dimensional coordinates in the image are restored to three-dimensional coordinates in the world coordinate system. Only one viewfinder device is used, and no additional auxiliary devices such as viewfinder devices or calibrators are needed, so the operation is simple, and the equipment cost is reduced. Fewer parameters are used, only the internal parameters of the viewfinder device and the spatial coordinate information are used, and thus the algorithm efficiency is greatly improved.
[0051] The control scheme of the decision is optimized, the position of the viewing device is adjusted, the precision is effectively improved, and the error is reduced by taking the minimum translation distance as the optimization target.
[0052] The method improves the efficiency of the original method in the case of using a monocular camera. BRIEF DESCRIPTION OF DRAWINGS
[0053] Figure 1 is the pitch angle of the viewing device h SCHEMATIC VIEW.
[0054] Figure 2 is the horizontal rotation angle of the viewing device v SCHEMATIC VIEW.
[0055] Figure 3 is a schematic view of the three-dimensional coordinates (x0, y0, z0) of the viewing device in the world coordinate system.
[0056] Fig. 4(1), Fig. 4(2) is a schematic view of the distance between the viewing device and the two-dimensional image.
[0057] Figure 5 is a schematic view of the object coordinates in the two-dimensional image.
[0058] Figure 6 is a schematic view of the observation sphere.
[0059] Figure 7 is a schematic view of the observation circle.
[0060] Figure 8 is a schematic view of the observation sphere center top-down coordinates.
[0061] Fig. 9(1) and Fig. 9(2) are schematic views of the sphere center top-down coordinate calculation.
[0062] Figure 10 is a schematic view of the sphere center Z-axis coordinate calculation.
[0063] Figure 11 is a schematic view of the viewing device movement direction. DETAILED DESCRIPTION
[0064] The application will be further described below in conjunction with the drawings and examples.
[0065] It should be noted that the embodiments in the application and the features in the embodiments can be combined with each other without conflict.
[0066] The embodiment provides a monocular dynamic tracking method based on projection geometry, and the specific method is as follows:
[0067] Step one: calibrate the viewing device: obtain the internal parameter matrix and distortion coefficient.
[0068] When calibrating, first print a checkerboard as a calibration object, adjust the direction of the calibration object or the viewing device, take different photos, and then extract the corner points from the photos to estimate the internal parameters under ideal non-distortion conditions.
[0069] Apply the least squares method to estimate the actual existing distortion coefficient, and then use the maximum likelihood method to optimize the estimation and improve the estimation accuracy.
[0070] There are many existing tools for calibrating auxiliary viewing devices, and the viewing device calibration can be realized with the help of opencv or matlab platform.
[0071] According to the parameters (focal length f, image distance v) of the viewing device, an optimal observation distance L0 is determined.
[0072] The determination method is as follows
[0073] Manually adjust the distance between objects in the viewing device, observe the position and size of the objects in the image, and determine the optimal observation distance according to the actual needs.
[0074] If the objects are replaced, the optimal observation distance can be scaled in proportion to the size relationship of the objects. The purpose of doing this is to facilitate application. The optimal observation distance can be set according to different application scenarios, such as close observation and distant observation.
[0075] Step two: determine the position parameters (x0, y0, z0, θ h , θ v ) of the viewing device during the shooting of the two-dimensional image (as shown in Figure 1 , Figure 2 , Figure 3 ).
[0076] The three-dimensional coordinate information of the viewing device can be directly measured. The angle information is calculated according to the pulse information generated by the motor rotation. Since two angles need to be calculated, two motors are needed in total, and the specific implementation method is as follows.
[0077] First, run the reset function, and after the motor is reset, select a direction (clockwise or counterclockwise) as the positive direction, and set the position array to zero.
[0078] During the movement of the viewing device, the pulse signals returned by the servo motor are recorded in real time, and the position array is added or subtracted according to the direction signal, so that it can reflect the relative attitude of the two motors relative to the reset position in real time.
[0079] After the reset, standby, waiting for the host computer image algorithm to give data: the bottom two horizontal movement distance d1, d2, pitch angle θ v And horizontal angle θ h , then the data processing:
[0080] Step three: determine the distance L of the viewing device and the midpoint of the two-dimensional image (the length of the black line in the middle). Figure 2
[0081] Most of the existing viewing device has the function of automatic focusing, that is, it can ensure that the main body in the picture is on the focal plane. According to the imaging principle of the viewing device, the formula holds, where the focal length has been calculated in calibration, and the image distance is one of the internal parameters of the viewing device, so it can also be obtained in calibration. The object distance L can be calculated.
[0082] Step four: get the coordinates (x, y) of the object in the two-dimensional image (the origin of the two-dimensional coordinate system is the geometric center of the two-dimensional image. As shown in Figure 3 ).
[0083] First, object recognition is needed, and the specific steps are as follows:
[0084] Use opencv library, call the camera and input two-dimensional image.
[0085] Convert the image to HSV space using the cvtcolor function, create an object detector for a specific object, and find the range of target object theme color H, S, and V values.
[0086] Identify the target object. First, use the previously obtained HSV parameters to convert the image to the corresponding HSV space of the target object using the cvtcolor function.
[0087] Before detecting the shape, pre-process the picture: add Gaussian blur using the GaussianBlur function, detect Canny edge using the Canny function, and dilate the edge using the dilate function.
[0088] On the pre-processed image, use the findContours function to extract the contour from the image, and then use the contourArea function to remove some small contours (noise). Use the boundingRect function to input the target object contour to get the bounding rectangle of the target object contour. Through the vertex coordinates of the bounding rectangle, the geometric center of the rectangle is calculated, which is considered as the coordinates of the target object in the two-dimensional image.
[0089] Finally, image correction is performed by removing distortion. The opencv library is called, and the undistort function is used to input the image containing distortion, the internal parameter matrix of the imaging device, and the distortion coefficient matrix of the imaging device, and the image after removing distortion is returned.
[0090] Step five: determine the optimal observation sphere, obtain the optimal observation circle through the optimal observation sphere, and calculate the radius of the optimal observation circle, the optimal observation circle being a circular surface intersected by the plane in which the imaging device is located;
[0091] As shown in Figure 6 , the optimal observation sphere is a sphere with object C as the center and the optimal observation distance L0 as the radius.
[0092] In FIG. 4(2), the object is at C, and the length of the black line AB is L. The height difference between points A and C is ycosθ v , and the height difference between point A and the plane in which the imaging device is located is Lsinθ v . Therefore, the height of the object relative to the plane in which the imaging device is located is H=Lsinθ v +ycosθ v . Point A is the image center, and B is the imaging device.
[0093] It can be further deduced that the observation circle, i.e., the plane intersecting the observation sphere in which the imaging device is located, has a radius of As shown in Figure 7 , A is the image center, and the radius of the projection is equal to the square root of the square of AB minus the square of H, which is the vertical projection of the AB segment.
[0094] It should be noted that in this embodiment, the imaging device is a fixed-focus device, and it is clearest at the focal distance, so the radius of the optimal observation circle is calculated based on the focal length of the imaging device.
[0095] Step six: calculate the overhead coordinates of the observation sphere center. The overhead coordinates of the observation sphere center C are calculated. This coordinate is also considered as the projection of the object on the horizontal plane in which the imaging device is located. The specific calculation method is as follows:
[0096] The overhead coordinates of the sphere center are shown in Figure 8 , A is the image center, and B is the position of the imaging device.
[0097] As shown in FIG. 9, A is the image center, B is the imaging device, C is the position of the object, the vertical plane of the imaging device and the line connecting the image center is shown in the figure, and the projection of the object point C on the plane in which the imaging device point B is located is point E. The coordinates of point E are to be calculated.
[0098] The entire coordinate calculation is divided into three segments:
[0099] The first segment is the coordinate of the viewing device; the second segment is the coordinate of the image center in the projection of the viewing device, i.e. the coordinate of point F in the coordinate system with point B as the origin, where F is the final position of B after movement; the third segment is the coordinate of the object in the projection of the viewing device, i.e. the coordinate of point E in the coordinate system with point F as the origin.
[0100] The first segment is the coordinate of the viewing device, which is (x0, y0);
[0101] The second segment is the offset of the image center from the coordinate of the viewing device, as shown in Fig. 9, i.e. the offset of point F from point B, where the length of BF is the length of AB multiplied by the cosine of the vertical rotation angle, i.e. Lcosθ v Therefore, the coordinate of point F in the coordinate system with point B as the origin is (Lcosθ v cosθ h , Lcosθ v sinθ h ).
[0102] The third segment is the offset of the object in the image from the coordinate of the image center, i.e. the offset of point E from point F. Because the movement of the viewing device is limited, the x-axis of the image coordinate system is not parallel to the x-axis of the plane on which the viewing device is located, and the x-axis of the image coordinate system is parallel to the plane on which the viewing device is located. In the image plane, the coordinate of the object is (x, y), and the coordinate of point E relative to point F is (ysinθ v sinθ h +xcosθ h , ysinθ v cosθ h -xsinθ h .
[0103] Further, the top-down coordinate is (x c , y c ) = (x0+(Lcosθ v -ysinθ v )sinθ h +xcosθ h , y0+(Lcosθ v -ysinθ v )cosθ h -xsinθ h ).
[0104] The Z-axis coordinate of the object is calculated in two segments. The first segment is the distance of the object from the plane on which the viewing device is located, i.e. the distance of point E from the plane on which the viewing device is located, which is Lcosθ Figure 8As shown, segment EC), the second segment is the height Z0 of the plane where the viewfinder is located. The final Z-axis coordinate is Z0+H.
[0105] In summary, the three-dimensional coordinates of the object are (x0 + (Lcosθ)). v -ysinθ v sinθ h +xcosθ h y0+(Lcosθ v -ysinθ v cosθ h -xsinθ h Z0+Lsinθ v +ycosθ v ).
[0106] Once the object's three-dimensional coordinates are known, the position of the viewfinder needs to be further adjusted to achieve dynamic tracking.
[0107] The parametric equation of the observation circle can be written based on the coordinates of its center and radius. Here, α is essentially equal to the target's horizontal rotation angle.
[0108] At this point, we can write the following system of equations.
[0109] Considering that rotation offers higher precision and lower error than translation, minimizing the translation distance is the optimization objective when adjusting the viewfinder position. Therefore, the optimization objective is...
[0110] Based on the optimization objective, the parameters can be solved.
[0111] Further, we can determine the changes in translation distance along the x and y axes, as well as the changes in the pitch and horizontal rotation angles of the viewfinder.
[0112] like Figure 10 The object's position is B, and its projection onto the plane of the viewfinder is C, corresponding to the top-view coordinates of the sphere's center (x, y). c y c The line connecting the viewfinder to the top-down coordinate system intersects the observation circle at point E. Point E is the target point for the viewfinder's movement.
[0113] Based on the above parameters, adjust the position of the viewfinder. Let the number of motor gears be N1, the number of viewfinder gears be N2, and the radius of the motor gears on the two horizontal axes be r. First, determine the direction of motor movement based on the sign of the data; then calculate the angle the motor should rotate. Finally, the angle of rotation required for the motor controlling the horizontal movement of the viewfinder was calculated.
[0114] Set a short time interval as a time period and set an interrupt. At each interruption, calculate the angle that the framing device needs to move in the next time period. Then multiply the angle by the number of pulses required for the motor to rotate one revolution to calculate the number of pulses the motor needs to move in the next time period. Control the motor movement based on the number of pulses.
[0115] To achieve dynamic tracking, parameters need to be adjusted in real time. Therefore, the viewfinder may not always reach the previous target position before moving to the next target position. Thus, the position information of the viewfinder needs to be returned in real time.
[0116] During the movement of the viewfinder, the pulse signals returned by the servo motors are recorded in real time. The position array is then added to or subtracted based on the direction signals to reflect the relative attitude of the two motors from their reset positions. Simultaneously, the camera's actual attitude is returned in real time based on position coordinates. For the pitch and horizontal angles, the number of pulses *n* recorded in the position array is divided by the number of pulses *n0* required for one rotation of the motor to calculate the rotation angle. This angle is then multiplied by the ratio of the number of gears on the motor to the number of gears on the viewfinder to calculate the rotation angle of the viewfinder. For the two horizontal axes at the bottom, their rotation angles are first calculated based on the number of pulses. Then according to Calculate the horizontal movement distance. Finally, return the data for use in the next calculation of the optimal observation sphere, etc.
[0117] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions, and variations can be made to these embodiments, including components, without departing from the principles and spirit of the present invention, and these variations still fall within the protection scope of the present invention.
Claims
1. A method for monocular dynamic tracking based on projection geometry, characterized in that, Includes the following steps: S1. Calibrate the viewfinder to obtain the intrinsic parameter matrix and distortion coefficients; S2. Determine the position parameters of the viewfinder during the process of capturing a two-dimensional image of an object. The position parameters of the viewfinder include the three-dimensional coordinate information of the viewfinder and the angle information used to control the rotation of the motor on the viewfinder. S3. Determine the distance between the viewfinder and the midpoint of the two-dimensional image; S4. Obtain the coordinates of the object in the two-dimensional image coordinate system, wherein the origin of the two-dimensional image coordinate system is the geometric center of the two-dimensional image; S5. Determine the optimal observation sphere, obtain the optimal observation circle through the optimal observation sphere, and calculate the radius of the optimal observation circle. The optimal observation circle is the circular surface intercepted by the plane where the viewfinder is located. The optimal observation sphere is a sphere with the object as its center and the optimal observation distance as its radius. S6. Calculate the top-view coordinates of the center of the observed sphere. The top-view coordinates of the center of the observed sphere are: ; in, , The coordinates of the viewfinder; , These are the object's coordinates; , These are the pitch and horizontal angles of the viewfinder during the capture of a two-dimensional image; The distance between the viewfinder and a point in the two-dimensional image; S7. Obtain the object's three-dimensional coordinates from the top-view coordinates. The object's three-dimensional coordinates are: ; in, The height of the plane where the viewfinder is located; S8. Based on the object's three-dimensional coordinates, adjust the position of the viewfinder to achieve dynamic tracking with the goal of minimizing the movement distance; The parameters used for adjusting the position of the viewfinder include the changes in the translation distance of the viewfinder along the x-axis and y-axis, as well as the changes in the pitch angle and horizontal rotation angle of the viewfinder. The adjustment method for the framing device is as follows: Let the number of motor gears be... The number of gears in the framing device is The radius of the motor gears on the two horizontal shafts is First, determine the direction of the motor's movement based on the sign of the data; second, calculate the angle the motor should rotate. Finally, the angle of rotation required for the motor controlling the horizontal movement of the viewfinder was calculated. ,in and are the changes in translation distance along the x-axis and y-axis, respectively.
2. The method for monocular dynamic tracking based on projection geometry according to claim 1, characterized in that, Step S1 includes the following sub-steps: S1-1. When calibrating, first print a chessboard pattern as a calibration object; S1-2. Based on the parameters of the viewfinder, including focal length and image distance, determine an optimal observation distance; S1-3. Obtain different photos, extract corner points from the photos, estimate the intrinsic parameters under ideal distortion-free conditions, and establish the intrinsic parameter matrix. S1-4. Use the least squares method to estimate the actual distortion coefficients.
3. The method for monocular dynamic tracking based on projection geometry according to claim 2, characterized in that, In steps S1-4, the actual distortion coefficients are estimated and optimized using the maximum likelihood method.
4. The method for monocular dynamic tracking based on projection geometry according to claim 2, characterized in that, In step S2, the viewfinder is equipped with two motors, both of which are servo motors, which control the tilt and horizontal rotation of the viewfinder, respectively. Step S2 includes the following sub-steps: S2-1. Reset the motor on the viewfinder, select a direction as the positive direction, and set the position array of the viewfinder to zero; S2-2. During the movement of the framing device, the pulse signal returned by the servo motor is recorded in real time, and the position array is added or subtracted according to the direction signal, so as to reflect the relative posture of the two motors when they are in the reset position in real time. S2-3. After the reset is complete, the system is in standby mode. The horizontal movement distance, pitch angle, and horizontal angle in the two bottom directions are calculated using an image algorithm. S2-4. Obtain the position parameters of the viewfinder device during the process of capturing a two-dimensional image of the object based on the horizontal movement distance, pitch angle, and horizontal angle.
5. The method for monocular dynamic tracking based on projection geometry according to claim 4, characterized in that, Step S4 includes the following sub-steps: S4-1. Identify the target object and obtain the boundary rectangle of the target object's outline; S4-2. Calculate the geometric center of the rectangle using the coordinates of the vertices of the boundary rectangle. It is approximated that these coordinates are the coordinates of the target object in the two-dimensional image.
6. The method for monocular dynamic tracking based on projection geometry according to claim 5, characterized in that, In step S4-1, the method for identifying the target object is as follows: S4-1-1. Use the OpenCV library to retrieve the 2D image from the viewfinder's camera. S4-1-2. Use the cvtColor function to convert the image to HSV color space, create an object detector for a specific object, and find the range of the target object's subject color values (H, S, V). S4-1-3. Using the previously obtained HSV parameters, use the cvtColor function to convert the image to the corresponding HSV space of the target object. S4-1-4. Use the GaussianBlur function to add Gaussian blur, use the Canny function to detect Canny edges, and use the dilate function to expand the edges to preprocess the image. S4-1-5. On the preprocessed image, use the findContours function to extract contours from the image, then use the contourArea function to remove some small contours, and use the boundingRect function to pass in the contour of the target object to obtain the bounding rectangle of the target object contour.
7. The method for monocular dynamic tracking based on projection geometry according to claim 1, characterized in that, In step S8, during dynamic tracking, a relatively short time period needs to be set as a time cycle, and an interruption needs to be set. At each interruption, the angle that the framing device needs to move in the next time cycle is calculated. Then, the angle is multiplied by the number of pulses required for the motor to rotate one revolution to calculate the number of pulses the motor needs to move in the next time cycle. The motor movement is controlled according to the number of pulses.
Citation Information
Patent Citations
Method for tracking target position in moving object by using monocular camera
CN111833379A
Object attitude tracking method and device, terminal equipment and storage medium
CN113298870A