CN113516680A - Moving target tracking and detecting method under moving background - Google Patents
Moving target tracking and detecting method under moving background Download PDFInfo
- Publication number
- CN113516680A CN113516680A CN202110778104.5A CN202110778104A CN113516680A CN 113516680 A CN113516680 A CN 113516680A CN 202110778104 A CN202110778104 A CN 202110778104A CN 113516680 A CN113516680 A CN 113516680A
- Authority
- CN
- China
- Prior art keywords
- moving
- moving target
- tracking
- detecting
- image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/215—Motion-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/194—Segmentation; Edge detection involving foreground-background segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/246—Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
- G06T7/251—Analysis of motion using feature-based methods, e.g. the tracking of corners or segments involving models
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/66—Analysis of geometric attributes of image moments or centre of gravity
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Geometry (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a method for tracking and detecting a moving target under a moving background, which comprises the following steps: the moving target detection method comprises the following steps: a1, determining a global motion parameter model; a2, matching parameter estimation feature points; a3, global motion background compensation; a4, extracting a moving target and optimizing; the moving object tracking method comprises the following steps: b1, detecting the moving object, and segmenting the moving object and the background; b2, tracking the moving target by using a KCF algorithm, and calculating to obtain the centroid position of the moving target; and B3, predicting the centroid position of the next frame by using the centroid position of the previous frame image through a Kalman filter, comparing the actual result with the predicted result, calculating the error, and updating the filter. The moving target tracking and detecting method under the moving background provided by the invention has the characteristics of strong discrimination capability of moving target detection, rapid and accurate detection process and good tracking effect.
Description
Technical Field
The invention relates to the technical field of image data processing, in particular to a moving target tracking and detecting method under a moving background.
Background
With the development of artificial intelligence and image processing technology, people can rely on computers to process massive and complicated work and data, the processing technology of image data is continuously updated and developed, and the detection and tracking of targets are taken as important branches of image processing and computer vision, so that the method becomes a research hotspot in recent years.
In the prior art, a hole problem exists in a process of extracting a moving target by a two-frame difference method used in moving target detection under a dynamic background, and a problem of drifting of the moving target and a target frame exists in a tracking process of an existing KCF algorithm. Based on the above problems, it is desirable to provide a new method for tracking and detecting a moving object under a moving background.
Disclosure of Invention
The invention aims to provide a moving target tracking and detecting method under a moving background, which can optimize and perfect the detection of a moving target and the tracking of the moving target under a dynamic background and has the characteristics of strong discrimination capability of moving target detection, rapid and accurate detection process and good tracking effect.
In order to achieve the purpose, the invention provides the following scheme:
a method for tracking and detecting a moving target under a moving background comprises the following steps:
a, detecting a moving target based on a target detection algorithm, specifically comprising:
a1, determining a global motion parameter model;
a2, matching parameter estimation feature points;
a3, global motion background compensation;
a4, extracting a moving target and optimizing;
b, tracking the moving target based on a tracking algorithm fusing a Kalman filtering algorithm and a KCF algorithm, and specifically comprising the following steps:
b1, firstly, detecting a moving object, and segmenting the moving object and the background;
b2, tracking the moving target by using a KCF algorithm, and calculating to obtain the centroid position of the moving target through an external frame of the moving target;
b3, predicting the centroid of the circumscribed frame of the moving target in the detected image of each frame by using a Kalman filter, judging the moving direction of the moving target, matching the obtained tracking image with a maintained template, and comparing the matching result with a matching threshold;
b4, judging whether the tracking deviation occurs, if yes, turning to the step B5, and if not, turning to the step B6;
b5, updating the Kalman filter and the KCF algorithm and continuing to track;
b6, outputting the tracking image.
Optionally, the global motion parameter model in step a1 specifically uses an affine motion parameter model.
Optionally, the matching of the parameter estimation feature points in the step a2 specifically includes: the method comprises the steps of firstly constructing a Hessian matrix by adopting a Surf algorithm, then constructing a scale space, accurately positioning feature points, discarding values smaller than a preset extreme value, screening wrong and unstable extreme points, then selecting a main direction of the feature points, ensuring rotation invariance, and finally generating a Surf feature descriptor for matching.
Optionally, the global motion background compensation in step a3 specifically includes: and detecting and matching the characteristic points by adopting a Surf algorithm, calculating by utilizing the coordinates of the matched characteristic points to obtain a global motion model of the image, and calculating by utilizing the calculated motion model to obtain a background compensation image.
Optionally, the extracting and optimizing the moving object in the step a4 specifically includes: the method comprises the steps of detecting a moving target by using a multi-frame difference method, capturing the moving target as far as possible by using continuous multi-frame images, carrying out image graying, image binarization, image filtering, image enhancement and morphological processing on the detected moving target to obtain a complete moving target image, detecting the contour of the moving target by using a function in OpenCV, and obtaining a minimum circumscribed rectangular frame so as to obtain the position of the moving target.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects: according to the moving target tracking and detecting method under the moving background, the Surf algorithm is adopted for feature point detection and matching, so that the matching process can be faster and more accurate; the least square method is utilized to complete the parameter estimation of the affine motion parameter model, the background matching of the two images is realized, the static conversion of the dynamic background is realized, finally, the improved multi-frame difference method is utilized to solve the problem of cavities in the two-frame difference method, the judgment capability of the motion target detection is enhanced, the cavities are reduced, and the satisfactory detection effect is achieved; aiming at the problem of drift of a moving target and a target frame in the tracking process of a KCF algorithm, the tracking algorithm fusing the Kalman filtering algorithm and the KCF algorithm is provided, so that the drift between the moving target and the target frame can be obviously reduced, and the tracking of the moving target is perfected. The moving target tracking and detecting method under the moving background provided by the invention has the characteristics of strong discrimination capability of moving target detection, rapid and accurate detection process and good tracking effect.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a flow chart of moving object detection of a moving object tracking and detecting method under a moving background according to the present invention;
FIG. 2 is a flowchart of a background global compensation difference method of the moving object tracking and detecting method under a moving background according to the present invention;
FIG. 3 is a flow chart of a Surf algorithm of the moving object tracking and detecting method under a moving background of the present invention;
FIG. 4 is a flowchart of moving object tracking of the moving object tracking and detecting method under moving background according to the present invention;
fig. 5 is a flowchart of a moving object tracking algorithm of the moving object tracking and detecting method under the moving background of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to provide a moving target tracking and detecting method under a moving background, which can optimize and perfect the detection of a moving target and the tracking of the moving target under a dynamic background and has the characteristics of strong discrimination capability of moving target detection, rapid and accurate detection process and good tracking effect.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
The invention provides a method for tracking and detecting a moving target under a moving background, which comprises the following steps: detecting a moving target based on a target detection algorithm, and adopting a background global compensation difference method, as shown in fig. 1 and fig. 2, the method comprises the following steps:
a1, determining a global motion parameter model; the method comprises the following steps that three common motion parameter models are respectively a translational motion parameter model, an affine motion parameter model and a projection motion parameter model, wherein the translational motion parameter model only has two parameters and can only describe translational motion of a camera, the affine motion parameter model is also called a six-parameter affine model and comprises translational motion, zooming motion and rotational motion, and the projection motion parameter model is also called an eight-parameter rotational model and can better describe motion of the camera, but the calculation is more complex, so that the affine motion parameter model is adopted in the method considering that the motion of the camera relates to the motions of translation, zooming and the like;
a2, matching parameter estimation feature points; the Surf algorithm is improved on the basis of the Sift algorithm, firstly, the Surf algorithm builds a Hessian matrix which is the core of the Surf algorithm, then, a scale space is built, then, feature points are accurately positioned, values smaller than a preset extreme value are discarded, wrong and unstable extreme points are screened, then, the main direction of the feature points is selected, the rotation invariance is ensured, and finally, Surf feature descriptors are generated for matching; because the algorithm allows multilayer images in a scale space to be processed simultaneously, the accuracy of the algorithm is improved, the real-time performance is higher, the application is more common, and the basic flow of the Surf algorithm is shown in FIG. 3;
a3, global motion background compensation; the method specifically comprises the following steps: detecting and matching the characteristic points by using a Surf algorithm, calculating by using coordinates of the matched characteristic points to obtain a global motion model of the image, and calculating by using the calculated motion model to obtain a background compensation image;
a4, extracting a moving target and optimizing; for the extraction of the moving target, because background compensation is already carried out, a moving target detection method under a static background can be utilized, and a frame difference method can be used for target detection; detecting a moving target by using a multi-frame difference method, capturing the moving target as much as possible by using continuous multi-frame images, performing image graying, image binarization, image filtering, image enhancement and morphological processing on the detected moving target to obtain a complete moving target image, and finally detecting the contour of the moving target by using a function in OpenCV to obtain a minimum circumscribed rectangular frame so as to obtain the position of the moving target; the image graying is to convert a color image into a grayscale image; the image binarization can also be called thresholding, which is to convert a gray level image into two types of images with gray levels of 255 for one type of pixel value and 0 for one type of pixel value, and process the images by adopting an Otus threshold method, which is also called a maximum inter-class variance threshold selection method and belongs to an adaptive threshold method, namely finding out a gray level histogram of the image, dividing the gray level histogram by using a threshold value, finding out respective variances at two sides of the boundary, and then solving the difference absolute value of the two variances, wherein the divided gray level is the threshold gray level when the absolute value is maximum; image filtering is an important processing means for reducing noise, and the image is subjected to smoothing processing to eliminate the noise, so that the image quality is improved; the image enhancement aims at enhancing the whole or local features of an image, making the original unclear and fuzzy image clear or emphasizing some features which are interesting to a user, and inhibiting the uninteresting features, thereby expanding the difference between the features of different objects in the image; the morphological processing is mainly used for changing the shape of an object and removing irrelevant structures, and generally acts on a binary image to connect adjacent elements or separate the adjacent elements into independent elements;
as shown in fig. 4, the basic flow of tracking a moving object includes: target detection, feature extraction, feature matching, target positioning and subsequent processing; although the method can better realize target tracking, the KCF algorithm can be seen from the tracking effect that the target frame is set to be in a certain size in the tracking process and does not change from beginning to end, and the target frame needs to be kept unchanged due to the fact that a subsequent mechanical control module is involved, but from the tracking effect of the KCF algorithm, for example, a result graph of the 299 th image frame, the KCF algorithm can find that a moving target drifts away from the target frame, and if the moving target cannot be adjusted in time, the target frame can drift continuously, so that the moving target is finally failed to track; therefore, based on the target frame drifting problem, the invention provides a tracking algorithm fusing a Kalman filtering algorithm and a KCF algorithm;
as shown in fig. 5, the tracking algorithm based on the fusion Kalman filter algorithm and the KCF algorithm tracks the moving target, and includes the following steps:
b1, firstly, detecting a moving object, and segmenting the moving object and the background;
b2, tracking the moving target by using a KCF algorithm, and calculating to obtain the centroid position of the moving target through an external frame of the moving target;
b3, predicting the centroid of the circumscribed frame of the moving target in the detected image of each frame by using a Kalman filter, judging the moving direction of the moving target, matching the obtained tracking image with a maintained template, and comparing the matching result with a matching threshold;
b4, judging whether the tracking deviation occurs, if yes, turning to the step B5, and if not, turning to the step B6;
b5, updating the Kalman filter and the KCF algorithm and continuing to track;
b6, outputting the tracking image.
According to the moving target tracking and detecting method under the moving background, the Surf algorithm is adopted for feature point detection and matching, so that the matching process can be faster and more accurate; the least square method is utilized to complete the parameter estimation of the affine motion parameter model, the background matching of the two images is realized, the static conversion of the dynamic background is realized, finally, the improved multi-frame difference method is utilized to solve the problem of cavities in the two-frame difference method, the judgment capability of the motion target detection is enhanced, the cavities are reduced, and the satisfactory detection effect is achieved; aiming at the problem of drift of a moving target and a target frame in the tracking process of a KCF algorithm, the tracking algorithm fusing the Kalman filtering algorithm and the KCF algorithm is provided, so that the drift between the moving target and the target frame can be obviously reduced, and the tracking of the moving target is perfected. The moving target tracking and detecting method under the moving background provided by the invention has the characteristics of strong discrimination capability of moving target detection, rapid and accurate detection process and good tracking effect.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.
Claims (5)
1. A method for tracking and detecting a moving target under a moving background is characterized by comprising the following steps:
a, detecting a moving target based on a target detection algorithm, specifically comprising:
a1, determining a global motion parameter model;
a2, matching parameter estimation feature points;
a3, global motion background compensation;
a4, extracting a moving target and optimizing;
b, tracking the moving target based on a tracking algorithm fusing a Kalman filtering algorithm and a KCF algorithm, and specifically comprising the following steps:
b1, firstly, detecting a moving object, and segmenting the moving object and the background;
b2, tracking the moving target by using a KCF algorithm, and calculating to obtain the centroid position of the moving target through an external frame of the moving target;
b3, predicting the centroid of the circumscribed frame of the moving target in the detected image of each frame by using a Kalman filter, judging the moving direction of the moving target, matching the obtained tracking image with a maintained template, and comparing the matching result with a matching threshold;
b4, judging whether the tracking deviation occurs, if yes, turning to the step B5, and if not, turning to the step B6;
b5, updating the Kalman filter and the KCF algorithm and continuing to track;
b6, outputting the tracking image.
2. The method for tracking and detecting the moving object under the moving background according to claim 1, wherein the global motion parameter model in the step a1 specifically adopts an affine motion parameter model.
3. The method for tracking and detecting the moving object under the moving background according to claim 1, wherein the matching of the parameter estimation feature points in the step a2 specifically includes: the method comprises the steps of firstly constructing a Hessian matrix by adopting a Surf algorithm, then constructing a scale space, accurately positioning feature points, discarding values smaller than a preset extreme value, screening wrong and unstable extreme points, then selecting a main direction of the feature points, ensuring rotation invariance, and finally generating a Surf feature descriptor for matching.
4. The method for tracking and detecting the moving object under the moving background according to claim 1, wherein the global motion background compensation in the step a3 specifically includes: and detecting and matching the characteristic points by adopting a Surf algorithm, calculating by utilizing the coordinates of the matched characteristic points to obtain a global motion model of the image, and calculating by utilizing the calculated motion model to obtain a background compensation image.
5. The method for tracking and detecting the moving object under the moving background according to claim 1, wherein the extracting and optimizing the moving object in the step a4 specifically comprises: the method comprises the steps of detecting a moving target by using a multi-frame difference method, capturing the moving target as far as possible by using continuous multi-frame images, carrying out image graying, image binarization, image filtering, image enhancement and morphological processing on the detected moving target to obtain a complete moving target image, detecting the contour of the moving target by using a function in OpenCV, and obtaining a minimum circumscribed rectangular frame so as to obtain the position of the moving target.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110778104.5A CN113516680A (en) | 2021-07-09 | 2021-07-09 | Moving target tracking and detecting method under moving background |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110778104.5A CN113516680A (en) | 2021-07-09 | 2021-07-09 | Moving target tracking and detecting method under moving background |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113516680A true CN113516680A (en) | 2021-10-19 |
Family
ID=78066608
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110778104.5A Withdrawn CN113516680A (en) | 2021-07-09 | 2021-07-09 | Moving target tracking and detecting method under moving background |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113516680A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114173058A (en) * | 2021-11-30 | 2022-03-11 | 云控智行科技有限公司 | Video image stabilization processing method, device and equipment |
CN114627153A (en) * | 2022-02-21 | 2022-06-14 | 湖北科峰智能传动股份有限公司 | Lobster positioning coordinate compensation method of automatic shrimp peeling machine |
-
2021
- 2021-07-09 CN CN202110778104.5A patent/CN113516680A/en not_active Withdrawn
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114173058A (en) * | 2021-11-30 | 2022-03-11 | 云控智行科技有限公司 | Video image stabilization processing method, device and equipment |
CN114173058B (en) * | 2021-11-30 | 2023-12-26 | 云控智行科技有限公司 | Video image stabilization processing method, device and equipment |
CN114627153A (en) * | 2022-02-21 | 2022-06-14 | 湖北科峰智能传动股份有限公司 | Lobster positioning coordinate compensation method of automatic shrimp peeling machine |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108470354B (en) | Video target tracking method and device and implementation device | |
Eveland et al. | Background modeling for segmentation of video-rate stereo sequences | |
Sen-Ching et al. | Robust techniques for background subtraction in urban traffic video | |
CN103325112B (en) | Moving target method for quick in dynamic scene | |
CN112840373A (en) | Binarization-based and normalization-based patching for removing text | |
CN108596923B (en) | Three-dimensional data acquisition method and device and electronic equipment | |
CN110097050B (en) | Pedestrian detection method, device, computer equipment and storage medium | |
CN109993052B (en) | Scale-adaptive target tracking method and system under complex scene | |
CN113516680A (en) | Moving target tracking and detecting method under moving background | |
CN112184759A (en) | Moving target detection and tracking method and system based on video | |
CN106778712A (en) | A kind of multi-target detection and tracking method | |
Lin et al. | An efficient and robust moving shadow removal algorithm and its applications in ITS | |
Gilly et al. | A survey on license plate recognition systems | |
Huang et al. | Applying convolutional networks to underwater tracking without training | |
CN108280841B (en) | Foreground extraction method based on neighborhood pixel intensity correction | |
CN114648734A (en) | Camera working abnormity detection method based on image processing | |
Nagahashi et al. | Image segmentation using iterated graph cuts based on multi-scale smoothing | |
Sun et al. | Spot segmentation and verification based on improve marker controlled watershed transform | |
KR100566629B1 (en) | System for detecting moving objects and method thereof | |
CN105405109A (en) | Dirty spot detection method based on zonal background modeling | |
Kiratiratanapruk et al. | A gradient-based foreground detection technique for object tracking in a traffic monitoring system | |
Zhu | Moving Objects Detection and Segmentation Based on Background Subtraction and Image Over-Segmentation. | |
CN114820718A (en) | Visual dynamic positioning and tracking algorithm | |
Hu et al. | Moving object detection algorithm based on Gaussian Mixture Model and HSV space | |
Kim et al. | Edge-segment-based background modeling: Non-parametric online background update |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20211019 |