Moving Target Detection Method Based on Spatiotemporal Clustering
Through the moving target detection method based on spatiotemporal clustering, image feature points, associated tracks, clustering displacements and spatial clustering are extracted, which solves the problems of poor anti-noise performance and high complexity in the existing technology, and achieves dynamic detection Accurate identification and tracking of targets.
Patent Information
- Application Number
- CN202110909898.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-09
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-08-09
Smart Images

Figure CN113673392B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of moving target detection and proposes a target extraction algorithm for quickly distinguishing dynamic targets from static targets. Background Art
[0002] Moving target detection refers to the ability to identify image changes in a specified area, detect the presence of moving targets and avoid interference caused by light changes. Motion detection, such as MPEG1, is a comparative analysis of key frames generated after encoding. The principle is to divide the image sequence into key frames (I), predicted frames (P frames) and double-inserted inward frames (B frames). The encoded data is processed and compared. Common methods of data processing include:
[0003] (1) Background subtraction: Background subtraction is the most commonly used method, which uses the difference between the current image and the background image to detect the moving area. It can generally provide the most complete feature data, but it is sensitive to changes in dynamic scenes, such as lighting and external interference.
[0004] (2) Temporal difference: Temporal difference is to extract the moving area in the image by using pixel-based temporal difference and thresholding in a continuous image sequence. Temporal difference has strong applicability to dynamic environments, but generally cannot completely extract all relevant feature pixels and cannot distinguish different targets.
[0005] (3) Optical flow: Motion detection based on the optical flow method uses the optical flow characteristics of moving targets that change over time. The advantage of this method is that it can detect independent moving targets even when the camera is moving. However, this method has poor noise immunity.
[0006] Other motion detection methods, such as motion vector detection, are suitable for multi-dimensional changing environments and can make objects moving in a certain direction appear more prominently, but they also have certain limitations in detecting irregularly moving objects.
[0007] In summary, the problems existing in the prior art are: poor anti-noise performance, inability to distinguish different targets, and high algorithm complexity. Summary of the invention
[0008] The purpose of the present invention is to provide a moving target detection method based on spatiotemporal clustering, which can take into account both calculation speed and detection stability, quickly distinguish dynamic targets from static targets in an image sequence, and track dynamic targets to determine the position of the target in the image.
[0009] The technical solution to achieve the purpose of the present invention is:
[0010] A moving target detection method based on spatiotemporal clustering comprises the following steps:
[0011] (10) Image feature point extraction: Perform corner point detection on the target in the initial frame and extract image feature points;
[0012] (20) Feature point track association: Track and detect the extracted image feature points and associate them with tracks;
[0013] (30) Track displacement clustering: According to the difference in displacement between background motion and target motion in image coordinates, motion feature points and background feature points are cut out through clustering;
[0014] (40) Spatial clustering of motion feature points: Based on the spatial differences of different targets in the image, the tracks of feature points on the same target are combined, and the tracks of feature points on different targets are distinguished. At the same time, the track status of each moving target is recorded.
[0015] Compared with the prior art, the present invention has the following significant advantages:
[0016] 1. Improved noise resistance: This method detects feature points on the target, and the disturbed points will be deleted without affecting the overall detection effect. When the target is partially blocked, continuous detection of the target is achieved based on the target features of the unblocked part, overcoming the problem of partial target intersection and occlusion.
[0017] 2. Multi-target recognition: This method accurately classifies the detected feature points and uses the spatial differences of different targets to segment the moving targets into different individuals, thus achieving multi-target recognition.
[0018] 3. Low algorithm complexity: From the perspective of engineering application, this method only detects moving targets in the image and does not specifically identify the targets, which reduces the algorithm complexity while ensuring the algorithm stability.
[0019] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is the main flow chart of the moving target detection method based on spatiotemporal clustering of the present invention.
[0021] Figure 2 This is an example of image SURF corner points obtained by extracting image feature points.
[0022] Figure 3 It is the speed representation of the track.
[0023] Figure 4 is the displacement representation of the track.
[0024] Figure 5 It is the result of temporal clustering of background points and target points.
[0025] Figure 6 It is the moving target cutting to distinguish different targets.
[0026] Figure 7 It is the track identification result at the time of intersection. DETAILED DESCRIPTION
[0027] like Figure 1 As shown, the moving target detection method based on spatiotemporal clustering of the present invention comprises the following steps:
[0028] (10) Image feature point extraction: Perform corner point detection on the target in the initial frame and extract image feature points;
[0029] The (10) image feature point extraction step is specifically as follows:
[0030] Perform SURF corner point detection on the initial frame image to obtain the initial feature point information of the image, and obtain the SURF feature vector of the feature point to obtain the vector description of the feature point.
[0031] SURF corner detection is used to extract all feature points of the image and record the feature vectors of the feature points for matching with subsequent image frames. SURF corner points are an accelerated version of SIFT. In the process of corner point detection, a box filter is used to approximate the LOG filter, an integral map is used to speed up the calculation process, and Haar features are used to describe the feature points. The extracted feature vectors are angle-invariant and scale-invariant.
[0032] The corner points extracted from the image feature points are as follows Figure 2 shown.
[0033] (20) Feature point track association: Track and detect the extracted image feature points and associate them with tracks;
[0034] The detected points are matched using feature vector matching, and their coordinate values in the next frame are recorded.
[0035] The (20) feature point track association step includes:
[0036] (21) Extract the suspected range of the target point:
[0037] According to the image coordinates [u,v] of the target point in the previous frame, the image area with the range of x∈(u-win,u+win],y∈(v-win,v+win+) is selected in the current frame as the suspected target area;
[0038] (22) Extract the SURF feature vector of the feature point:
[0039] According to the definition of SURF feature vector, the feature vector of each point in the area is extracted.
[0040] (23) Matching feature points:
[0041] The feature vectors obtained by (22) are matched with the feature vectors of the feature points in the previous frame respectively to obtain the similarity of the feature vectors; the feature point with the highest similarity is selected as the tracking result of the point in the current frame, and the coordinates of the feature point are recorded.
[0042] The feature vector obtained by (22) is matched with the feature vector of the feature point of the previous frame to obtain the similarity of the feature vector. The similarity calculation formula is as follows:
[0043]
[0044] That is, the angle between the vectors is used as the consideration angle, and the inner product of the vectors (the sum of the corresponding elements) is calculated as the product of the moduli of the two vectors. The higher the similarity, the greater the sim value. The feature point with the highest similarity is selected as the tracking result of the point in the current frame, and the coordinates of the feature point are recorded.
[0045] (30) Track displacement clustering: According to the difference in displacement between background motion and target motion in image coordinates, motion feature points and background feature points are cut out through clustering;
[0046] Based on the principle that the background motion is roughly the same, while the target motion mode is quite different from the background, the moving points with a smaller proportion are cut out through clustering by utilizing the difference in displacement between the two in the image coordinates;
[0047] The (30) track displacement clustering step comprises:
[0048] (31) Track velocity and displacement expression:
[0049] For all feature points, the coordinate difference of the feature points matched in adjacent frames is recorded as the inter-frame velocity of the feature points, and the coordinate difference between the feature points of the current frame and the reference frame is defined as the displacement. The formula is described as follows:
[0050]
[0051]
[0052] Among them, i represents the feature point number, frame represents the current frame number, and refer represents the reference frame number, that is, the initial frame number.
[0053] (32) Mean shift clustering algorithm
[0054] Assuming that there are many data points in a multidimensional space that need to be clustered, the process of Mean Shift is as follows:
[0055] (321) Randomly select a point from the unlabeled data points as the center point and mark it as center;
[0056] (322) Find all the points whose distance from the center is within the threshold bandwidth, record them as set M, and consider these points to belong to cluster c. At the same time, add 1 to the probability that these inner points belong to this class. This parameter will be used for classification in the final step.
[0057] (323) Taking center as the center point, calculate the vector from center to each element in the set M, add these vectors together to get the vector shift;
[0058] (324) Center moves along the direction of shift, and the moving distance is ||shift||, that is, center = center + shift;
[0059] (325) Repeat steps 322, 323, and 324 until the shift size is very small, and remember the center at this time;
[0060] (326) If the distance between the center of the current cluster c and the center of the existing cluster c2 is less than the threshold during convergence, then c2 and c are merged; otherwise, c is taken as a new cluster and one more category is added;
[0061] (327), repeat 321, 322, 323, 324, 325 until all points are marked as visited;
[0062] (328) According to the access frequency of each point in each class, the class with the highest access frequency is taken as the class to which the current point set belongs;
[0063] By definition, the velocity of a feature point is expressed as Figure 3 As shown, the displacement is expressed as Figure 4 shown.
[0064] Simply put, mean shift is to find data points belonging to the same cluster along the direction of increasing density.
[0065] (33) Displacement clustering: Distinguish the background and moving points based on the difference in the movement of background feature points and target feature points.
[0066] Figure 4 The curve marked in the figure represents the displacement of the track composed of feature points within the target range during reference frame detection. Figure 3 Figure 4It can be seen that speed represents the displacement of adjacent frames. The target feature points are not obvious among the background feature points. However, after integration, the difference between the moving target and the background is more obvious. Moreover, the faster the target moves, the greater the difference between the feature points on the target and the background feature points. This difference makes it possible to identify moving targets by displacement.
[0067] Depend on Figure 4 It can be seen that although the displacement span of background feature points at different positions in the image is large, given the large number of feature points and their wide distribution, their displacement has a certain connection and can be distinguished from the target feature points after a certain number of frames. However, for non-specific image sequences, we cannot set the distinction threshold in advance, so we use density clustering for all data, set a higher classification threshold, and classify all feature points into two categories: background points and suspected target points.
[0068] Figure 5 The experimental results of using meanshift clustering algorithm to distinguish background points from moving points according to the track displacement values. The moving points are marked by circles.
[0069] (40) Spatial clustering of motion feature points: Based on the spatial differences of different targets in the image, the feature points on multiple moving targets are distinguished, and the track status of each moving target is recorded at the same time.
[0070] The dynamic points obtained by (33) are all feature points in the image that are different from the background motion. Therefore, it is necessary to further cluster the target feature points in space to distinguish different targets.
[0071] The (40) moving target spatial clustering step comprises:
[0072] (41) Image threshold segmentation: All feature points are divided into three categories: background feature points, suspected feature points, and target feature points. When a feature point is determined to be a suspected moving target feature point and exists continuously for several frames, it is determined to be a target feature point. Then, all moving target points are spatially clustered and cut into different targets.
[0073] In fact, all feature points are divided into three categories: background points, suspected points, and target points. When a feature point is determined to be a suspected moving target feature point and exists for several frames continuously, it is determined to be a target feature point. Then all moving target points are spatially clustered and cut into different targets. The cutting results are shown in the figure below. Figure 6 As shown, the target is marked by a circle.
[0074] (42) Update of moving target track:
[0075] As the number of frames increases, the number of recorded feature point tracks gradually decreases. When the number of tracks decreases to the set threshold, the image is re-detected for feature points, the newly generated feature point tracks are recorded, the displacement of the tracks that have not disappeared is cleared, and they are clustered together with the newly generated feature point tracks. Since the detected new feature points may exist on the detected targets, or different targets are close to each other during the update and are identified as feature points on the same target, the generated tracks need to be merged and split. The rules for merging and splitting tracks are as follows:
[0076] (a) When the newly generated moving target feature point track cannot be spatially merged with the recorded track, it is determined that a new track is generated;
[0077] (b) When the track of the newly generated moving target feature point is always consistent with the recorded track in space, it is determined to be a newly generated feature point on the same moving target;
[0078] (c) When two existing tracks cannot be distinguished by clustering in space, they are considered to have intersected and their original tracks are retained;
[0079] (d) When an original track changes and can no longer remain consistent in space, the target is considered to be split into two targets and marked separately.
[0080] When there are multiple moving targets in the image sequence, the number of targets may change over time, new targets may be generated, and the original targets may disappear, or different targets may intersect during the movement, making the target tracks indistinguishable spatially. In these cases, the recorded feature point tracks need to be updated.
[0081] When different targets intersect, the track judgment is more complicated. The track judgment results when different targets intersect are as follows: Figure 7 As shown, the movement points of different targets are marked by circles.
[0082] This method takes into account both the spatial distribution characteristics of the target and the temporal motion characteristics of the target. The results in this example show that the track detection is accurate.
Claims
1. A moving target detection method based on spatiotemporal clustering, characterized in that: The steps include: (10) Image feature point extraction: Perform corner point detection on the target in the initial frame and extract image feature points; (20) Feature point track association: Track and detect the extracted image feature points and associate them with tracks; (30) Track displacement clustering: According to the difference in displacement between background motion and target motion in image coordinates, motion feature points and background feature points are cut out through clustering; (40) Spatial clustering of motion feature points: Based on the spatial differences of different targets in the image, the feature point tracks on the same target are combined, and the feature point tracks on different targets are distinguished. At the same time, the track status of each moving target is recorded. (41) Image threshold segmentation: All feature points are divided into three categories: background feature points, suspected feature points, and target feature points. When a feature point is determined to be a suspected moving target feature point and exists continuously for several frames, it is determined to be a target feature point. Then, all moving target points are spatially clustered and cut into different targets. (42) Update of moving target track: As the number of frames increases, the number of recorded feature point tracks gradually decreases. When the number of tracks decreases to the set threshold, the image is re-detected for feature points, the newly generated feature point tracks are recorded, the displacement of the tracks that have not disappeared is cleared, and they are clustered together with the newly generated feature point tracks. Since the detected new feature points may exist on the detected targets, or different targets are close to each other during the update and are identified as feature points on the same target, it is necessary to merge and split the generated feature point tracks. The rules for merging and splitting tracks are as follows: (a) When the newly generated moving target feature point track cannot be spatially merged with the recorded track, it is determined that a new track is generated; (b) When the track of the newly generated moving target feature point is always consistent with the recorded track in space, it is determined to be a newly generated feature point on the same moving target; (c) When two existing tracks cannot be distinguished by clustering in space, they are considered to have intersected and their original tracks are retained; (d) When an original track changes and can no longer remain consistent in space, the target is considered to be split into two targets and marked separately.
2. The moving target detection method according to claim 1, characterized in that: The (10) image feature point extraction step is specifically as follows: Perform SURF corner point detection on the initial frame image to obtain the initial feature point information of the image, and obtain the SURF feature vector of the feature point to obtain the vector description of the feature point.
3. The moving target detection method according to claim 2, characterized in that: The (20) feature point track association step includes: (21) Extract the suspected range of the target point: According to the image coordinates [u, v] of the target point in the previous frame, the image area with the range of x∈(u-win,u+win],y∈(v-win,v+win] in the current frame is selected as the suspected target area; (22) Extract the SURF feature vector of the feature point: According to the definition of SURF feature vector, extract the feature vector of each feature point in the suspected target area; (23) Matching feature points: The feature vectors obtained by (22) are matched with the feature vectors of the feature points in the previous frame respectively to obtain the similarity of the feature vectors; the feature point with the highest similarity is selected as the tracking result of the point in the current frame, and the coordinates of the feature point are recorded.
4. The moving target detection method according to claim 3, characterized in that: The (30) track displacement clustering step comprises: (31) Track velocity and displacement expression: For all feature points, the coordinate difference of the feature points matched in adjacent frames is recorded as the inter-frame velocity of the feature points, and the coordinate difference between the feature points of the current frame and the reference frame is defined as the displacement. The formula is described as follows: Among them, i represents the feature point number, frame represents the current frame number, and refer represents the reference frame number; (32) Mean shift clustering algorithm Assuming that there are many data points in a multidimensional space that need to be clustered, the process of Mean Shift is as follows: (321) Randomly select a point from the unlabeled data points as the center point and mark it as center; (322) Find all the points whose distance from the center is within the threshold bandwidth, record them as set M, and consider these points to belong to cluster c. At the same time, add 1 to the probability that these inner points belong to this class. This parameter will be used for classification in the final step. (323) Taking center as the center point, calculate the vector from center to each element in the set M, add these vectors together to get the vector shift; (324) Center moves along the direction of shift, and the moving distance is ||shift||, that is, center = center + shift; (325) Repeat steps 322, 323, and 324 until the shift size is very small, and remember the center at this time; (326) If the distance between the center of the current cluster c and the center of the existing cluster c2 is less than the threshold during convergence, then c2 and c are merged; otherwise, c is taken as a new cluster and one more category is added; (327), repeat 321, 322, 323, 324, 325 until all points are marked as visited; (328) According to the access frequency of each point in each class, the class with the highest access frequency is taken as the class to which the current point set belongs; (33) Displacement clustering: Distinguish the background and moving points based on the difference in the movement of background feature points and target feature points.
