Pan / tilt control method, device and robot equipment
By determining the speed parameter according to the detection frame offset in the target image in the pan/tilt control system and controlling the movement of the pan/tilt, the problems of unstable motion and jitter in the existing pan/tilt control system are solved, and the effect of target tracking is improved. User experience.
Patent Information
- Application Number
- CN202110120789.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-28
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-01-28
AI Technical Summary
The existing gimbal control system has motion instability and jitter when quickly tracking targets, which affects the user experience and makes it difficult to achieve fast and smooth target tracking.
By obtaining the detection frame in the target image, if the detection frame is not in the center of the image, the first speed parameter is determined based on the offset of the detection frame in the set direction, and the movement of the pan/tilt is controlled based on this speed parameter to achieve flexible control and Improve target tracking performance.
It achieves flexible control of the gimbal, improves the target tracking effect and the smoothness of user interaction, reduces the jitter of the gimbal movement, and enhances the accuracy of target tracking.
Smart Images

Figure CN114815912B
Abstract
Description
Technical Field
[0001] The present application relates to the field of robotics technology, and in particular to a pan / tilt control method, device and robotic equipment. Background Art
[0002] Many service robot devices are equipped with a gimbal on their heads. When the head image sensor detects a target object, such as a face, the gimbal can act as a follow-up system to track the movement of the face. The robustness of this system has a direct impact on the user experience. How to quickly and smoothly control the movement of the gimbal to improve the target tracking effect is a problem that must be solved. Summary of the invention
[0003] The present application aims to solve one of the technical problems in the related art at least to some extent.
[0004] To this end, the first purpose of the present application is to propose a pan-tilt control method to achieve flexible control of the pan-tilt to improve the target tracking effect.
[0005] The second objective of the present application is to provide a pan / tilt control device.
[0006] The third object of the present application is to provide a robot device.
[0007] A fourth object of the present application is to provide a non-transitory computer-readable storage medium.
[0008] A fifth object of the present application is to provide a computer program product.
[0009] To achieve the above-mentioned purpose, the first embodiment of the present application proposes a pan / tilt control method, comprising:
[0010] Obtaining a detection frame of a target object in a target image; wherein the target image is collected by an image sensor carried by the gimbal;
[0011] If the detection frame is not in the central area of the image, determining a first speed parameter in the set direction according to an offset of the detection frame relative to the center of the image in the set direction;
[0012] The movement of the pan / tilt platform is controlled according to the first speed parameter in the set direction.
[0013] To achieve the above-mentioned purpose, the second embodiment of the present application proposes a pan / tilt control device, comprising:
[0014] An acquisition module, used to acquire a detection frame of a target object in a target image; wherein the target image is acquired by an image sensor carried by the gimbal;
[0015] a determination module, configured to determine a first speed parameter in the set direction according to an offset of the detection frame relative to the center of the image in the set direction if the detection frame is not in the central area of the image;
[0016] A control module is used to control the movement of the pan / tilt platform according to the first speed parameter in the set direction.
[0017] To achieve the above-mentioned purpose, the third aspect embodiment of the present application proposes an electronic device, including a gimbal and an image sensor carried by the gimbal, the robot device also includes a memory, a processor, and a computer program stored in the memory and executable on the processor, when the processor executes the program, the gimbal control method as described in the first aspect is implemented.
[0018] In order to achieve the above-mentioned objectives, the fourth aspect of the present application proposes a non-temporary computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the pan-tilt control method as described in the first aspect is implemented.
[0019] In order to achieve the above-mentioned purpose, the fifth aspect of the present application proposes a computer program product. When the instructions in the computer program product are executed by a processor, the pan-tilt control method as described in the first aspect is implemented.
[0020] The technical solution provided by the embodiment of the present application has the following beneficial effects:
[0021] A detection frame of a target object in a target image is obtained. The target image is collected by an image sensor carried by the gimbal. If the detection frame is not in the central area of the image, a first speed parameter in the set direction is determined according to an offset of the detection frame in the set direction relative to the center of the image. According to the first speed parameter in the set direction, the movement of the gimbal is controlled. In this embodiment, a corresponding first speed parameter is determined according to an offset of the detection frame in the set direction relative to the center of the image. According to the first speed parameter, the gimbal is controlled to move in the set direction, thereby realizing flexible control of the gimbal to improve the effect of target tracking.
[0022] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0024] Figure 1 A flowchart of a pan / tilt control method provided in an embodiment of the present application;
[0025] Figure 2 A flowchart of another pan / tilt control method provided in an embodiment of the present application;
[0026] Figure 3 A flowchart of another pan / tilt control method provided in an embodiment of the present application;
[0027] Figure 4 A schematic diagram of determining a speed parameter of a gimbal provided in an embodiment of the present application;
[0028] Figure 5 A flowchart of another pan / tilt control method provided in an embodiment of the present application;
[0029] Figure 6 A block diagram of a pan / tilt control algorithm used in an embodiment of the present application;
[0030] Figure 7 A schematic diagram of the linear least squares method provided in an embodiment of the present application;
[0031] Figure 8 A schematic diagram of the structure of a pan / tilt control device provided in an embodiment of the present application;
[0032] Fig. 9 A block diagram of an exemplary electronic device suitable for implementing the embodiments of the present application is shown. DETAILED DESCRIPTION
[0033] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0034] The following describes the pan-tilt control method, device and robot equipment of the embodiments of the present application with reference to the accompanying drawings.
[0035] Figure 1 A flowchart of a pan / tilt control method provided in an embodiment of the present application.
[0036] like Figure 1 As shown, the method comprises the following steps:
[0037] Step 101, obtaining a detection frame of a target object in a target image, wherein the target image is collected by an image sensor carried by a gimbal.
[0038] The gimbal is a carrier device for installing and fixing an image sensor. The gimbal is set in an electronic device, such as a robot device. The gimbal moves in a set direction according to the received control signal, for example, in the horizontal and / or vertical direction, to drive the image sensor carried by the gimbal to move, thereby realizing automatic tracking of the target and improving the effect of interaction with the user.
[0039] Among them, determining the detection frame of the target object can be achieved through the following two implementation methods:
[0040] As a possible implementation method, the target image captured by the image sensor carried by the gimbal is input into a target recognition model, wherein the target recognition model has learned the correspondence between the target object and the corresponding detection frame, and the detection frame of the target object in the target image is determined according to the target recognition model.
[0041] As another possible implementation method, the target object in the target image is tracked to obtain a candidate frame in the target image, and the position of the target object in the target image is predicted based on the detection frames of the target object in multiple historically acquired images to obtain a prediction frame in the target image, and the detection frame of the target object in the target image is determined based on the difference between the prediction frame and the candidate frame. In this embodiment, the detection frame of the target object in the target image is determined as a prediction frame or a candidate frame based on historical data, which can avoid the problem of large detection frame error caused by detection frame jumps when directly using the target tracking algorithm, thereby improving the accuracy of determining the detection frame of the target object.
[0042] Step 102: If the detection frame is not in the central area of the image, a first speed parameter in the set direction is determined according to the offset of the detection frame relative to the center of the image in the set direction.
[0043] In this embodiment, the detection frame is not in the central area of the image, specifically, the center of the detection frame is not in the central area of the image, and the offset of the detection frame relative to the center of the image in a set direction may specifically be the distance from the center of the detection frame to the center of the image in the set direction.
[0044] The center area of the image is the area at a set distance from the center of the image, for example, the set distance is [-0.15, 0.15] in the horizontal direction and [-0.12, 0.12] in the vertical direction. When the detection frame is in the center area of the image, it means that the offset of the detection frame relative to the center of the image in the set direction is less than the set threshold, and there is no need to control the gimbal movement to adjust the position of the detection frame in the image, so as to avoid jitter caused by small disturbances to the gimbal adjustment.
[0045] In this embodiment, the detection frame is not in the central area of the image, so the offset of the detection frame relative to the image center in the set direction may be large or small. In the case where the size of the offset needs to be quickly determined, the first speed parameter in the set direction is determined based on the size of the offset, and then, according to the first speed parameter, the gimbal movement is controlled to track the target, thereby improving the interaction effect.
[0046] Step 103, controlling the movement of the pan / tilt head according to the first speed parameter in the set direction.
[0047] In this embodiment, the movement of the gimbal is controlled according to the first speed parameter in the set direction, thereby achieving flexible control of the gimbal, so that the target object remains in the central area of the image captured by the image sensor, so as to smoothly track the target object.
[0048] In the gimbal control method of the present embodiment, a detection frame of a target object in a target image is obtained, and the target image is collected by an image sensor carried by the gimbal. If the detection frame is not in the central area of the image, a first speed parameter in the set direction is determined according to an offset of the detection frame in the set direction relative to the center of the image, and the movement of the gimbal is controlled according to the first speed parameter in the set direction. In the present embodiment, a corresponding first speed parameter is determined according to an offset of the detection frame in the set direction relative to the center of the image, and the movement of the gimbal is controlled in the set direction according to the first speed parameter, thereby realizing flexible control of the gimbal.
[0049] The above embodiment describes that according to the offset of the detection frame relative to the image center in the set direction, the first speed parameter in the set direction is determined, and then the pan / tilt movement is controlled according to the first speed parameter. Two implementation methods are described below.
[0050] Based on the above embodiment, this embodiment provides a possible implementation method. In order to quickly adjust the position of the detection frame in the image, a first speed parameter in a set direction is determined, and the gimbal is controlled to move at the first speed parameter, such as Figure 2 As shown, the method comprises the following steps:
[0051] Step 201 , obtaining a detection frame of a target object in a target image, wherein the target image is collected by an image sensor carried by a gimbal.
[0052] Step 202, if the detection frame is not in the central area of the image, it is determined that the offset of the detection frame relative to the image center in the set direction is greater than the offset threshold, then the first speed parameter in the set direction is determined based on the product between the offset and the set first coefficient, and then step 204 is entered.
[0053] In one implementation of the present embodiment, if the offset of the detection frame relative to the image center in the set direction is greater than an offset threshold, where the offset threshold may be pre-set, then a first speed parameter in the set direction is determined based on the product of the offset and a set first coefficient, thereby achieving a method in which, based on the offset threshold, it is determined that when the offset of the detection frame relative to the image center in the set direction is greater than the offset threshold, the first speed parameter of the gimbal in the set direction can be determined, and the gimbal is controlled to move at the first speed parameter in the set direction, so that the gimbal quickly follows the target object to move.
[0054] For example, the first coefficient is set to kff, the first speed parameter is Vcmd0, and the offset is dv, then the first speed parameter Vcmd0=kff*dv.
[0055] Step 203 , if the detection frame is not in the central area of the image, it is determined that the offset of the detection frame relative to the image center in the set direction is less than or equal to the offset threshold, then it is determined that the value of the first speed parameter in the set direction is zero, and the process proceeds to step 204 .
[0056] In another implementation of this embodiment, if the offset of the detection frame relative to the image center in the set direction is less than or equal to the offset threshold, it is determined that the value of the first speed parameter in the set direction is zero.
[0057] Step 204, controlling the gimbal to move in a set direction at a first speed parameter.
[0058] In the gimbal control method of the present embodiment, it is determined that the acquired detection frame is not in the central area of the image. If it is determined that the offset of the detection frame relative to the image center in the set direction is greater than the offset threshold, the first speed parameter in the set direction is determined according to the product between the offset and the set first coefficient, and the gimbal is controlled to move with the first speed parameter, so that it is determined based on the offset threshold that the detection frame deviates greatly from the image center area, so that the gimbal movement can be controlled according to the calculated first speed parameter, and the large offset of the detection frame relative to the image center in the set direction can be quickly corrected, that is, the gimbal is made to quickly follow the target object to move, and focus following can be achieved; if it is determined that the offset of the detection frame relative to the image center in the set direction is less than or equal to the offset threshold, it is determined that the first speed parameter in the set direction is zero, and according to the first speed parameter with a value of zero, the gimbal is controlled to move with the first speed parameter, that is, the gimbal is controlled not to move.
[0059] Based on the previous embodiment, this embodiment provides another implementation method, which explains that in order to improve the accuracy of gimbal control, a target speed parameter is determined according to a first speed parameter, and the gimbal is controlled to move in a set direction at the target speed parameter. Figure 3A flowchart of another pan / tilt control method provided in an embodiment of the present application.
[0060] like Figure 3 As shown, the method comprises the following steps:
[0061] Step 301, obtaining a detection frame of a target object in a target image, wherein the target image is collected by an image sensor carried by a gimbal.
[0062] Step 302, if the detection frame is not in the central area of the image, it is determined that the offset of the detection frame relative to the image center in the set direction is greater than the offset threshold, then the first speed parameter in the set direction is determined based on the product between the offset and the set first coefficient, and the process proceeds to step 304.
[0063] Step 303, if the detection frame is not in the central area of the image, it is determined that the offset of the detection frame relative to the image center in the set direction is less than or equal to the offset threshold, then it is determined that the first speed parameter in the set direction is zero, and the process proceeds to step 304.
[0064] Step 304: Determine a target speed parameter according to the first speed parameter.
[0065] The target speed parameter is the sum of at least one of the second speed parameter and the third speed parameter and the first speed parameter. The second speed parameter is determined based on the product of the offset and the set second coefficient; the third speed parameter is determined based on the offset of the detection frame in the multiple historically collected images relative to the image center in the set direction.
[0066] In this embodiment, it is determined that the detection frame is not in the center area of the image. Figure 4 As shown, Figure 4 In the figure, the setting direction is the vertical direction Y direction, and the first speed parameter, the second speed parameter and the third speed parameter are determined by the feedforward link, the proportional link and the integral link respectively. The implementation principle of the horizontal direction is the same as that of the vertical direction, and will not be repeated in this embodiment.
[0067] like Figure 4 As shown, the target speed parameter is the sum of the second speed parameter, the third speed parameter and the first speed parameter. Among them, the first speed parameter Vcmd0 is determined by the feedforward link, wherein the feedforward link predetermines the offset threshold used to determine the offset size, and is used to quickly determine whether the offset of the detection frame relative to the image center in the vertical direction is greater than the offset threshold. The second speed parameter Vcmd1 is determined by the proportional link, and the third speed parameter Vcmd2 is determined by the integral link.
[0068] In one scenario, if the offset is greater than the offset threshold, it is determined that the detection frame is offset from the image center by a large amount, and the first speed parameter is determined to be a non-zero value, wherein the first speed parameter Vcmd0=kff*dv. As a possible implementation method, in this embodiment, the second speed parameter determined by the proportional link and the third speed parameter determined by the integral link are added to the non-zero first speed parameter to determine the target speed parameter; as another possible implementation method, the second speed parameter determined by the proportional link is added to the non-zero first speed parameter to determine the target speed parameter; as another possible implementation method, the third speed parameter determined by the integral link is added to the non-zero first speed parameter to determine the target speed parameter, and then the gimbal is controlled to move at the target speed parameter to quickly correct the offset of the detection frame relative to the image center in the vertical direction, that is, to make the gimbal quickly follow the movement of the target.
[0069] In another scenario, if it is determined that the offset is less than or equal to the offset threshold, the first speed parameter takes a value of zero, that is, Vcmd0=0. In this case, in order to improve the tracking effect of the gimbal on the target object, it is necessary to control the movement of the gimbal to fine-tune the position of the detection frame in the image. Therefore, as a first implementation method, the second speed parameter determined by the proportional link and the third speed parameter determined by the integral link are added to the first speed parameter taking a value of zero to determine the target speed parameter; as a second implementation method, the second speed parameter determined by the proportional link is added to the first speed parameter taking a value of zero to determine the target speed parameter; as a third possible implementation method, the third speed parameter determined by the integral link is added to the first speed parameter taking a value of zero to determine the target speed parameter, and then the gimbal is controlled to move at the target speed parameter to achieve fine-tuning of the gimbal for fine control.
[0070] The second speed parameter is determined according to the product of the offset and the set second coefficient, wherein the second coefficient is pre-set and is recorded as Kp. The second speed parameter Vcmd1 = Kp*dv
[0071] The third speed parameter is determined by determining the total offset according to the offset of the detection frame in the multiple historically collected images relative to the image center in the set direction, and by multiplying the total offset by the set third coefficient. Figure 4As shown, dv is the offset of the detection frame relative to the image center in the set direction, and the cached dv data of the latest 300ms, that is, the offset of the detection frame in multiple historically collected images relative to the image center in the set direction, wherein [t(N-1), dv(N-1)] is the offset dv(N-1) of the detection frame in the historically collected image of t(N-1) seconds relative to the image center in the set direction, and N is a natural number greater than or equal to 1. Further, the total offset Sum(N)=dv(0)+dv(1)+…+dv(N-1) is determined, and the third speed parameter Vcmd2=Ki*Sum(N).
[0072] Step 305, controlling the gimbal to move in a set direction at a target speed parameter.
[0073] In this embodiment, the target speed parameter is determined based on the first speed parameter and the sum of at least one of the second speed parameter and the third speed parameter, which satisfies the control of the gimbal movement in different scenarios, so that the position of the detection frame can be accurately adjusted based on the movement of the gimbal.
[0074] In the gimbal control method of this embodiment, when the detection frame is not in the central area of the image, the gimbal is controlled to move in the set direction at the target speed parameter according to the offset of the detection frame relative to the center of the image in the set direction and the target speed parameter determined according to the sum of the first speed parameter and at least one of the second speed parameter and the third speed parameter, so that when the offset is greater than the offset threshold, the gimbal can be quickly adjusted to follow the movement of the target, and when the offset is greater than the set threshold, although the offset may be small, the gimbal can still be fine-tuned.
[0075] Based on the above embodiment, this embodiment provides a possible implementation method. Before the above step 305, the following steps may also be included:
[0076] Correct the target speed parameters according to the target distance;
[0077] The target distance is the distance between the image sensor and the target object.
[0078] In this embodiment, in one scenario, if the target object is far away from the image sensor, the target speed parameter is corrected according to the target distance, so that the gimbal is controlled to move quickly according to the corrected target speed parameter to avoid loss of target object tracking; in another scenario, if the target object is close to the image sensor, the target speed parameter is corrected according to the target distance, so that the gimbal is controlled to move slowly according to the corrected target speed parameter to facilitate interaction with the target object and improve the interaction effect.
[0079] As an implementation method, a distance index is set, for example, the distance index is 0.1, and a distance correction coefficient is determined according to the target distance and the distance index, wherein the farther the target distance is, the larger the value of the distance correction coefficient is. For example, distance correction coefficient = target distance * distance index, and then, the target speed parameter is multiplied by the distance correction coefficient to obtain a corrected target speed parameter, and then the gimbal movement is controlled according to the corrected target speed parameter, thereby improving the reliability of motion control.
[0080] Based on the above embodiments, this embodiment provides a possible implementation method. Figure 5 A flow chart of another pan / tilt control method provided in an embodiment of the present application is shown as follows: Figure 5 As shown, steps 101, 201 and 301 include the following steps:
[0081] Step 501 : Track a target object in a target image to obtain a candidate frame in the target image.
[0082] In this embodiment, based on the target tracking algorithm, the target object is tracked in the target image, and the target object detected by tracking is marked by a rectangular frame to obtain a candidate frame in the target image. Figure 6 As shown, the target object is a target face, and the face candidate box is represented by (x, y, w, h), where (x, y) is the coordinate position of the upper left vertex of the rectangular box corresponding to the candidate box in the pixel coordinate system, and (w, h) is the size of the rectangular box corresponding to the candidate box, where w is the width and h is the height.
[0083] It should be noted that in the face tracking scenario, a face tracking visual algorithm is used to determine that there is only one candidate frame in the target image.
[0084] Step 502 , predicting the position of the target object in the target image according to the detection frames of the target object in the plurality of historically collected images, so as to obtain a prediction frame in the target image.
[0085] Since the candidate box has jump errors and noise problems when the target tracking algorithm determines the candidate box, in order to solve the jump errors and noise problems of the candidate box determined during target tracking, in this embodiment, the position of the target object is predicted based on the detection boxes of the target object in multiple historically collected images to obtain the prediction box in the target image, wherein the prediction box includes the position and size of the prediction box in the image.
[0086] Step 503: Determine a detection frame of the target object in the target image according to the difference between the predicted frame and the candidate frame.
[0087] In this embodiment, to determine the detection frame of the target object in the target image, it is necessary to determine the coordinate position and size of the detection frame in the target image.
[0088] As a possible implementation, a pre-filter is set, such as Figure 6 As shown, based on the candidate frame of the target face and the predicted frame of the target face determined based on historical data, the corresponding positions and sizes are filtered to determine the position and size of the detection frame of the target face.
[0089] In this embodiment, how to determine the coordinate position and size of the detection frame of the target face in the target image is described respectively.
[0090] Among them, the position (x_new, y_new) of the detection frame of the target face in the target image is determined. Since the coordinates x_new and y_new respectively indicate the position of the detection frame in the set direction, the determination method is the same. In this embodiment, the determination of the position y_new in the set direction Y direction is taken as an example for explanation.
[0091] In one implementation of this embodiment, data of detection frames in multiple historically acquired images are obtained. For example, the coordinate data of the detection frames in each historically acquired image in the most recent 300 milliseconds are cached and expressed as [t(0), y1(0)], [t(1), y1(1)], [t(2), y1(2)], ..., [t(N-1), y1(N-1)], and normalized. Then, in the Y direction, the coordinate positions of the detection frames in the N historically acquired images in the filter queue are fitted using the linear least squares method to determine the coordinate position y of the prediction frame in the target image determined based on the N historically acquired images in the set direction. 预 ,like Figure 7 As shown, in the Y direction, the intercept b of the fitting result is taken as the position of the prediction box of the target face at the current moment, expressed as y 预=b. Further, the difference between the position of the candidate frame in the target image in the Y direction and the position of the predicted frame in the target image obtained based on the historical data prediction in the Y direction is compared with a first threshold, wherein, as an implementation method, the first threshold is determined according to the standard deviation of the coordinate position of the detection frame in a set direction in a plurality of historically collected images. For example, the standard deviation vy of the coordinate position of the detection frame in the Y direction in N historically collected images is calculated, and the first threshold is set to 3 times the standard deviation, that is, the first threshold is 3vy. If it is determined that the position difference in the Y direction is less than the first threshold, it means that the candidate frame of the target face in the target image determined based on face tracking has not jumped, then in the set direction Y direction, the value of the coordinate position y of the candidate frame is used as the value of the coordinate position y_new of the detection frame. If it is determined that the position difference in the Y direction is greater than the first threshold, it means that the candidate frame of the target face in the target image determined based on face tracking has jumped, then in the set direction Y direction, the coordinate position y of the predicted frame is used as the value of the coordinate position y_new of the detection frame. 预 As the coordinate position y_new of the detection frame. Similarly, the coordinate position x_new of the detection frame of the target face can be determined in the set direction X.
[0092] Among them, the size (w_new, h_new) of the detection frame of the target face in the target image is determined. Since w_new and h_new respectively indicate the sizes of the detection frame of the target face in the set directions X and Y, the determination method is the same. In this embodiment, the determination of the size h_new in the set direction Y is taken as an example for explanation.
[0093] In one implementation of this embodiment, data of detection frames in multiple historically acquired images are obtained. For example, the size data of the detection frames in the Y direction in each historically acquired image in the most recent 300 milliseconds are cached and expressed as [t(0), h1(0)], [t(1), h1(1)], [t(2), h1(2)], ..., [t(N-1), h1(N-1)], respectively, and normalized. Then, the average value h of the size of the detection frames in the N historically acquired images in the filter queue in the Y direction is determined. a, as the size of the prediction box of the target face in the target image determined based on the N historical collected images in the set direction. Further, the difference between the size of the prediction box of the target face in the target image in the Y direction and the size of the candidate box of the target face in the target image in the Y direction is compared with the second threshold, wherein, as an implementation, the second threshold is determined according to the coordinate position of the detection box of the target face in the target image in the set direction, that is, the farther the detection box is from the central area in the target image, the greater the possibility of jump. For example, the coordinate position of the determined detection box in the Y direction is y_new, the filter threshold is set to 0.2, and the second threshold is 0.2*y_new; or, the coordinate position of the determined detection box in the X direction is x_new, the filter threshold is set to 0.2, and the second threshold is 0.2*x_new. If it is determined that the size difference in the Y direction is less than the second threshold, it means that the candidate box of the target face in the target image determined based on face tracking has not jumped, and the size of the candidate box in the Y direction is used as the size of the detection box. Similarly, the size w_new of the detection frame in the set direction X can be determined. If it is determined that the size difference in the Y direction is greater than or equal to the second threshold, it means that the candidate frame of the target face in the target image determined based on face tracking has jumped, and the size of the prediction frame in the set direction is used as the size of the detection frame. Similarly, the size w_new of the detection frame in the set direction X can be determined.
[0094] Thus, the detection frame of the target image is determined to be (x_new, y_new, w_new, h_new), such as Figure 6 As shown, the detection frame (x_new, y_new, w_new, h_new) of the determined target face is shown, in the field of view of the camera carried by the gimbal, that is, the coordinate position and size in the captured image.
[0095] In the present embodiment, the target object in the target image is tracked to obtain a candidate frame in the target image, the position of the target object in the target image is predicted based on the detection frames of the target object in multiple historically acquired images to obtain a prediction frame in the target image, and the detection frame of the target object in the target image is determined based on the difference between the prediction frame and the candidate frame. The position of the detection frame of the target image is determined based on the acquired candidate frame and detection frame using a set filter to remove large jumps, and the size of the detection frame of the target image is determined based on the set filter to remove jitter caused by noise, thereby improving the accuracy of determining the position and size of the detection frame in the target image.
[0096] In order to implement the above embodiments, the present application also proposes a pan / tilt control device.
[0097] Figure 8A schematic diagram of the structure of a pan / tilt control device provided in an embodiment of the present application.
[0098] like Figure 8 As shown, the device includes: an acquisition module 61, a determination module 62 and a control module 63.
[0099] The acquisition module 61 is used to acquire a detection frame of a target object in a target image; wherein the target image is acquired by an image sensor carried by the gimbal.
[0100] The determination module 62 is used to determine a first speed parameter in a set direction according to an offset of the detection frame relative to the center of the image in the set direction if the detection frame is not in the center area of the image.
[0101] The control module 63 is used to control the movement of the pan / tilt platform according to the first speed parameter in a set direction.
[0102] Further, in a possible implementation of the embodiment of the present application, the determination module 62 is specifically configured to:
[0103] If the offset of the detection frame relative to the image center in the set direction is greater than an offset threshold, the first speed parameter in the set direction is determined according to the product of the offset and the set first coefficient; if the offset of the detection frame relative to the image center in the set direction is less than or equal to the offset threshold, the first speed parameter in the set direction is determined to be zero.
[0104] In a possible implementation of the embodiment of the present application, the control module 63 includes:
[0105] The first determination unit is used to determine a target speed parameter based on the first speed parameter; wherein the target speed parameter is the sum of at least one of a second speed parameter and a third speed parameter and the first speed parameter; the second speed parameter is determined based on the product of the offset and a set second coefficient; the third speed parameter is determined based on the offset of the detection frame in a plurality of historically acquired images relative to the center of the image in the set direction.
[0106] A control unit is used to control the pan / tilt platform to move in the set direction at the target speed parameter.
[0107] In a possible implementation of the embodiment of the present application, the determination module 62 is specifically configured to:
[0108] The total offset is determined according to the offset of the detection frame in multiple historically collected images relative to the center of the image in a set direction; the third speed parameter is determined according to the product between the total offset and a set third coefficient.
[0109] In a possible implementation of the embodiment of the present application, the control module 63 further includes:
[0110] A correction unit, used for correcting the target speed parameter according to the target distance;
[0111] The target distance is the distance between the image sensor and the target object.
[0112] In a possible implementation of the embodiment of the present application, the acquisition module 61 includes:
[0113] A recognition unit, used for tracking the target object in the target image to obtain a candidate frame in the target image;
[0114] A prediction unit, configured to predict a position of the target object in the target image according to a detection frame of the target object in a plurality of historically collected images, so as to obtain a prediction frame in the target image;
[0115] The second determining unit is used to determine a detection frame of the target object in the target image according to a difference between the predicted frame and the candidate frame.
[0116] In a possible implementation manner of the embodiment of the present application, the second determining unit is specifically configured to:
[0117] If the position difference between the prediction frame and the candidate frame in the set direction is less than a first threshold, the coordinate position of the candidate frame in the set direction is used as the coordinate position of the detection frame;
[0118] If the position difference between the prediction box and the candidate box in the set direction is greater than or equal to the first threshold, the coordinate position of the prediction box in the set direction is used as the coordinate position of the detection box.
[0119] In a possible implementation manner of the embodiment of the present application, the first threshold is determined according to a standard deviation of the coordinate position of the detection box in the multiple historically acquired images in the set direction.
[0120] In a possible implementation manner of the embodiment of the present application, the second determining unit is specifically configured to:
[0121] If the size difference between the prediction box and the candidate box in the set direction is less than a second threshold, taking the size of the candidate box in the set direction as the size of the detection box;
[0122] If the size difference between the prediction box and the candidate box in the set direction is greater than or equal to the second threshold, the size of the prediction box in the set direction is used as the size of the detection box.
[0123] In a possible implementation manner of the embodiment of the present application, the second threshold is determined according to the coordinate position of the detection frame in the target image in the set direction.
[0124] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment and will not be repeated here.
[0125] In order to implement the above-mentioned embodiments, the embodiments of the present application propose an electronic device, including a gimbal and an image sensor carried by the gimbal. The electronic device also includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the gimbal control method described in the above-mentioned method embodiment is implemented.
[0126] The electronic device may specifically be, but is not limited to, a robot device.
[0127] In order to implement the above-mentioned embodiment, the embodiment of the present application proposes a non-temporary computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the pan-tilt control method as described in the above-mentioned method embodiment is implemented.
[0128] In order to implement the above-mentioned embodiment, the embodiment of the present application proposes a computer program product. When the instructions in the computer program product are executed by a processor, the pan / tilt control method as described in the above-mentioned method embodiment is implemented.
[0129] Fig. 9 A block diagram of an exemplary electronic device suitable for implementing the embodiments of the present application is shown. Fig. 9 The electronic device 12 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0130] like Fig. 9 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0131] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.
[0132] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0133] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Fig. 9 not shown, usually called a "hard drive"). Although Fig. 9 Not shown, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read only memory (CD-ROM), a digital versatile disc read only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present application.
[0134] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0135] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0136] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the methods mentioned in the above embodiments.
[0137] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0138] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0139] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0140] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0141] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0142] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0143] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0144] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A pan / tilt control method, characterized in that: The following steps are involved: Obtaining a detection frame of a target object in a target image; wherein the target image is collected by an image sensor carried by the gimbal; If the detection frame is not in the central area of the image, determining a first speed parameter in the set direction according to an offset of the detection frame relative to the center of the image in the set direction; A target speed parameter is determined according to the first speed parameter, and the gimbal is controlled to move at the target speed parameter in the set direction, wherein the target speed parameter is the sum of at least one of a second speed parameter and a third speed parameter and the first speed parameter, the second speed parameter is determined according to the product of the offset and a set second coefficient; and the third speed parameter is determined according to the offset of the detection frame in a plurality of historically acquired images relative to the center of the image in the set direction.
2. The PTZ control method according to claim 1, characterized in that: The determining, according to the offset of the detection frame relative to the center of the image in the set direction, a first speed parameter in the set direction includes: If the offset of the detection frame relative to the center of the image in the set direction is greater than an offset threshold, determining the first speed parameter in the set direction according to the product of the offset and a set first coefficient; If the offset of the detection frame relative to the image center in the set direction is less than or equal to the offset threshold, it is determined that the first speed parameter in the set direction is zero.
3. The PTZ control method according to claim 1, characterized in that: The method further comprises: Determine a total offset according to an offset of a detection frame in a plurality of historically collected images relative to a center of the image in the set direction; The third speed parameter is determined according to the product of the total offset and a set third coefficient.
4. The PTZ control method according to claim 1, characterized in that: Before controlling the pan / tilt platform to move in the set direction at the target speed parameter, the method further includes: Correcting the target speed parameter according to the target distance; The target distance is the distance between the image sensor and the target object.
5. The PTZ control method according to any one of claims 1 to 4, characterized in that: The step of obtaining a detection frame of a target object in a target image includes: Tracking the target object in the target image to obtain a candidate frame in the target image; Predicting the position of the target object in the target image according to the detection frames of the target object in the plurality of historically collected images to obtain a prediction frame in the target image; A detection frame of the target object in the target image is determined according to a difference between the predicted frame and the candidate frame.
6. The PTZ control method according to claim 5, characterized in that: The step of determining a detection frame of the target object in the target image according to a difference between the predicted frame and the candidate frame includes: If the position difference between the prediction frame and the candidate frame in the set direction is less than a first threshold, the coordinate position of the candidate frame in the set direction is used as the coordinate position of the detection frame; If the position difference between the prediction box and the candidate box in the set direction is greater than or equal to the first threshold, the coordinate position of the prediction box in the set direction is used as the coordinate position of the detection box.
7. The PTZ control method according to claim 6, characterized in that: The first threshold is determined according to a standard deviation of coordinate positions of the detection boxes in the plurality of historically acquired images in the set direction.
8. The PTZ control method according to claim 5, characterized in that: The step of determining a detection frame of the target object in the target image according to a difference between the predicted frame and the candidate frame includes: If the size difference between the prediction box and the candidate box in the set direction is less than a second threshold, taking the size of the candidate box in the set direction as the size of the detection box; If the size difference between the prediction box and the candidate box in the set direction is greater than or equal to the second threshold, the size of the prediction box in the set direction is used as the size of the detection box.
9. The PTZ control method according to claim 8, characterized in that: The second threshold is determined according to the coordinate position of the detection frame in the target image in the set direction.
10. A pan / tilt control device, characterized in that: include: An acquisition module, used to acquire a detection frame of a target object in a target image; wherein the target image is acquired by an image sensor carried by the gimbal; a determination module, configured to determine a first speed parameter in the set direction according to an offset of the detection frame relative to the center of the image in the set direction if the detection frame is not in the central area of the image; A control module is used to determine a target speed parameter according to the first speed parameter, and control the pan / tilt to move at the target speed parameter in the set direction, wherein the target speed parameter is the sum of at least one of a second speed parameter and a third speed parameter and the first speed parameter, the second speed parameter is determined according to the product of the offset and a set second coefficient; and the third speed parameter is determined according to the offset of the detection frame in a plurality of historically collected images relative to the center of the image in the set direction.
11. The PTZ control device according to claim 10, characterized in that: The determination module is specifically used for: If the offset of the detection frame relative to the center of the image in the set direction is greater than an offset threshold, determining the first speed parameter in the set direction according to the product of the offset and a set first coefficient; If the offset of the detection frame relative to the image center in the set direction is less than or equal to the offset threshold, it is determined that the first speed parameter in the set direction is zero.
12. The PTZ control device according to claim 10, characterized in that: The determination module is specifically used for: Determine a total offset according to an offset of a detection frame in a plurality of historically collected images relative to a center of the image in the set direction; The third speed parameter is determined according to the product of the total offset and a set third coefficient.
13. The PTZ control device according to claim 10, characterized in that: The control module further includes: A correction unit, used for correcting the target speed parameter according to the target distance; The target distance is the distance between the image sensor and the target object.
14. The PTZ control device according to any one of claims 10 to 13, characterized in that: The acquisition module comprises: A recognition unit, used for tracking the target object in the target image to obtain a candidate frame in the target image; A prediction unit, configured to predict a position of the target object in the target image according to a detection frame of the target object in a plurality of historically collected images, so as to obtain a prediction frame in the target image; The second determining unit is used to determine a detection frame of the target object in the target image according to a difference between the predicted frame and the candidate frame.
15. The PTZ control device according to claim 14, characterized in that: The second determining unit is specifically configured to: If the position difference between the prediction frame and the candidate frame in the set direction is less than a first threshold, the coordinate position of the candidate frame in the set direction is used as the coordinate position of the detection frame; If the position difference between the prediction box and the candidate box in the set direction is greater than or equal to the first threshold, the coordinate position of the prediction box in the set direction is used as the coordinate position of the detection box.
16. The PTZ control device according to claim 15, characterized in that: The first threshold is determined according to a standard deviation of coordinate positions of the detection boxes in the plurality of historically acquired images in the set direction.
17. The PTZ control device according to claim 14, characterized in that: The second determining unit is specifically configured to: If the size difference between the prediction box and the candidate box in the set direction is less than a second threshold, taking the size of the candidate box in the set direction as the size of the detection box; If the size difference between the prediction box and the candidate box in the set direction is greater than or equal to the second threshold, the size of the prediction box in the set direction is used as the size of the detection box.
18. The PTZ control device according to claim 17, characterized in that: The second threshold is determined according to the coordinate position of the detection frame in the target image in the set direction.
19. A robot device, characterized in that: The robot device includes a gimbal and an image sensor carried by the gimbal, and the robot device also includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the gimbal control method as described in any one of claims 1 to 9 is implemented.
20. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the pan / tilt control method as described in any one of claims 1 to 9 is implemented.
21. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor, the pan / tilt control method as described in any one of claims 1 to 9 is executed.
