Method and device for controlling pan-tilt camera to automatically track target
By obtaining the pixel distance between the target and the center of the picture and the absolute position of the gimbal in the gimbal camera, determining and inputting moving parameters to control the rotation of the gimbal, the real-time tracking problem of dynamic targets in the center of the gimbal camera is solved, and the accuracy and completeness of target detection are improved.
Patent Information
- Application Number
- CN202311198922.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-15
- Publication Date
- 2025-03-18
AI Technical Summary
When shooting dynamic targets, existing gimbal cameras cannot ensure that the target is at the center of the shooting screen in real time, resulting in the accuracy and completeness of target detection that cannot meet the needs.
By obtaining the pixel distance between the target and the center of the screen of the gimbal camera, we determine whether the threshold is exceeded. If it exceeds, we obtain the absolute position of the gimbal camera in the gimbal coordinate system and the rotation angle required when the target is at the center of the screen, determine the movement parameters and enter the absolute movement control function of the gimbal camera, and control the rotation of the gimbal until the target is within the threshold.
It effectively improves the accuracy of the gimbal rotation control, ensures that the target is maximized in the gimbal camera screen, and improves the accuracy of target tracking and detection accuracy.
Smart Images

Figure CN119653240A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pan-tilt camera technology, and in particular to a method and device for controlling a pan-tilt camera to automatically track a target. Background Art
[0002] The pan / tilt is used to adjust the horizontal and pitch angles of the camera mounted on it. After reaching the best working posture, it can be used for photography by locking the adjustment mechanism. The pan / tilt is combined with the camera to form a pan / tilt camera, which is widely used in the field of security monitoring. When monitoring the target within the monitoring range through the pan / tilt camera, the camera must first track the target accurately, that is, the center of the camera screen must be aligned with the target to ensure that the target appears completely in the camera screen while maximizing the target to improve the accuracy. Since the monitored targets include static targets and dynamic targets, static targets are stationary targets, such as "telephone poles", and dynamic targets are targets whose motion state (position, shape, etc.) changes over time, such as "workers wearing safety helmets", when the position of the dynamic target changes and deviates from the center of the camera screen, it will not be possible to ensure that the target appears completely in the camera screen while maximizing the target demand, resulting in a decrease in the accuracy of target tracking, and ultimately a decrease in the accuracy of target detection. Therefore, how to accurately control the camera to track the target and improve the accuracy of the camera's monitoring of the monitored target is the problem. Summary of the invention
[0003] The present invention proposes a method and device for controlling a pan-tilt camera to automatically track a target, so as to solve the problem that when shooting a target, the existing pan-tilt camera cannot ensure that the moving target is in the center of the shooting picture in real time and cannot maximize the target, resulting in the accuracy and completeness of the tracking target detection failing to meet the requirements.
[0004] According to one aspect of the present invention, a method for controlling a pan-tilt camera to automatically track a target is provided, comprising:
[0005] Get the horizontal pixel distance between the target and the center of the gimbal camera screen in the current gimbal camera screen;
[0006] Determine whether the pixel distance exceeds a threshold, if yes, then:
[0007] Get the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen;
[0008] Determine the movement parameters according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen;
[0009] Input the movement parameter into the absolute movement control function of the pan-tilt camera, and call the absolute movement control function to control the pan-tilt rotation;
[0010] The above process is repeated until the pixel distance is within the threshold, and automatic tracking of the target is completed.
[0011] Preferably, the method for determining the movement parameters according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen includes:
[0012] Determine the movement parameters using formula (1);
[0013] θ 目标绝对位置 =θ 云台当前绝对位置 +θ (1);
[0014] Where: θ 目标绝对位置 is the movement parameter, θ is the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen, and θ 云台当前绝对位置 It is the absolute position of the current gimbal camera in the gimbal coordinate system.
[0015] Preferably, before obtaining the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen, determining the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen, the method includes:
[0016] Get the distance between the center of the current gimbal camera and the center of the gimbal, the distance between the target and the center of the current gimbal camera screen, and the distance between the current gimbal camera and the current gimbal camera screen;
[0017] According to the distance between the center of the current gimbal camera and the center of the gimbal, the distance between the target and the center of the current gimbal camera screen, and the distance between the current gimbal camera and the current gimbal camera screen, the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen is determined using formula (2);
[0018]
[0019] Where: r is the distance between the center of the current gimbal camera and the center of the gimbal, a is the distance between the target and the center of the current gimbal camera screen, and b is the distance between the current gimbal camera and the current gimbal camera screen.
[0020] Preferably, before obtaining the distance between the current gimbal camera and the current gimbal camera screen, determining the distance between the current gimbal camera and the current gimbal camera screen, the method includes:
[0021] Get the horizontal field of view angle of the gimbal camera and the width of the gimbal camera shooting screen;
[0022] According to the horizontal field of view of the gimbal camera and the width of the gimbal camera shooting picture, the distance between the current gimbal camera and the current gimbal camera picture is determined using formula (3);
[0023]
[0024] Where: FOV is the horizontal field of view of the gimbal camera, and L is the width of the image captured by the gimbal camera.
[0025] Preferably, the method for controlling the rotation of the pan / tilt platform comprises:
[0026] Determine whether the gimbal oscillates during rotation. If yes, reset the integral and differential terms of the gimbal camera PID to 0, and adjust the movement parameters to obtain adjusted movement parameters.
[0027] If not, adjusting the movement parameter to obtain an adjusted movement parameter;
[0028] The adjusted movement parameters are input into the absolute movement control function of the pan-tilt camera, and the absolute movement control function is called to control the rotation of the pan-tilt.
[0029] Preferably, the method for determining whether the gimbal vibrates during movement includes:
[0030] Determine whether error*integral<0. If so, the gimbal vibrates during movement, where error is the current error and integral is the integral term of the gimbal camera PID.
[0031] Preferably, the method of adjusting the movement parameter to obtain the adjusted movement parameter includes:
[0032] Get the integral term, differential term, proportional coefficient, integral coefficient, differential coefficient and current error of the gimbal camera PID;
[0033] Determining an estimated value according to the integral term, the differential term, the proportional coefficient, the integral coefficient, the differential coefficient and the current error;
[0034] An adjusted movement parameter is determined based on the estimated value.
[0035] Preferably, the method for determining the estimated value according to the integral term, the differential term, the proportional coefficient, the integral coefficient, the differential coefficient and the current error comprises:
[0036] Determine the estimated value using formula (4) according to the integral term, the differential term, the proportional coefficient, the integral coefficient, the differential coefficient and the current error;
[0037] Estimate = (kp*error)+(ki*integral)+(kd*derivative)(4);
[0038] Wherein, kp is the proportional coefficient of the gimbal camera PID, ki is the integral coefficient of the gimbal camera PID, kd is the differential coefficient of the gimbal camera PID, error is the current error, integral is the integral term of the gimbal camera PID, and derivative is the differential term of the gimbal camera PID.
[0039] According to one aspect of the present invention, there is provided a device for controlling a pan-tilt camera to automatically track a target, comprising:
[0040] An acquisition unit is used to acquire the pixel distance in the horizontal direction between the target and the center of the gimbal camera screen in the current gimbal camera screen;
[0041] A judging unit is used to judge whether the pixel distance exceeds a threshold value, and if so:
[0042] Get the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen;
[0043] Determine the movement parameters according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen;
[0044] Used to input the movement parameter into the absolute movement control function of the pan-tilt camera, and call the absolute movement control function to control the rotation of the pan-tilt;
[0045] The target tracking unit is used to repeatedly execute the above units until the pixel distance is within the threshold, thereby completing automatic tracking of the target.
[0046] The present invention has at least the following beneficial effects:
[0047] The present invention proposes a method and device for controlling a pan-tilt camera to automatically track a target. By determining the accurate movement parameters of the pan-tilt rotation in an absolute coordinate system when the target is at the center of the camera image, the technical problem in the prior art of low target detection accuracy caused by the target being out of the center of the camera image is solved, and the accuracy of the pan-tilt rotation control can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present invention and, together with the specification, are used to explain the technical solutions of the present invention.
[0049] Figure 1A flow chart showing a method for controlling a pan-tilt camera to automatically track a target according to an embodiment of the present invention;
[0050] Figure 2 A schematic diagram showing the positions of a gimbal camera and a target object in an absolute coordinate system according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0051] Various exemplary embodiments, features and aspects of the present invention will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0052] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0053] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.
[0054] In addition, in order to better illustrate the present invention, numerous specific details are provided in the following specific embodiments. It should be understood by those skilled in the art that the present invention can be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present invention.
[0055] Figure 1 A flow chart showing a method for controlling a pan-tilt camera to automatically track a target according to an embodiment of the present invention; Figure 2 FIG. 2 is a schematic diagram showing the positions of the pan-tilt camera and the target object in the absolute coordinate system according to an embodiment of the present invention. Figure 1-2As shown, a method for controlling a gimbal camera to automatically track a target includes: step S01: obtaining the pixel distance of the target from the center of the gimbal camera screen in the horizontal direction in the current gimbal camera screen; step S02: judging whether the pixel distance exceeds a threshold value, if yes, then: obtaining the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is in the center of the gimbal camera screen; determining a movement parameter according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is in the center of the gimbal camera screen; inputting the movement parameter into the absolute movement control function of the gimbal camera, calling the absolute movement control function to control the rotation of the gimbal; step S03: repeating the above process until the pixel distance is within the threshold value, and the automatic tracking of the target is completed.
[0056] The method for controlling a pan / tilt camera to automatically track a target provided by an embodiment of the present invention specifically comprises the following steps:
[0057] Step S01: Obtain the pixel distance in the horizontal direction between the target and the center of the gimbal camera screen in the current gimbal camera screen.
[0058] In an embodiment of the present invention, the pixel position of the target in the current gimbal camera image is obtained, and the target pixel position can be determined by calculation through a target detection algorithm; based on the target pixel position, the pixel distance between the target and the center of the current gimbal camera image in the horizontal direction is determined.
[0059] Step S02: Determine whether the pixel distance exceeds a threshold value. If yes, then: obtain the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen.
[0060] In the embodiment of the present invention, the threshold is: the pixel distance between the target and the center of the current gimbal camera screen in the horizontal direction * the predetermined value. If the predetermined value is 0.05, and the pixel distance between the target and the center of the current gimbal camera screen in the horizontal direction is 100, then the threshold = 100 * 0.05 = 5; then the threshold is within the threshold if it is within 5 pixels to the left and right of the center of the current gimbal camera screen in the horizontal direction.
[0061] If the target pixel distance is within the threshold, the integral and differential terms of the PID of the gimbal camera are set to 0 to keep the gimbal camera at the current position; if the target pixel distance exceeds the threshold, the gimbal needs to be controlled to move until the pixel distance between the target and the center of the current gimbal camera screen in the horizontal direction reaches within the threshold.
[0062] The gimbal coordinate system is the absolute coordinate system of the gimbal. The position of the absolute coordinate system is always unchanged. Each time the gimbal camera is started, its position in the absolute coordinate system is uncertain. To calculate the rotation angle of the gimbal camera, you need to first obtain the absolute position of the current gimbal camera in the gimbal absolute coordinate system. The absolute position of the current gimbal camera in the gimbal coordinate system is: the angle value that the gimbal needs to rotate from the starting position of the gimbal camera in the absolute coordinate system to the current gimbal camera position.
[0063] like Figure 2 As shown, in Figure 2 In the figure, the x-axis and y-axis constitute the absolute coordinate system of the gimbal, the solid circle is the gimbal camera, A is the current position of the gimbal camera. At this time, the direction facing the center of the gimbal camera's screen coincides with the y-axis in the gimbal's absolute coordinate system; B is the position of the target, the x-axis is the position of the screen taken by the gimbal camera, and YT is the gimbal.
[0064] In the present invention, before obtaining the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen, determining the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen, the method includes: obtaining the distance between the current gimbal camera center and the gimbal center, the distance between the target and the center of the current gimbal camera screen, and the distance between the current gimbal camera and the current gimbal camera screen; according to the distance between the current gimbal camera center and the gimbal center, the distance between the target and the center of the current gimbal camera screen, and the distance between the current gimbal camera and the current gimbal camera screen, using formula (2), determining the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen;
[0065]
[0066] Where: r is the distance between the center of the current gimbal camera and the center of the gimbal, a is the distance between the target and the center of the current gimbal camera screen, and b is the distance between the current gimbal camera and the current gimbal camera screen.
[0067] In the present invention, before obtaining the distance between the current gimbal camera and the current gimbal camera screen, the distance between the current gimbal camera and the current gimbal camera screen is determined, and the method includes: obtaining the horizontal field angle of the gimbal camera and the width of the gimbal camera shooting screen; according to the horizontal field angle of the gimbal camera and the width of the gimbal camera shooting screen, using formula (3), determining the distance between the current gimbal camera and the current gimbal camera screen;
[0068]
[0069] Where: FOV is the horizontal field of view of the gimbal camera, and L is the width of the image captured by the gimbal camera.
[0070] In the embodiment of the present invention, Figure 2As shown in the figure, the gimbal camera is fixed at the edge of the gimbal, so the distance r between the center of the current gimbal camera and the center of the gimbal YT is actually approximately the radius of the gimbal; because the direction facing the center of the current gimbal camera screen is consistent with the y-axis, the distance between the target and the center of the gimbal camera screen is the distance a between the target B on the x-axis and the y-axis; because the x-axis in the absolute coordinate system is the position of the screen taken by the gimbal camera, the distance between the current gimbal camera position A and the x-axis of the current gimbal camera screen is b.
[0071] exist Figure 2 In the formula (3), FOV is the horizontal field of view of the gimbal camera, and L is the actual width of the image captured by the gimbal camera. Substituting FOV and L into formula (3), the distance b between the image captured by the previous gimbal camera and the image captured by the current gimbal camera is calculated.
[0072] Substitute the distance r between the center of the current gimbal camera and the center of the gimbal, the distance a between the target and the center of the current gimbal camera screen, and the distance b between the current gimbal camera and the current gimbal camera screen into formula (2) to calculate the angle θ that the gimbal current camera A position needs to rotate when the target B is at the center of the gimbal camera screen.
[0073] The formula (2) is determined by Figure 2 The geometric relationship shown can be obtained:
[0074]
[0075] In formula ①:
[0076] After simplifying formula ①, we get:
[0077]
[0078] The quadratic function approximation method is used to solve the problem. Since the actual rotation angle of the gimbal is 0≤θ≤90°, the stochastic gradient descent algorithm in the prior art can be used to solve the problem. When 0≤θ≤90°:
[0079]
[0080] tanθ≈0.5477θ 2 +0.8033θ+0.0133⑤;
[0081] Substituting equations ④ and ⑤ into equation ③, we can get the second equation (2) (θ is a non-negative number, and negative numbers are removed from the result during calculation). According to equation (2), we can get the relationship between θ and a.
[0082] In the present invention, the movement parameters are determined according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen.
[0083] In the present invention, the movement parameter represents the angle value of the absolute position of the gimbal camera in the absolute coordinate system when the target is at the center of the current gimbal camera screen. The required rotation angle θ of the gimbal when the target is at the exact center of the gimbal camera screen calculated in step S02 is the relative angle value of the gimbal camera rotating from the current position A to the target at the center position A' of the screen. This angle value θ cannot be used as a direct input of the gimbal camera; the gimbal needs the absolute coordinates of the gimbal when controlling the camera movement. The absolute coordinate is the absolute angle value from the starting position of the gimbal camera in the absolute coordinate system to the absolute position of the gimbal when the target is at the center of the screen. The absolute angle value is the angular coordinate of the gimbal camera in the absolute coordinate system, that is, the movement parameter.
[0084] In the present invention, the method for determining the movement parameter according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen includes: determining the movement parameter using formula (1);
[0085] θ 目标绝对位置 =θ 云台当前绝对位置 +θ (1);
[0086] Where: θ 目标绝对位置 is the movement parameter, θ is the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen, and θ 云台当前绝对位置 It is the absolute position of the current gimbal camera in the gimbal coordinate system.
[0087] In the embodiment of the present invention, taking the column head as an example, the absolute coordinate system of the column head is based on the angle, from which formula (1) can be obtained.
[0088] exist Figure 2 In the equation, if the current position A of the gimbal camera is the starting position of the gimbal camera in the absolute coordinate system, then the starting position of the gimbal camera in the absolute coordinate system overlaps with the current position of the gimbal camera, then θ 云台当前绝对位置 The value of is 0, and we substitute it into formula (1) to determine θ 目标绝对位置 =0+θ=θ, so the movement parameter of the gimbal camera A is θ. Input the movement parameter value θ into the absolute movement control function of the gimbal, and the gimbal control rotates from the starting position by an angle of θ, so that the gimbal camera rotates from position A to position A', that is, moves to the absolute coordinate position. When the gimbal camera is at position A', the target B is at the center of the gimbal camera screen.
[0089] If the current gimbal camera position is not at point A, but at point A', then when calculating the movement parameters, it is necessary to first determine the angle value of the gimbal camera rotating from the starting position A to the current position A' of the gimbal camera, which is the absolute position θ of the current gimbal camera in the gimbal coordinate system. 云台当前绝对位置 , that is, θ云台当前绝对位置 =θ. If the gimbal camera is to rotate from the current position A' to AA', the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen is θ'. Substituting into formula (1) yields: θ 目标绝对位置 =θ+θ'; the θ+θ' movement parameter value is input into the absolute movement control function, and the gimbal will drive the gimbal camera to rotate from the starting position to the absolute coordinate position after rotating by θ+θ', that is, the AA' position.
[0090] In the present invention, the movement parameters are input into the absolute movement control function of the pan-tilt camera, and the absolute movement control function is called to control the rotation of the pan-tilt.
[0091] In the present invention, the method for controlling the rotation of the gimbal includes: determining whether the gimbal oscillates during the rotation process, if so, resetting the values of the integral term and the differential term of the gimbal camera PID to 0, and adjusting the movement parameters to obtain the adjusted movement parameters; if not, adjusting the movement parameters to obtain the adjusted movement parameters; inputting the adjusted movement parameters into the absolute movement control function of the gimbal camera, and calling the absolute movement control function to control the rotation of the gimbal.
[0092] In the present invention, the method for determining whether the gimbal oscillates during movement includes: determining whether error*integral<0 is established. If so, the gimbal oscillates during movement, wherein error is the current error and integral is the integral term of the gimbal camera PID.
[0093] In the embodiment of the present invention, error represents the pixel distance between the target and the center of the current gimbal camera image in the horizontal direction. If oscillation occurs during the gimbal rotation, the integral term and the differential term are reset to 0 to quickly eliminate the oscillation caused by the PID parameters, and then the movement parameters are adjusted using the PID algorithm.
[0094] If no oscillation occurs during the pan / tilt rotation, the movement parameters are adjusted using the PID algorithm.
[0095] In the present invention, the method of adjusting the movement parameters to obtain the adjusted movement parameters includes: obtaining the integral term, differential term, proportional coefficient, integral coefficient, differential coefficient and current error of the gimbal camera PID; determining an estimated value based on the integral term, differential term, proportional coefficient, integral coefficient, differential coefficient and current error; and determining the adjusted movement parameters based on the estimated value.
[0096] In the present invention, the method for determining the estimated value according to the integral term, the differential term, the proportional coefficient, the integral coefficient, the differential coefficient and the current error comprises: determining the estimated value according to the integral term, the differential term, the proportional coefficient, the integral coefficient, the differential coefficient and the current error using formula (4);
[0097] Estimate = (kp*error)+(ki*integral)+(kd*derivative)(4);
[0098] Wherein, kp is the proportional coefficient of the gimbal camera PID, ki is the integral coefficient of the gimbal camera PID, kd is the differential coefficient of the gimbal camera PID, error is the current error, integral is the integral term of the gimbal camera PID, and derivative is the differential term of the gimbal camera PID.
[0099] In an embodiment of the present invention, the proportional coefficient is the proportional value itself; the integral term is a cumulative value, which is initially 0. Before each estimated value is calculated, the current integral term is obtained by adding the current error to the previous integral term; the differential term is initially 0. Before each estimated value is calculated, the current differential term value is obtained by subtracting the previous error from the current error.
[0100] The method for determining the adjusted movement parameter according to the estimated value is as follows: the estimated value is substituted for the parameter a in the above formula (2), and after the substitution, the adjusted θ value is calculated according to the above formula (2); and then the adjusted θ value is substituted into the above formula (1) to calculate the adjusted θ 目标绝对位置 (Move Parameters).
[0101] When the target deviates from the center of the current gimbal camera screen, the PID algorithm is used to calculate the angle value θ that the gimbal needs to rotate 目标绝对位置 Perform adjustment and correction to obtain the adjusted θ 目标绝对位置 , avoiding the adjustment of the angle value θ 目标绝对位置 The existing deviation can effectively improve the accuracy of gimbal rotation.
[0102] Step S05: Repeat the above process until the pixel distance is within the threshold, and the automatic tracking of the target is completed.
[0103] In the embodiment of the present invention, after the gimbal completes the rotation according to the movement parameters, step S01 is executed again in a loop to determine whether the target is within a threshold range from the center of the gimbal camera screen after the rotation. If so, the gimbal camera captures the target screen that meets the requirements. If not, step S02 needs to be continued to be executed so that the center of the gimbal camera screen can always accurately and timely track and capture the target.
[0104] It can be understood that the above-mentioned various method embodiments mentioned in the present invention can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present invention will not go into details.
[0105] The execution subject of the method for controlling the pan-tilt camera to automatically track the target may be a device for controlling the pan-tilt camera to automatically track the target. For example, the method for controlling the pan-tilt camera to automatically track the target may be executed by a terminal device or a server or other processing device, wherein the terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the method for controlling the pan-tilt camera to automatically track the target may be implemented by a processor calling a computer-readable instruction stored in a memory.
[0106] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0107] The present invention also provides a device for controlling a gimbal camera to automatically track a target, comprising: an acquisition unit, used to acquire the pixel distance in the horizontal direction between the target and the center of the gimbal camera screen in the current gimbal camera screen; a judgment unit, used to judge whether the pixel distance exceeds a threshold value, and if so, then: acquiring the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is in the center of the gimbal camera screen; determining movement parameters according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is in the center of the gimbal camera screen; inputting the movement parameters into the absolute movement control function of the gimbal camera, and calling the absolute movement control function to control the rotation of the gimbal; a target tracking unit, used to repeatedly execute the above units until the pixel distance is within the threshold value, thereby completing automatic tracking of the target.
[0108] In some embodiments, the functions or modules and units included in the device provided by the embodiment of the present invention can be used to execute the method described in the above method embodiment. Its specific implementation can refer to the description of the above method embodiment. For the sake of brevity, it will not be repeated here.
[0109] The present invention obtains the pixel position of the target in the current pan-tilt camera screen, calculates the pixel distance between the target and the center of the current pan-tilt camera screen in the horizontal direction; when the pixel distance does not reach the threshold, that is, when the target deviates from the center of the current pan-tilt camera screen, the pan-tilt required rotation angle when the target is in the center of the pan-tilt camera screen is first calculated, and then the movement parameters are calculated, and the pan-tilt is controlled to drive the camera to rotate according to the movement parameters. When the target deviates from the center of the current pan-tilt camera screen, the present invention first calculates the angle value that the pan-tilt needs to rotate, that is, the movement parameters, and then uses the PID algorithm to adjust and correct the angle value, thereby avoiding the deviation of the angle value before adjustment, and effectively improving the accuracy of the pan-tilt rotation. Then repeat steps S01 to S02 until the pixel distance reaches the threshold. By performing such a "step-by-step judgment, step-by-step rotation" reciprocating cycle until the target is located in the center of the current gimbal camera screen, it is possible to ensure that the target appears completely in the camera screen while maximizing the target, thereby improving the accuracy of target tracking in subsequent applications, and ultimately improving the accuracy of target detection. It can be seen that the method provided by the present invention can effectively solve the technical problem in the prior art of low target detection accuracy caused by the target being out of the center of the camera screen.
[0110] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for controlling a pan-tilt camera to automatically track a target, characterized in that: include: Get the horizontal pixel distance between the target and the center of the gimbal camera screen in the current gimbal camera screen; Determine whether the pixel distance exceeds a threshold, if yes, then: Get the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen; Determine the movement parameters according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen; Input the movement parameter into the absolute movement control function of the pan-tilt camera, and call the absolute movement control function to control the pan-tilt rotation; The above process is repeated until the pixel distance is within the threshold, and automatic tracking of the target is completed.
2. The method for controlling a pan-tilt camera to automatically track a target according to claim 1, characterized in that: The method for determining the movement parameters according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen includes: Determine the movement parameters using formula (1); i 目标绝对位置 =θ 云台当前绝对位置 +θ (1); Where: θ 目标绝对位置 is the movement parameter, θ is the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen, and θ 云台当前绝对位置 It is the absolute position of the current gimbal camera in the gimbal coordinate system.
3. The method for controlling a pan-tilt camera to automatically track a target according to claim 1, characterized in that: Before obtaining the required rotation angle of the pan-tilt when the target is at the center of the pan-tilt camera screen, determining the required rotation angle of the pan-tilt when the target is at the center of the pan-tilt camera screen, the method includes: Get the distance between the center of the current gimbal camera and the center of the gimbal, the distance between the target and the center of the current gimbal camera screen, and the distance between the current gimbal camera and the current gimbal camera screen; According to the distance between the center of the current gimbal camera and the center of the gimbal, the distance between the target and the center of the current gimbal camera screen, and the distance between the current gimbal camera and the current gimbal camera screen, the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen is determined using formula (2); Where: r is the distance between the center of the current gimbal camera and the center of the gimbal, a is the distance between the target and the center of the current gimbal camera screen, and b is the distance between the current gimbal camera and the current gimbal camera screen.
4. The method for controlling a pan-tilt camera to automatically track a target according to claim 3, characterized in that: Before obtaining the distance between the current gimbal camera and the current gimbal camera screen, determining the distance between the current gimbal camera and the current gimbal camera screen, the method includes: Get the horizontal field of view angle of the gimbal camera and the width of the gimbal camera shooting screen; According to the horizontal field of view of the gimbal camera and the width of the gimbal camera shooting picture, the distance between the current gimbal camera and the current gimbal camera picture is determined using formula (3); Where: FOV is the horizontal field of view of the gimbal camera, and L is the width of the picture taken by the gimbal camera.
5. The method for controlling a pan-tilt camera to automatically track a target according to claim 1, characterized in that: The method for controlling the rotation of the pan / tilt platform comprises: Determine whether the gimbal oscillates during rotation. If yes, reset the integral and differential terms of the gimbal camera PID to 0, and adjust the movement parameters to obtain adjusted movement parameters. If not, adjusting the movement parameter to obtain an adjusted movement parameter; The adjusted movement parameters are input into the absolute movement control function of the pan-tilt camera, and the absolute movement control function is called to control the rotation of the pan-tilt.
6. The method for controlling a pan-tilt camera to automatically track a target according to claim 5, characterized in that: The method for determining whether the gimbal oscillates during movement includes: Determine whether error*integral<0. If so, the gimbal vibrates during movement, where error is the current error and integral is the integral term of the gimbal camera PID.
7. The method for controlling a pan-tilt camera to automatically track a target according to claim 5, characterized in that: The method of adjusting the movement parameter to obtain the adjusted movement parameter includes: Get the integral term, differential term, proportional coefficient, integral coefficient, differential coefficient and current error of the gimbal camera PID; Determining an estimated value according to the integral term, the differential term, the proportional coefficient, the integral coefficient, the differential coefficient and the current error; An adjusted movement parameter is determined based on the estimated value.
8. The method for controlling a pan-tilt camera to automatically track a target according to claim 7, characterized in that: The method for determining the estimated value according to the integral term, the differential term, the proportional coefficient, the integral coefficient, the differential coefficient and the current error includes: Determine the estimated value using formula (4) according to the integral term, the differential term, the proportional coefficient, the integral coefficient, the differential coefficient and the current error; Estimate = (kp*error)+(ki*integral)+(kd*derivative)(4); Wherein, kp is the proportional coefficient of the gimbal camera PID, ki is the integral coefficient of the gimbal camera PID, kd is the differential coefficient of the gimbal camera PID, error is the current error, integral is the integral term of the gimbal camera PID, and derivative is the differential term of the gimbal camera PID.
9. A device for controlling a pan-tilt camera to automatically track a target, characterized in that: include: An acquisition unit is used to acquire the pixel distance in the horizontal direction between the target and the center of the gimbal camera screen in the current gimbal camera screen; A judging unit is used to judge whether the pixel distance exceeds a threshold value, and if so: Get the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen; Determine the movement parameters according to the absolute position of the current gimbal camera in the gimbal coordinate system and the required rotation angle of the gimbal when the target is at the center of the gimbal camera screen; Used to input the movement parameter into the absolute movement control function of the pan-tilt camera, and call the absolute movement control function to control the rotation of the pan-tilt; The target tracking unit is used to repeatedly execute the above units until the pixel distance is within the threshold, thereby completing automatic tracking of the target.
Citation Information
Cited By
Automatic tracking shooting method, device and storage medium for fixed scoring area movement
CN120321492B
Automatic tracking shooting method and device, equipment and storage medium
CN120835204A