Camera automatic tracking method and system based on pan / tilt control
Through the camera automatic tracking method based on PTZ control, using zero-point labeling, environmental information extraction, Kalman filtering and ant colony optimization algorithms, the problem of unstable target tracking in the existing technology is solved, and high accuracy in complex environments is achieved. and stability tracking effects.
Patent Information
- Application Number
- CN202410852493.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-06-28
AI Technical Summary
Existing camera automatic tracking systems are difficult to ensure continuous and stable tracking of targets in complex dynamic environments. The fixed position limits the monitoring range, has a high false alarm rate, and lacks intelligent path planning and dynamic adjustment capabilities, resulting in lost targets or unstable tracking.
The camera automatic tracking method based on PTZ control is used to plan the movement path through zero-point annotation processing, environmental information extraction, target recognition, Kalman filter algorithm prediction and ant colony optimization algorithm, combined with real-time updates and error correction to ensure that the PTZ can dynamically adjust Trace the path.
It improves the accuracy and stability of target tracking, avoids target loss, enhances the intelligence and adaptability of the system, and can respond to target movement changes in real time in complex environments.
Smart Images

Figure CN118394134B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a camera automatic tracking method and system based on pan / tilt control. Background Art
[0002] In the prior art, camera automatic tracking systems are widely used in security monitoring, unmanned driving, smart home and other fields. Traditional automatic tracking systems usually rely on simple motion detection algorithms and fixed camera positions to determine the position of the target by detecting motion changes in the image and perform simple tracking. Such systems perform well in static scenes, but in complex dynamic environments, they are limited by the fixed position of the camera and a single tracking algorithm, making it difficult to ensure continuous and stable tracking of the target.
[0003] However, existing camera automatic tracking systems have deficiencies in many aspects. Fixed-position cameras are difficult to cover a large monitoring area, and multiple cameras are required to work together, which increases the complexity and cost of the system. Secondly, simple motion detection algorithms are easily interfered with in complex environments, have a high false alarm rate, and cannot effectively distinguish between real targets and background noise. In addition, existing systems lack intelligent path planning and dynamic adjustment capabilities, and cannot make real-time adjustments based on the target's motion trajectory, resulting in target loss or unstable tracking. Summary of the invention
[0004] The present application provides a camera automatic tracking method and system based on pan-tilt control, which are used to improve the accuracy of camera automatic tracking based on pan-tilt control.
[0005] In a first aspect, the present application provides a camera automatic tracking method based on pan / tilt control, the camera automatic tracking method based on pan / tilt control comprising: performing zero-point marking processing on a preset pan / tilt position of a pan / tilt to obtain initial zero-point position data of the pan / tilt;
[0006] Collecting an environmental image through a camera placed on the pan-tilt head, extracting environmental information from the environmental image to obtain an environmental information set, wherein the environmental information set includes: environmental background information and object distribution data;
[0007] Performing target recognition on the environment image according to the environment information set to obtain target object data, wherein the target object data includes: an object boundary box and object position coordinate data;
[0008] Inputting the target object data into a Kalman filter algorithm to predict the target movement position, thereby obtaining the target movement position data;
[0009] Input the target moving position data and the initial zero point position data into an ant colony optimization algorithm to perform pan-tilt moving path planning, and obtain pan-tilt moving path data, wherein the pan-tilt moving path data includes: pan-tilt rotation angle, pan-tilt moving speed and pan-tilt moving path;
[0010] The target object data is updated in real time through the camera to acquire image data, and the updated image data is used to perform error correction on the pan / tilt moving path data to obtain a target tracking path.
[0011] In combination with the first aspect, in a first implementation of the first aspect of the present application, the step of performing zero-point marking processing on the preset pan / tilt position of the pan / tilt to obtain initial zero-point position data of the pan / tilt includes:
[0012] The current pan-tilt data is collected by a preset sensor module to obtain the current pan-tilt position data, wherein the current pan-tilt position data includes: angle data and position data;
[0013] The pan / tilt head is controlled to rotate to a preset zero position by a PID control algorithm, and data of the pan / tilt head is collected by the sensor module at the zero position to obtain zero angle data and zero position data;
[0014] Extracting relative data from the position data and the preset zero point position to obtain relative angle data and relative position data;
[0015] Performing data calculation on the zero-point angle data according to the relative angle data to obtain an angle deviation value;
[0016] Performing data calculation on the zero point position data according to the relative position data to obtain a position deviation value;
[0017] The zero point of the gimbal position memory of the gimbal is marked according to the angle deviation value and the position deviation value to obtain the initial zero point position data.
[0018] In combination with the first aspect, in a second implementation of the first aspect of the present application, the environment image is collected by a camera placed on the pan / tilt head, and environment information is extracted from the environment image to obtain an environment information set, wherein the environment information set includes: environment background information and object distribution data, including:
[0019] The camera placed on the pan-tilt head collects an environmental image, and performs image segmentation on the environmental image to obtain a plurality of segmented images;
[0020] Perform image feature extraction on each segmented image to obtain pixel features of each segmented image;
[0021] Performing pixel value segmentation on the pixel features of each segmented image to obtain a first pixel feature and a second pixel feature of each segmented image;
[0022] Performing background modeling according to the first pixel feature of each segmented image to obtain an environmental background model, and extracting environmental background information of the environmental background model;
[0023] Performing background separation on the environment image using the environment background model to obtain a separated image;
[0024] Target detection is performed on the separated image to obtain a plurality of targets, and object distribution analysis is performed on the separated image according to the plurality of targets to obtain the object distribution data.
[0025] In combination with the first aspect, in a third implementation of the first aspect of the present application, target recognition is performed on the environment image according to the environment information set to obtain target object data, wherein the target object data includes: an object bounding box and object position coordinate data, including:
[0026] Inputting the object distribution data into a convolutional layer of a region-based convolutional neural network to extract distribution features to obtain object distribution features, wherein the region-based convolutional neural network includes: a convolutional layer, a sliding window layer, a region proposal generation layer, a candidate region cropping layer, a pooling layer, and a classification layer;
[0027] Inputting the object distribution features into the sliding window layer to perform feature dimensionality reduction processing to obtain low-dimensional distribution features;
[0028] Inputting the low-dimensional distribution features into the region proposal generation layer to perform feature map proposal region screening to obtain a feature map of the proposed region;
[0029] Inputting the proposed region feature map into the candidate region cropping layer to perform image cropping according to a preset size to obtain a cropped region feature map;
[0030] Inputting the cropped region feature map into the pooling layer for fixed-size pooling processing to obtain a pooling feature map;
[0031] Inputting the pooling feature map into the classification layer to extract the target, and obtaining initial object data, wherein the initial object data includes: an initial object bounding box and initial object position coordinate data;
[0032] The initial object data is corrected by using the environmental background information to obtain the target object data, wherein the target object data includes: an object boundary box and object position coordinate data.
[0033] In combination with the first aspect, in a fourth implementation of the first aspect of the present application, inputting the target object data into a Kalman filter algorithm to predict the target movement position to obtain the target movement position data includes:
[0034] Inputting the target object data into a Kalman filter algorithm to generate a state vector to obtain a plurality of state vectors;
[0035] Extracting an observation vector corresponding to the Kalman filter algorithm, and performing a state transfer matrix analysis on the multiple state vectors through the observation vector to obtain a state transfer matrix corresponding to each state vector;
[0036] According to the state transfer matrix corresponding to each state vector, each state vector is predicted respectively to obtain the predicted state vector corresponding to each state vector;
[0037] The mobile position data corresponding to the predicted state vector corresponding to each state vector is matched to obtain the target mobile position data.
[0038] In combination with the first aspect, in a fifth implementation of the first aspect of the present application, the target moving position data and the initial zero point position data are input into an ant colony optimization algorithm to perform pan-tilt moving path planning to obtain pan-tilt moving path data, wherein the pan-tilt moving path data includes: pan-tilt rotation angle, pan-tilt moving speed and pan-tilt moving path, including:
[0039] Performing ant colony parameter matching on the target moving position data to obtain ant colony parameters, wherein the ant colony parameters include: the number of ants and initial state data of each ant;
[0040] Defining the state space of the pan / tilt, selecting an ant moving path according to the initial state data of each ant, and obtaining the moving path data of each ant;
[0041] The updated state data of each ant is extracted by moving the movement path data of each ant in the state space of the pan / tilt;
[0042] Generate multiple movement paths based on the updated state data of each ant and the initial state data of each ant;
[0043] Perform pheromone concentration analysis on each moving path to obtain pheromone concentration data for each moving path;
[0044] Path screening is performed on multiple moving paths according to the pheromone concentration data of each moving path to obtain the pan / tilt moving path;
[0045] The pan / tilt moving path is subjected to pan / tilt moving parameter analysis to obtain the pan / tilt rotation angle and the pan / tilt moving speed.
[0046] In combination with the first aspect, in a sixth implementation of the first aspect of the present application, the step of performing real-time updating image acquisition on the target object data by the camera to obtain updated image data, and performing error correction on the pan / tilt movement path data by the updated image data to obtain a target tracking path includes:
[0047] Performing real-time updated image acquisition of the target object data through the camera to obtain updated image data;
[0048] Extracting object movement parameters from the updated image data to obtain object movement distance and object movement angle;
[0049] Perform error extraction on the target moving position data according to the moving distance of the object and the moving angle of the object to obtain a position error and an angle error;
[0050] The error correction is performed on the pan / tilt moving path data according to the position error and the angle error to obtain a target tracking path.
[0051] In a second aspect, the present application provides a camera automatic tracking system based on pan-tilt control, the camera automatic tracking system based on pan-tilt control comprising:
[0052] The processing module is used to perform zero-point marking processing on the preset PTZ position to obtain the initial zero-point position data of the PTZ;
[0053] A collection module, used to collect environmental images through a camera placed on the pan-tilt head, extract environmental information from the environmental images, and obtain an environmental information set, wherein the environmental information set includes: environmental background information and object distribution data;
[0054] A recognition module, configured to perform target recognition on the environment image according to the environment information set to obtain target object data, wherein the target object data includes: an object boundary box and object position coordinate data;
[0055] A prediction module, used for inputting the target object data into a Kalman filter algorithm to predict the target movement position and obtain the target movement position data;
[0056] A planning module, used for inputting the target moving position data and the initial zero point position data into an ant colony optimization algorithm to perform pan-tilt moving path planning, and obtaining pan-tilt moving path data, wherein the pan-tilt moving path data includes: pan-tilt rotation angle, pan-tilt moving speed and pan-tilt moving path;
[0057] The correction module is used to update the image acquisition of the target object data in real time through the camera to obtain updated image data, and to perform error correction on the pan-tilt moving path data through the updated image data to obtain the target tracking path.
[0058] The third aspect of the present application provides a camera automatic tracking device based on pan-tilt control, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the camera automatic tracking device based on pan-tilt control executes the above-mentioned camera automatic tracking method based on pan-tilt control.
[0059] A fourth aspect of the present application provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned automatic camera tracking method based on pan-tilt control.
[0060] In the technical solution provided by the present application, the initial zero position data of the pan-tilt is obtained by zero-marking the preset pan-tilt position, which ensures that the pan-tilt can start working from a standard initial position at any time, avoiding the subsequent tracking error caused by the initial position deviation. The sensor module rotates the pan-tilt to the preset zero position and collects the data of the zero position by collecting the angle and position data of the current pan-tilt, combined with the PID control algorithm. By solving these data, the relative angle and position deviation values are obtained, and zero-marking is performed according to these deviation values to ensure the accuracy of the initial zero position data. The environmental image is collected by the camera placed on the pan-tilt, and the environmental information is extracted from these images to obtain an environmental information set including environmental background information and object distribution data. This step ensures the accuracy and integrity of the environmental information through a series of processing steps such as image segmentation, image feature extraction, pixel value segmentation, background modeling and target detection. In particular, through background modeling and background separation, the target object in the environment can be effectively extracted, and detailed object distribution data can be obtained through object distribution analysis, which provides a reliable data basis for subsequent target recognition and tracking. The present invention adopts a region-based convolutional neural network (R-CNN) to extract distribution features. R-CNN includes multiple layers such as a convolution layer, a sliding window layer, a region proposal generation layer, a candidate region cropping layer, a pooling layer, and a classification layer. Through the collaborative work of these layers, the object distribution data is subjected to deep feature extraction and dimensionality reduction processing to generate low-dimensional distribution features. On this basis, the feature map proposal region is screened through the region proposal generation layer to obtain a feature map of the proposed region, and the image is cropped and fixed-size pooled through the candidate region cropping layer and the pooling layer, and finally the target is extracted in the classification layer to obtain the initial object data. The initial object data is corrected by the environmental background information to obtain the target object data including the object bounding box and the position coordinates, so as to ensure the accuracy and reliability of target recognition. The present invention adopts the Kalman filter algorithm to generate the state vector and analyze the state transfer matrix, and predicts the state of multiple state vectors through the observation vector to obtain the predicted state vector and the target moving position data. The Kalman filter algorithm has high prediction accuracy and stability, can effectively predict the moving position of the target, and provides reliable data support for subsequent path planning. In terms of pan-tilt moving path planning, the present invention introduces an ant colony optimization algorithm, and inputs the target moving position data and the initial zero point position data into the ant colony optimization algorithm for path planning. Through a series of steps such as ant colony parameter matching, state space definition, moving path data extraction, and pheromone concentration analysis, multiple moving paths are generated, and the optimal pan-tilt moving path is obtained through path screening. The ant colony optimization algorithm simulates the foraging behavior of ants to find the optimal path in a complex state space, ensuring that the pan-tilt can track the target at the optimal angle and speed.The camera collects the target object data in real time to obtain updated image data, and uses the updated image data to perform error correction on the gimbal movement path data to generate the target tracking path. The real-time update and error correction mechanism ensures that the gimbal can dynamically adjust the path during the tracking process, respond to the target's movement changes in real time, and avoid target loss or unstable tracking. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0062] Figure 1 A schematic diagram of an embodiment of a camera automatic tracking method based on pan / tilt control in an embodiment of the present application;
[0063] Figure 2 It is a schematic diagram of an embodiment of a camera automatic tracking system based on pan-tilt control in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The embodiments of the present application provide a method and system for automatic tracking of a camera based on pan-tilt control. The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0065] For ease of understanding, the specific process of the embodiment of the present application is described below. Figure 1 In the embodiment of the present application, an embodiment of the camera automatic tracking method based on pan-tilt control includes:
[0066] Step S101, performing zero-point marking processing on the preset PTZ position to obtain the initial zero-point position data of the PTZ;
[0067] It is understandable that the execution subject of the present application can be a camera automatic tracking system based on PTZ control, or a terminal or a server, which is not limited here. The present application embodiment is described by taking the server as the execution subject as an example.
[0068] Specifically, the current state data of the pan-tilt, including the current angle and position, is collected in real time through a preset sensor module. The sensor module compares the actual state of the current pan-tilt with the preset ideal state, compares the difference between the current state and the preset zero point state through a PID control algorithm, and then adjusts the movement of the pan-tilt to gradually approach the preset zero point position. When the pan-tilt reaches the preset zero point position, the zero point angle data and zero point position data at this time are accurately collected through the sensor module to ensure the accuracy and reliability of the zero point position. The collected zero point angle data and zero point position data are compared with the current pan-tilt position data, and the relative angle data and relative position data are calculated through the relative data extraction method. By deeply solving these relative data, the angle deviation value and position deviation value between the pan-tilt and the ideal zero point during the actual operation process are determined. By combining the angle deviation value and the position deviation value, the position of the pan-tilt is marked with zero point, and the deviation value is applied to the current position correction of the pan-tilt, so that the initial zero point position data of the pan-tilt is more accurate.
[0069] Step S102: collecting an environmental image through a camera placed on the pan-tilt head, extracting environmental information from the environmental image, and obtaining an environmental information set, wherein the environmental information set includes: environmental background information and object distribution data;
[0070] Specifically, the environment image is collected by a camera placed on the gimbal, and the environment image is segmented to obtain multiple segmented images. The complex environment image is divided into smaller and easier to process parts to improve the accuracy and efficiency of subsequent processing. Each segmented image is processed by an image segmentation algorithm to divide the image into multiple regions, which can be segmented based on color, texture or other visual features. Image feature extraction is performed on each segmented image to obtain pixel features of each segmented image. Numerical information representing its characteristics is extracted from the segmented image, and these characteristics include color histogram, edge information, texture features, etc. The pixel features of each segmented image are extracted by algorithm analysis, so that these features can be used for subsequent pixel value segmentation and background modeling. Pixel value segmentation is performed on the pixel features of each segmented image to obtain the first pixel feature and the second pixel feature of each segmented image. Pixel value segmentation is to classify the pixels in the image into different feature categories by threshold segmentation, cluster analysis or other segmentation algorithms. The first pixel feature and the second pixel feature represent different pixel value classifications, which are used to distinguish the characteristics of the environment background and the foreground object. Background modeling is performed based on the first pixel feature of each segmented image to obtain an environment background model, and the environment background information of the environment background model is extracted. Background modeling establishes a model to represent the visual features of the environment background by analyzing the first pixel feature. The environment background model includes information such as the color and texture of the background, which is used to describe the visual features of the environment background, and is thus used for background separation and target detection in subsequent steps. The environment image is subjected to background separation by the environment background model to obtain a separated image. The background part of the environment image is separated from the foreground part by using the environment background model. The pixels in the image that match the background model are classified as background, and the remaining pixels are regarded as foreground objects, thereby obtaining a separated image, which only contains pixels of the foreground object. Target detection is performed on the separated image to obtain multiple targets, and object distribution analysis is performed on the separated image based on the multiple targets to obtain object distribution data. Foreground objects, such as people, vehicles or other moving targets, are identified and located in the separated image by a machine learning algorithm or a deep learning model. Object distribution analysis is performed by analyzing the position, size and shape of these targets to generate object distribution data. These data include information such as the position coordinates and bounding box of each target object.
[0071] Step S103: performing target recognition on the environment image according to the environment information set to obtain target object data, wherein the target object data includes: an object boundary box and object position coordinate data;
[0072] Specifically, the object distribution data is input into the convolution layer of the region-based convolutional neural network for distribution feature extraction to obtain the object distribution feature. The region-based convolutional neural network includes multiple key components: convolution layer, sliding window layer, region proposal generation layer, candidate region cropping layer, pooling layer and classification layer. The convolution layer receives the object distribution data and extracts the distribution features of the image through multiple convolution operations. The convolution operation can capture the local patterns and features in the image by sliding the filter on the image, thereby extracting the distribution features of the object. The distribution features are input into the sliding window layer for feature dimensionality reduction processing to obtain low-dimensional distribution features. The convolution feature map is scanned by the sliding window mechanism, and a lower-dimensional feature representation is generated to reduce the computational complexity and retain important feature information. Subsequently, the low-dimensional distribution features are input into the region proposal generation layer for feature map proposal region screening to obtain a proposed region feature map. The region proposal generation layer generates multiple region proposals that may contain target objects by analyzing the low-dimensional distribution features. These region proposals represent regions where target objects may exist. The proposed region feature map is input into the candidate region cropping layer to crop the image according to a preset size to obtain a cropped region feature map. The candidate region cropping layer crops the proposed region according to the preset size standard to ensure that the size of the image blocks processed subsequently is consistent, thereby improving the recognition accuracy. The cropped region feature map is input into the pooling layer for fixed-size pooling processing to obtain a pooled feature map. The pooling layer reduces the size of the feature map by performing a pooling operation on the cropped region feature map while retaining important feature information. The pooled feature map is input into the classification layer for target extraction to obtain initial object data, wherein the initial object data includes an initial object bounding box and initial object position coordinate data. The classification layer uses a fully connected network or other classification algorithms to analyze the pooled feature map and outputs the preliminary identified object category, position and bounding box. The initial object data is corrected by the environmental background information to obtain the target object data, wherein the target object data includes an object bounding box and object position coordinate data. The environmental background information is used to correct the initial object data and eliminate errors caused by background complexity or image noise, thereby improving the accuracy of the recognition result.
[0073] Step S104, inputting the target object data into a Kalman filter algorithm to predict the target movement position, and obtaining the target movement position data;
[0074] Specifically, the target object data is input into the Kalman filter algorithm to generate a state vector, and multiple state vectors are obtained. The state vector is a mathematical representation used to describe the state information of the target object at a specific time point, usually including information such as position and speed. The observation vector corresponding to the Kalman filter algorithm is extracted, and the state transfer matrix analysis is performed on multiple state vectors through the observation vector to obtain the state transfer matrix corresponding to each state vector. The observation vector is a vector used to describe the measurement data in the Kalman filter algorithm, which contains the observation values of the position and speed of the target object. The state transfer matrix is a matrix that describes the evolution relationship of the state vector in the time step. Based on the observation vector, the transfer law of the state vector can be analyzed and determined, thereby constructing the state transfer matrix. According to the state transfer matrix corresponding to each state vector, the state prediction is performed on each state vector to obtain the predicted state vector corresponding to each state vector. Through the prediction step of the Kalman filter, the current state vector and the state transfer matrix are used to predict the position and speed of the target object at the next time step. Through mathematical calculation, the corresponding predicted state vector is generated to reflect the state of the target object at the future moment. The mobile position data corresponding to the predicted state vector corresponding to each state vector is matched to obtain the target mobile position data. The mobile position data is extracted from the predicted state vector and is used to describe the position coordinates of the target object at the future moment. By matching and integrating the prediction results of each state vector, the complete target mobile position data is obtained.
[0075] Step S105, inputting the target moving position data and the initial zero point position data into the ant colony optimization algorithm to perform pan-tilt moving path planning, and obtaining pan-tilt moving path data, wherein the pan-tilt moving path data includes: pan-tilt rotation angle, pan-tilt moving speed and pan-tilt moving path;
[0076] Specifically, the target moving position data is matched with ant colony parameters to obtain ant colony parameters, which include the number of ants and the initial state data of each ant. Reasonable ant number and initial state data can improve the convergence speed of the algorithm and the accuracy of path planning. Define the state space of the pan-tilt, select the ant moving path according to the initial state data of each ant, and obtain the moving path data of each ant. The state space of the pan-tilt is a set that describes all possible positions and angles of the pan-tilt in three-dimensional space. By searching in this state space, the optimal pan-tilt moving path can be found. Each ant selects its moving path according to its initial state data and uses the heuristic rules and state transition probability in the ant colony optimization algorithm to generate moving path data. The moving path data of each ant is used to perform spatial movement in the state space of the pan-tilt to extract the updated state data of each ant. As each ant moves in the state space, the state data is continuously updated, including information such as the current position, moving direction and speed. The updated state data reflects the path and state changes experienced by the ant during the search process, and provides a basis for subsequent path optimization. Multiple moving paths are generated based on the updated state data of each ant and the initial state data of each ant. By comparing the initial state data and the updated state data, a complete path containing the movement process of each ant in the state space can be generated. These paths contain all state changes from the initial position to the target position, reflecting the route explored by the ants during the search process. Subsequently, the pheromone concentration of each moving path is analyzed to obtain the pheromone concentration data of each moving path. Pheromone concentration is an important indicator used to guide the search direction of ants in the ant colony optimization algorithm. By calculating the pheromone concentration on each path, the quality of the path can be evaluated. The higher the pheromone concentration, the better the path was in the past search and attracted more ants to choose. The pheromone concentration data of each moving path is used to screen multiple moving paths to obtain the pan-tilt moving path. According to the pheromone concentration data, the path with the highest pheromone concentration is selected as the optimal path. This path represents the optimal moving route found by the ants in the state space. The pan-tilt moving path is analyzed for the pan-tilt moving parameters to obtain the pan-tilt rotation angle and pan-tilt moving speed. By analyzing the optimal path, the rotation angle and moving speed that the pan-tilt needs to adjust during the movement process are extracted.
[0077] Step S106: Real-time update image acquisition of the target object data is performed through the camera to obtain updated image data, and error correction is performed on the pan / tilt moving path data through the updated image data to obtain the target tracking path.
[0078] Specifically, the target object data is updated in real time through the camera to obtain updated image data. The object movement parameters are extracted from the updated image data to obtain the object movement distance and the object movement angle. The updated image data is compared with the image data collected previously, and the movement distance and movement angle of the target object between the two image acquisitions are calculated through the image processing algorithm. The target movement position data is error extracted according to the object movement distance and the object movement angle to obtain the position error and the angle error. Error extraction refers to calculating the position error and the angle error by comparing the difference between the object movement parameters obtained by calculation and the expected target movement position data. The position error reflects the distance difference between the actual position of the target object and the expected position, and the angle error reflects the angle difference between the actual moving direction of the target object and the expected moving direction. The pan-tilt movement path data is error corrected according to the position error and the angle error to obtain the target tracking path. The error correction process includes adjusting the movement path data of the pan-tilt to compensate for the deviation caused by the position error and the angle error. By adjusting the rotation angle and the moving speed of the pan-tilt, its path can correct the actual motion trajectory of the target object in real time, thereby maintaining accurate tracking of the target object.
[0079] In the embodiment of the present application, the initial zero position data of the pan / tilt is obtained by performing zero-point marking processing on the preset pan / tilt position, ensuring that the pan / tilt can start working from a standard initial position at any time, avoiding subsequent tracking errors caused by initial position deviation. The sensor module collects the angle and position data of the current pan / tilt, combines the PID control algorithm, rotates the pan / tilt to the preset zero position, and collects the data of the zero position. By solving these data, the relative angle and position deviation values are obtained, and zero-point marking is performed according to these deviation values to ensure the accuracy of the initial zero position data. The environmental images are collected by the camera placed on the pan / tilt, and the environmental information is extracted from these images to obtain an environmental information set including environmental background information and object distribution data. This step ensures the accuracy and integrity of the environmental information through a series of processing steps such as image segmentation, image feature extraction, pixel value segmentation, background modeling and target detection. In particular, through background modeling and background separation, the target object in the environment can be effectively extracted, and detailed object distribution data can be obtained through object distribution analysis, providing a reliable data basis for subsequent target recognition and tracking. The present invention uses a region-based convolutional neural network (R-CNN) for distribution feature extraction. R-CNN includes multiple layers such as convolution layer, sliding window layer, region proposal generation layer, candidate region cropping layer, pooling layer and classification layer. Through the collaborative work of these layers, the object distribution data is subjected to deep feature extraction and dimensionality reduction processing to generate low-dimensional distribution features. On this basis, the feature map proposal region is screened through the region proposal generation layer to obtain the feature map of the proposed region, and the image is cropped and fixed-size pooled through the candidate region cropping layer and the pooling layer, and finally the target is extracted in the classification layer to obtain the initial object data. The initial object data is corrected by the environmental background information to obtain the target object data including the object bounding box and position coordinates, so as to ensure the accuracy and reliability of target recognition. The present invention adopts the Kalman filter algorithm to generate state vectors and analyze state transfer matrices, and predicts the state of multiple state vectors through the observation vector to obtain the predicted state vector and target moving position data. The Kalman filter algorithm has high prediction accuracy and stability, can effectively predict the moving position of the target, and provides reliable data support for subsequent path planning. In terms of pan-tilt moving path planning, the present invention introduces an ant colony optimization algorithm, and inputs the target moving position data and the initial zero point position data into the ant colony optimization algorithm for path planning. Through a series of steps such as ant colony parameter matching, state space definition, moving path data extraction, and pheromone concentration analysis, multiple moving paths are generated, and the optimal pan-tilt moving path is obtained through path screening. The ant colony optimization algorithm simulates the foraging behavior of ants to find the optimal path in a complex state space, ensuring that the pan-tilt can track the target at the optimal angle and speed.The camera collects the target object data in real time to obtain updated image data, and uses the updated image data to perform error correction on the gimbal movement path data to generate the target tracking path. The real-time update and error correction mechanism ensures that the gimbal can dynamically adjust the path during the tracking process, respond to the target's movement changes in real time, and avoid target loss or unstable tracking.
[0080] In a specific embodiment, the process of executing step S101 may specifically include the following steps:
[0081] (1) The current gimbal data is collected through a preset sensor module to obtain the current gimbal position data, wherein the current gimbal position data includes: angle data and position data;
[0082] (2) The PID control algorithm is used to control the gimbal to rotate to a preset zero position. At the zero position, the sensor module is used to collect data on the gimbal to obtain zero angle data and zero position data.
[0083] (3) Extract relative data from the position data and the preset zero point position to obtain relative angle data and relative position data;
[0084] (4) Calculate the zero-point angle data based on the relative angle data to obtain the angle deviation value;
[0085] (5) Calculate the zero point position data based on the relative position data to obtain the position deviation value;
[0086] (6) The gimbal position memory zero point is marked according to the angle deviation value and the position deviation value to obtain the initial zero point position data.
[0087] Specifically, the current pan-tilt data is collected by the preset sensor module to obtain the current pan-tilt position data. These sensor modules usually include gyroscopes, accelerometers, electronic compasses, etc., which are used to accurately measure the current angle and position of the pan-tilt. These data include the rotation angle of the pan-tilt in space (such as pitch angle, yaw angle) and position coordinates (such as XYZ coordinates). The pan-tilt is controlled to rotate to the preset zero position through the PID control algorithm. The PID control algorithm is a classic control algorithm that adjusts the control signal through three parameters: proportional, integral and differential to ensure that the pan-tilt accurately reaches the preset zero position. During the rotation of the pan-tilt, the sensor module continuously provides real-time angle and position data. The PID control algorithm calculates the control signal based on these real-time data and adjusts the movement of the pan-tilt. For example, if the preset zero position of the pan-tilt is in the north direction of 0 degrees and the current pan-tilt position is in the east direction of 45 degrees, then the PID control algorithm will gradually adjust the rotation angle of the pan-tilt so that it slowly rotates from the east direction of 45 degrees to the north direction of 0 degrees. After the gimbal reaches the preset zero position, the sensor module collects data from the gimbal to obtain zero angle data and zero position data. Relative data is extracted from the position data and the preset zero position to obtain relative angle data and relative position data. Relative data extraction is to compare the current gimbal position data with the zero position data to calculate the relative change of the gimbal relative to the zero position. For example, assuming that the current gimbal position is 45 degrees east and the zero position is 0 degrees north, the relative angle data is 45 degrees. Similarly, the position data is compared to obtain relative position data. These relative data reflect the change of the gimbal from the zero position to the current measurement position. The zero angle data is solved according to the relative angle data to obtain the angle deviation value. The data solution process includes calculating the relative angle data and the zero angle data to obtain the actual angle deviation of the gimbal. For example, if the zero angle is 0 degrees and the relative angle is 45 degrees, the angle deviation value is 45 degrees. Similarly, the zero position data is solved according to the relative position data to obtain the position deviation value. The position deviation value is calculated by comparing the current measurement position with the zero position to obtain the actual position deviation of the gimbal. For example, if the zero position coordinates are (0, 0, 0) and the current measurement position coordinates are (1, 1, 1), the position deviation value is (1, 1, 1). The zero point marking process of the gimbal position is performed according to the angle deviation value and the position deviation value to obtain the initial zero point position data. The calculated deviation information is applied to the gimbal control system to correct the initial position setting of the gimbal so that it can accurately identify and memorize the zero point position. In this way, the gimbal can perform motion control and path planning based on the precise zero point position in subsequent operations, thereby improving the accuracy and stability of the system.
[0088] In a specific embodiment, the process of executing step S102 may specifically include the following steps:
[0089] (1) Collecting environmental images through a camera placed on a gimbal, performing image segmentation on the environmental images, and obtaining multiple segmented images;
[0090] (2) Perform image feature extraction on each segmented image to obtain pixel features of each segmented image;
[0091] (3) performing pixel value segmentation on the pixel features of each segmented image to obtain a first pixel feature and a second pixel feature of each segmented image;
[0092] (4) performing background modeling based on the first pixel feature of each segmented image to obtain an environmental background model, and extracting environmental background information of the environmental background model;
[0093] (5) Using the environmental background model to separate the background of the environmental image and obtain a separated image;
[0094] (6) Performing target detection on the separated image to obtain multiple targets, and performing object distribution analysis on the separated image based on the multiple targets to obtain object distribution data.
[0095] Specifically, environmental images are collected by a camera placed on a pan / tilt platform. These images reflect the current status of the area covered by the camera, and include all objects and background information in the area. Image segmentation is performed on the collected environmental images. The complex environmental image is divided into multiple smaller and easier-to-process parts, each of which is a segmented image. Image processing techniques such as threshold segmentation, edge detection, and region growing are used to divide the original image into several regions with different characteristics. Image feature extraction is performed on each segmented image to obtain pixel features of each segmented image. Image data is converted into numerical representations that can describe image features, including color histograms, texture features, shape features, and the like. For example, by calculating the color distribution of pixels in each segmented image, a color histogram feature is obtained; by analyzing the edge information in the image, a texture feature is obtained. Pixel value segmentation is performed on the pixel features of each segmented image to obtain the first pixel feature and the second pixel feature of each segmented image. The first pixel feature and the second pixel feature of each segmented image are obtained by performing cluster analysis or pixel value segmentation by threshold on the pixel features. For example, using a K-means clustering algorithm or an Otsu threshold segmentation method, the pixel features in each segmented image are classified into two main categories: first pixel features and second pixel features. The first pixel features usually correspond to background pixels, while the second pixel features correspond to foreground object pixels. Background modeling is performed based on the first pixel features of each segmented image to obtain an environmental background model, and environmental background information of the environmental background model is extracted. A model that can accurately describe the environmental background is constructed by analyzing the first pixel features. The environmental background model is generated using a Gaussian mixture model or an adaptive background modeling method. This model contains information such as color, brightness, and texture of the background area, so that the background part of the environment can be accurately described and separated. The environmental image is subjected to background separation using the environmental background model to obtain a separated image. The background part of the image is separated from the foreground part using the environmental background model. By comparing the matching degree of each pixel with the background model, the pixels with high matching degree are marked as background, and the pixels with low matching degree are marked as foreground. Target detection is performed on the separated image to obtain multiple targets. The foreground objects in the separated image can be identified and located, and deep learning algorithms such as convolutional neural networks can be used for target detection. Object distribution analysis is performed on the separated image based on multiple targets to obtain object distribution data. By analyzing the target detection results, the distribution information of the foreground objects in the environment is generated. This information includes the location information, size, shape, etc. of each target object.
[0096] In a specific embodiment, the process of executing step S103 may specifically include the following steps:
[0097] (1) Input the object distribution data into the convolutional layer of the region-based convolutional neural network to extract distribution features and obtain object distribution features. The region-based convolutional neural network includes: convolutional layer, sliding window layer, region proposal generation layer, candidate region cropping layer, pooling layer and classification layer;
[0098] (2) Input the object distribution features into the sliding window layer for feature dimensionality reduction to obtain low-dimensional distribution features;
[0099] (3) Input the low-dimensional distribution features into the region proposal generation layer to screen the feature map proposal regions and obtain the feature map of the proposed regions;
[0100] (4) Input the proposed region feature map into the candidate region cropping layer to crop the image according to a preset size to obtain a cropped region feature map;
[0101] (5) Input the cropped area feature map into the pooling layer for fixed-size pooling processing to obtain a pooling feature map;
[0102] (6) Inputting the pooled feature map into the classification layer for target extraction to obtain initial object data, where the initial object data includes: initial object bounding box and initial object position coordinate data;
[0103] (7) Correcting the initial object data based on the environmental background information to obtain target object data, where the target object data includes an object bounding box and object position coordinate data.
[0104] Specifically, the object distribution data is input into the convolution layer of the region-based convolutional neural network for distribution feature extraction to obtain the object distribution feature. The convolutional neural network includes a convolution layer, a sliding window layer, a region proposal generation layer, a candidate region cropping layer, a pooling layer, and a classification layer. The convolution layer extracts high-level features of the input data through a series of convolution operations. These features can capture important information in the image, such as edges, textures, and shapes. The object distribution features are input into the sliding window layer for feature dimensionality reduction processing to obtain low-dimensional distribution features. The sliding window layer applies a fixed-size window on the convolution feature map to extract features of the local region. In this way, the dimension of the feature map is reduced while retaining important local information. The low-dimensional distribution features are input into the region proposal generation layer for feature map proposal region screening to obtain a proposed region feature map. The region proposal generation layer generates multiple candidate regions that may contain target objects from the low-dimensional feature map. These candidate regions are screened by a non-maximum suppression algorithm to retain the most representative regions. The proposed region feature map is input into the candidate region cropping layer to crop the image according to a preset size to obtain a cropped region feature map. The candidate region cropping layer crops each candidate region according to a preset size standard to make them of the same size. Subsequently, the cropped region feature map is input into the pooling layer for fixed-size pooling processing to obtain a pooled feature map. The pooling layer reduces the size of the feature map and enhances the stability of the feature through maximum pooling or average pooling operations. Fixed-size pooling processing can effectively reduce the size of the feature map while retaining the most important feature information, making subsequent classification and regression tasks more efficient. The pooled feature map is input into the classification layer for target extraction to obtain initial object data. The classification layer analyzes the pooled feature map through a fully connected layer or other classification algorithms and outputs the initial object data. The initial object data includes the object category, bounding box and position coordinates of each candidate region. The initial object data is corrected by the environmental background information to obtain the target object data. The environmental background information is used to correct the errors in the initial object data and eliminate the errors caused by background complexity or image noise. For example, by comparing the initial object data with the environmental background model, the position and size of the bounding box are corrected to improve the accuracy and reliability of target detection. The target object data finally obtained includes the accurate bounding box and position coordinates of the object.
[0105] In a specific embodiment, the process of executing step S104 may specifically include the following steps:
[0106] (1) Inputting the target object data into the Kalman filter algorithm to generate a state vector and obtain multiple state vectors;
[0107] (2) Extract the observation vector corresponding to the Kalman filter algorithm, and perform state transfer matrix analysis on multiple state vectors through the observation vector to obtain the state transfer matrix corresponding to each state vector;
[0108] (3) According to the state transfer matrix corresponding to each state vector, each state vector is predicted to obtain the predicted state vector corresponding to each state vector;
[0109] (4) Match the mobile position data corresponding to the predicted state vector corresponding to each state vector to obtain the target mobile position data.
[0110] Specifically, the target object data is input into the Kalman filter algorithm to generate a state vector and obtain multiple state vectors. The target object data usually includes information such as the initial position, velocity, acceleration, etc. of the object. The Kalman filter algorithm generates a state vector through these initial data. Each state vector describes the state of the object at a certain moment, such as position and velocity. The observation vector corresponding to the Kalman filter algorithm is extracted, and the state transfer matrix analysis is performed on multiple state vectors through the observation vector to obtain the state transfer matrix corresponding to each state vector. The observation vector is real-time data obtained from a sensor or measuring device, such as the position and velocity of an object captured by a camera. The observation vector corresponds to the state vector and is used to update and correct the predicted value of the state vector. The state transfer matrix is a mathematical model that describes the state change of an object. It defines the transfer relationship of the state vector at each time step. By analyzing the state transfer matrix through the observation vector, the state change law of the object at different time points can be determined. According to the state transfer matrix corresponding to each state vector, the state prediction is performed on each state vector to obtain the predicted state vector corresponding to each state vector. State prediction is the core step of the Kalman filter algorithm. The state transfer matrix and the current state vector are used to predict the state of the object at the next time step. The predicted state vector describes the expected position and velocity of the object at a certain moment in the future. This step can provide the movement trend of the object through mathematical calculations, providing a basis for subsequent corrections and updates. The mobile position data corresponding to the predicted state vector corresponding to each state vector is matched to obtain the target mobile position data. The mobile position data is extracted from the predicted state vector and is used to describe the position coordinates of the object at a future moment. By matching and integrating the prediction results of each state vector, the complete target mobile position data is obtained. These data not only contain the position of the target object at the current moment, but also include the predicted information of its future movement path.
[0111] In a specific embodiment, the process of executing step S105 may specifically include the following steps:
[0112] (1) Perform ant colony parameter matching on the target moving position data to obtain ant colony parameters, which include: the number of ants and the initial state data of each ant;
[0113] (2) Define the state space of the PTZ, select the ant movement path according to the initial state data of each ant, and obtain the movement path data of each ant;
[0114] (3) Using the movement path data of each ant to move in the state space of the PTZ, the updated state data of each ant is extracted;
[0115] (4) generating multiple movement paths based on the updated state data of each ant and the initial state data of each ant;
[0116] (5) Analyze the pheromone concentration of each moving path to obtain the pheromone concentration data of each moving path;
[0117] (6) Filter multiple moving paths by using the pheromone concentration data of each moving path to obtain the pan / tilt moving path;
[0118] (7) Analyze the gimbal movement parameters of the gimbal movement path to obtain the gimbal rotation angle and gimbal movement speed.
[0119] Specifically, the target moving position data is matched with ant colony parameters to obtain ant colony parameters, which include the number of ants and the initial state data of each ant. The target moving position data usually includes the real-time position and expected moving path of the target object. By analyzing these data, the required number of ants and the initial position, speed and other state data of each ant are determined. The selection of the number of ants has an important impact on the performance of the ant colony optimization algorithm. Reasonable number of ants and initial state data can improve the convergence speed of the algorithm and the accuracy of path planning. Define the state space of the pan-tilt, select the ant moving path according to the initial state data of each ant, and obtain the moving path data of each ant. The state space of the pan-tilt is a set that describes all possible positions and angles of the pan-tilt in three-dimensional space. By searching in this state space, the optimal pan-tilt moving path can be found. Each ant selects its moving path based on its initial state data and uses the heuristic rules and state transition probability in the ant colony optimization algorithm to generate moving path data. The moving path data of each ant is used to perform spatial movement in the state space of the pan-tilt to extract the updated state data of each ant. As each ant moves in the state space, the state data is continuously updated, including information such as the current position, moving direction, and speed. These updated state data reflect the path and state changes experienced by the ants during the search process. Multiple moving paths are generated based on the updated state data of each ant and the initial state data of each ant. By comparing the initial state data and the updated state data, a complete path containing the movement process of each ant in the state space can be generated. These paths contain all state changes from the initial position to the target position, reflecting the routes explored by the ants during the search process. Subsequently, the pheromone concentration of each moving path is analyzed to obtain the pheromone concentration data of each moving path. Pheromone concentration is an important indicator used in the ant colony optimization algorithm to guide the search direction of ants. The pheromone concentration on each path is calculated to evaluate the quality of the path. The higher the pheromone concentration, the better the path was in the past search and attracted more ants to choose. The pheromone concentration data of each moving path is used to screen multiple moving paths and obtain the pan-tilt moving path. According to the pheromone concentration data, the path with the highest pheromone concentration is selected as the optimal path. This path represents the optimal moving route found by the ant in the state space. Through path screening, suboptimal paths can be effectively eliminated, the optimal moving path can be retained, and the efficiency and accuracy of path planning can be improved. The gimbal movement parameters are analyzed for the gimbal movement path to obtain the gimbal rotation angle and gimbal movement speed. By analyzing the optimal path, the rotation angle and movement speed that the gimbal needs to adjust during movement are extracted. These parameters are used to control the actual movement of the gimbal so that it can move according to the optimal path, thereby achieving accurate tracking of the target object.
[0120] In a specific embodiment, the process of executing step S106 may specifically include the following steps:
[0121] (1) Using a camera to collect real-time updated image data of the target object to obtain updated image data;
[0122] (2) Extracting object movement parameters from the updated image data to obtain the object movement distance and object movement angle;
[0123] (3) Extract the error of the target moving position data according to the moving distance and the moving angle of the object to obtain the position error and the angle error;
[0124] (4) Perform error correction on the gimbal movement path data based on the position error and angle error to obtain the target tracking path.
[0125] Specifically, the target object data is updated in real time through the camera to acquire the image data, and the updated image data is obtained. The camera continuously captures images in the environment at a certain frame rate and transmits the image data to the processing system. The object movement parameters are extracted from the updated image data to obtain the object movement distance and the object movement angle. The target detection algorithm (such as YOLO, SSD or Faster R-CNN) is used to identify the position of the target object in the updated image and mark its bounding box. By comparing the position change of the target object in the current frame and the previous frame, the object movement distance and movement angle are calculated. The object movement distance refers to the displacement of the target object on the image plane, and the movement angle refers to the rotation angle of the object relative to the gimbal. According to the object movement distance and the object movement angle, the target movement position data is subjected to error extraction to obtain the position error and the angle error. Error extraction is achieved by comparing the actually measured object movement parameters with the expected movement parameters. The position error is the difference between the actual position of the target object and the expected position, and the angle error is the difference between the actual rotation angle of the target object and the expected rotation angle. Through these error data, the degree to which the motion trajectory of the target object deviates from the expected path is understood. The gimbal movement path data is error-corrected based on the position error and angle error to obtain the target tracking path. Error correction is performed through a control algorithm, such as a PID controller. The PID controller calculates the correction amount based on the position error and angle error, and adjusts the gimbal movement path data to compensate for these errors. For example, if the target object moves 10 pixels to the left in the image, but the expected path fails to follow this change, the PID controller will calculate a correction amount to rotate the gimbal to the left at an appropriate angle to realign it with the target object. In this way, the gimbal can adjust its motion path in real time to ensure that the camera is always aimed at and tracking the target object.
[0126] The above describes the camera automatic tracking method based on pan-tilt control in the embodiment of the present application. The following describes the camera automatic tracking system based on pan-tilt control in the embodiment of the present application. Figure 2 In the embodiment of the present application, an embodiment of the camera automatic tracking system based on pan-tilt control includes:
[0127] The processing module 201 is used to perform zero-point marking processing on the preset PTZ position to obtain the initial zero-point position data of the PTZ;
[0128] The acquisition module 202 is used to acquire an environmental image through a camera placed on the pan-tilt head, extract environmental information from the environmental image, and obtain an environmental information set, wherein the environmental information set includes: environmental background information and object distribution data;
[0129] The recognition module 203 is used to perform target recognition on the environment image according to the environment information set to obtain target object data, wherein the target object data includes: an object boundary box and object position coordinate data;
[0130] Prediction module 204, used for inputting the target object data into a Kalman filter algorithm to predict the target moving position, and obtaining the target moving position data;
[0131] The planning module 205 is used to input the target moving position data and the initial zero point position data into an ant colony optimization algorithm to perform pan-tilt moving path planning, and obtain pan-tilt moving path data, wherein the pan-tilt moving path data includes: pan-tilt rotation angle, pan-tilt moving speed and pan-tilt moving path;
[0132] The correction module 206 is used to perform real-time update image acquisition on the target object data through the camera to obtain updated image data, and perform error correction on the pan-tilt movement path data through the updated image data to obtain a target tracking path.
[0133] Through the cooperation of the above components, the initial zero position data of the pan-tilt is obtained by marking the preset pan-tilt position at zero point, ensuring that the pan-tilt can start working from a standard initial position at any time, avoiding subsequent tracking errors caused by initial position deviation. The sensor module collects the angle and position data of the current pan-tilt, combines the PID control algorithm, rotates the pan-tilt to the preset zero position, and collects the data of the zero position. By solving these data, the relative angle and position deviation values are obtained, and zero-point marking is performed according to these deviation values to ensure the accuracy of the initial zero position data. The environmental images are collected by the camera placed on the pan-tilt, and the environmental information is extracted from these images to obtain an environmental information set including environmental background information and object distribution data. This step ensures the accuracy and integrity of the environmental information through a series of processing steps such as image segmentation, image feature extraction, pixel value segmentation, background modeling and target detection. In particular, through background modeling and background separation, the target objects in the environment can be effectively extracted, and detailed object distribution data can be obtained through object distribution analysis, providing a reliable data basis for subsequent target recognition and tracking. The present invention adopts a region-based convolutional neural network (R-CNN) to extract distribution features. R-CNN includes multiple layers such as a convolution layer, a sliding window layer, a region proposal generation layer, a candidate region cropping layer, a pooling layer, and a classification layer. Through the collaborative work of these layers, the object distribution data is subjected to deep feature extraction and dimensionality reduction processing to generate low-dimensional distribution features. On this basis, the feature map proposal region is screened through the region proposal generation layer to obtain a feature map of the proposed region, and the image is cropped and fixed-size pooled through the candidate region cropping layer and the pooling layer, and finally the target is extracted in the classification layer to obtain the initial object data. The initial object data is corrected by the environmental background information to obtain the target object data including the object bounding box and the position coordinates, so as to ensure the accuracy and reliability of target recognition. The present invention adopts the Kalman filter algorithm to generate the state vector and analyze the state transfer matrix, and predicts the state of multiple state vectors through the observation vector to obtain the predicted state vector and the target moving position data. The Kalman filter algorithm has high prediction accuracy and stability, can effectively predict the moving position of the target, and provides reliable data support for subsequent path planning. In terms of pan-tilt moving path planning, the present invention introduces an ant colony optimization algorithm, and inputs the target moving position data and the initial zero point position data into the ant colony optimization algorithm for path planning. Through a series of steps such as ant colony parameter matching, state space definition, moving path data extraction, and pheromone concentration analysis, multiple moving paths are generated, and the optimal pan-tilt moving path is obtained through path screening. The ant colony optimization algorithm simulates the foraging behavior of ants to find the optimal path in a complex state space, ensuring that the pan-tilt can track the target at the optimal angle and speed.The camera collects the target object data in real time to obtain updated image data, and uses the updated image data to perform error correction on the gimbal movement path data to generate the target tracking path. The real-time update and error correction mechanism ensures that the gimbal can dynamically adjust the path during the tracking process, respond to the target's movement changes in real time, and avoid target loss or unstable tracking.
[0134] The present application also provides a camera automatic tracking device based on pan-tilt control, and the camera automatic tracking device based on pan-tilt control includes a memory and a processor, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor executes the steps of the camera automatic tracking method based on pan-tilt control in the above-mentioned embodiments.
[0135] The present application also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the camera automatic tracking method based on pan-tilt control.
[0136] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0137] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0138] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A camera automatic tracking method based on pan / tilt control, characterized in that: The camera automatic tracking method based on pan / tilt control includes: Perform zero-point marking processing on the preset PTZ position to obtain the initial zero-point position data of the PTZ; Collecting an environmental image through a camera placed on the pan-tilt head, extracting environmental information from the environmental image to obtain an environmental information set, wherein the environmental information set includes: environmental background information and object distribution data; Performing target recognition on the environment image according to the environment information set to obtain target object data, wherein the target object data includes: an object boundary box and object position coordinate data; Inputting the target object data into a Kalman filter algorithm to predict the target movement position, thereby obtaining the target movement position data; Input the target moving position data and the initial zero point position data into an ant colony optimization algorithm to perform pan-tilt moving path planning, and obtain pan-tilt moving path data, wherein the pan-tilt moving path data includes: pan-tilt rotation angle, pan-tilt moving speed and pan-tilt moving path; The target object data is updated in real time through the camera to acquire image data, and the updated image data is used to perform error correction on the pan / tilt moving path data to obtain a target tracking path.
2. The camera automatic tracking method based on PTZ control according to claim 1, characterized in that: The zero-point marking process is performed on the preset pan / tilt position of the pan / tilt to obtain the initial zero-point position data of the pan / tilt, including: The current pan-tilt data is collected by a preset sensor module to obtain the current pan-tilt position data, wherein the current pan-tilt position data includes: angle data and position data; The pan / tilt head is controlled to rotate to a preset zero position by a PID control algorithm, and data of the pan / tilt head is collected by the sensor module at the zero position to obtain zero angle data and zero position data; Extracting relative data from the position data and the preset zero point position to obtain relative angle data and relative position data; Performing data calculation on the zero-point angle data according to the relative angle data to obtain an angle deviation value; Performing data calculation on the zero point position data according to the relative position data to obtain a position deviation value; The zero point of the gimbal position memory of the gimbal is marked according to the angle deviation value and the position deviation value to obtain the initial zero point position data.
3. The camera automatic tracking method based on PTZ control according to claim 1, characterized in that: The camera placed on the pan-tilt head collects the environment image, extracts the environment information from the environment image, and obtains the environment information set, wherein the environment information set includes: environment background information and object distribution data, including: The camera placed on the pan-tilt head collects an environmental image, and performs image segmentation on the environmental image to obtain a plurality of segmented images; Perform image feature extraction on each segmented image to obtain pixel features of each segmented image; Performing pixel value segmentation on the pixel features of each segmented image to obtain a first pixel feature and a second pixel feature of each segmented image; Performing background modeling according to the first pixel feature of each segmented image to obtain an environmental background model, and extracting environmental background information of the environmental background model; Performing background separation on the environment image using the environment background model to obtain a separated image; Target detection is performed on the separated image to obtain a plurality of targets, and object distribution analysis is performed on the separated image according to the plurality of targets to obtain the object distribution data.
4. The camera automatic tracking method based on PTZ control according to claim 3 is characterized in that: The target recognition is performed on the environment image according to the environment information set to obtain target object data, wherein the target object data includes: an object boundary box and object position coordinate data, including: Inputting the object distribution data into a convolutional layer of a region-based convolutional neural network to extract distribution features to obtain object distribution features, wherein the region-based convolutional neural network includes: a convolutional layer, a sliding window layer, a region proposal generation layer, a candidate region cropping layer, a pooling layer, and a classification layer; Inputting the object distribution features into the sliding window layer to perform feature dimensionality reduction processing to obtain low-dimensional distribution features; Inputting the low-dimensional distribution features into the region proposal generation layer to perform feature map proposal region screening to obtain a feature map of the proposed region; Inputting the proposed region feature map into the candidate region cropping layer to perform image cropping according to a preset size to obtain a cropped region feature map; Inputting the cropped region feature map into the pooling layer for fixed-size pooling processing to obtain a pooling feature map; Inputting the pooling feature map into the classification layer to extract the target, and obtaining initial object data, wherein the initial object data includes: an initial object bounding box and initial object position coordinate data; The initial object data is corrected by using the environmental background information to obtain the target object data, wherein the target object data includes: an object boundary box and object position coordinate data.
5. The camera automatic tracking method based on PTZ control according to claim 1, characterized in that: The step of inputting the target object data into a Kalman filter algorithm to predict the target movement position and obtain the target movement position data comprises: Inputting the target object data into a Kalman filter algorithm to generate a state vector to obtain a plurality of state vectors; Extracting an observation vector corresponding to the Kalman filter algorithm, and performing a state transfer matrix analysis on the multiple state vectors through the observation vector to obtain a state transfer matrix corresponding to each state vector; According to the state transfer matrix corresponding to each state vector, each state vector is predicted respectively to obtain the predicted state vector corresponding to each state vector; The mobile position data corresponding to the predicted state vector corresponding to each state vector is matched to obtain the target mobile position data.
6. The camera automatic tracking method based on PTZ control according to claim 1, characterized in that: The target moving position data and the initial zero point position data are input into an ant colony optimization algorithm to perform pan-tilt moving path planning, and obtain pan-tilt moving path data, wherein the pan-tilt moving path data includes: pan-tilt rotation angle, pan-tilt moving speed and pan-tilt moving path, including: Performing ant colony parameter matching on the target moving position data to obtain ant colony parameters, wherein the ant colony parameters include: the number of ants and initial state data of each ant; Defining the state space of the pan / tilt, selecting an ant moving path according to the initial state data of each ant, and obtaining the moving path data of each ant; The updated state data of each ant is extracted by moving the movement path data of each ant in the state space of the pan / tilt; Generate multiple movement paths based on the updated state data of each ant and the initial state data of each ant; Perform pheromone concentration analysis on each moving path to obtain pheromone concentration data for each moving path; Path screening is performed on multiple moving paths according to the pheromone concentration data of each moving path to obtain the pan / tilt moving path; The pan / tilt moving path is subjected to pan / tilt moving parameter analysis to obtain the pan / tilt rotation angle and the pan / tilt moving speed.
7. The camera automatic tracking method based on PTZ control according to claim 5, characterized in that: The method of collecting the target object data in real time by using the camera to obtain updated image data, and performing error correction on the pan / tilt moving path data by using the updated image data to obtain the target tracking path includes: Performing real-time updated image acquisition of the target object data through the camera to obtain updated image data; Extracting object movement parameters from the updated image data to obtain object movement distance and object movement angle; Perform error extraction on the target moving position data according to the moving distance of the object and the moving angle of the object to obtain a position error and an angle error; The error correction is performed on the pan / tilt moving path data according to the position error and the angle error to obtain a target tracking path.
8. A camera automatic tracking system based on PTZ control, characterized in that: The camera automatic tracking system based on pan / tilt control includes: The processing module is used to perform zero-point marking processing on the preset PTZ position to obtain the initial zero-point position data of the PTZ; A collection module, used to collect environmental images through a camera placed on the pan-tilt head, extract environmental information from the environmental images, and obtain an environmental information set, wherein the environmental information set includes: environmental background information and object distribution data; A recognition module, configured to perform target recognition on the environment image according to the environment information set to obtain target object data, wherein the target object data includes: an object boundary box and object position coordinate data; A prediction module, used for inputting the target object data into a Kalman filter algorithm to predict the target movement position and obtain the target movement position data; A planning module, used for inputting the target moving position data and the initial zero point position data into an ant colony optimization algorithm to perform pan-tilt moving path planning, and obtaining pan-tilt moving path data, wherein the pan-tilt moving path data includes: pan-tilt rotation angle, pan-tilt moving speed and pan-tilt moving path; The correction module is used to update the image acquisition of the target object data in real time through the camera to obtain updated image data, and to perform error correction on the pan-tilt moving path data through the updated image data to obtain the target tracking path.
9. A camera automatic tracking device based on pan / tilt control, characterized in that: The camera automatic tracking device based on PTZ control includes: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory so that the camera automatic tracking device based on pan-tilt control executes the camera automatic tracking method based on pan-tilt control as described in any one of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instruction is executed by the processor, the camera automatic tracking method based on pan-tilt control as described in any one of claims 1-7 is implemented.
Citation Information
Patent Citations
Camera tracking system based on mean shift ant colony
CN110557567A
Holder offset elimination control method and device, computer equipment and storage medium
CN115840469A
