High-precision vehicle tracking method based on digital image correlationTechnical Field
The invention relates to the technical field of vehicle tracking processing, in particular to a high-precision vehicle tracking method based on digital image correlation.
Background
With the development of the traffic industry of China, the quantity of automobile reserves is continuously increased, and road traffic safety accidents, particularly rear-end collisions, caused by the automobile reserves are high, and according to statistics, 34.29 percent of all highway traffic accidents in China are rear-end collisions. A number of rear-end accidents due to driver inattention have been identified as a major safety issue in automobiles. Therefore, accurate early warning plays an important role in reducing traffic accidents.
Accurate vehicle tracking is closely related to collision early warning, inaccurate tracking can produce the warning untimely on the one hand, can't effectively avoid the traffic accident, and on the other hand can produce the false positive, reduces driver's driving travelling comfort. The traditional meanshift tracking algorithm is simple and good in robustness, but in the tracking process, as the width of a window is kept unchanged, when the background is complex and the target scale is changed, tracking fails, and subsequent calculation cannot be realized; the CMT algorithm is a tracking method based on feature points, a classical optical flow method is used, any object in any scene can be tracked, the tracking frame is changed along with the change of the target dimension, the algorithm consumes a long time in practical application, the tracking is inaccurate in remote tracking, the collision early warning of a remote vehicle cannot be effectively realized, and meanwhile, the median of calculation results of all the feature points is selected as a scaling value when the target dimension is calculated and scaled, and a certain error exists.
Disclosure of Invention
The invention aims to provide a high-precision vehicle tracking method based on digital image correlation, so as to solve the problems in the background technology.
In order to achieve the purpose, the invention provides the following technical scheme:
a high-precision vehicle tracking method based on digital image correlation specifically comprises the following steps:
s1, collecting a positive sample and a negative sample; preprocessing all samples; extracting and calculating a characteristic value; training by using the characteristic values of all samples to obtain a vehicle detection classifier;
s2, unframing the video to be tested, preprocessing the current frame image, extracting and calculating the characteristic value of the current frame image, inputting the characteristic value into a vehicle detection classifier, marking the vehicle image area meeting the similarity index by a marking frame, and taking the vehicle image area marked by the marking frame as an initial tracking area;
s3, intercepting a final tracking area, wherein the final tracking area takes the center of the initial tracking area in the step S2 as the center, and the side length of the final tracking area is 0.8 times of that of the initial tracking area;
s4, zooming the intercepted final tracking area to a fixed size, and zooming the current frame image by adopting the same zooming ratio;
s5, taking the zoomed final tracking area as a reference image subarea and the central point of the reference image subarea as the center, selecting a specific size as an interesting area in the current image, performing subpixel-level search and matching by adopting a digital image correlation method, searching for a target image subarea, indicating that the tracking is successful when ZNSDS is larger than or equal to a set threshold value, and re-marking the target image subarea by using a marking frame; when the value is less than the threshold value, it indicates that the tracking has failed, and the process proceeds to S2.
As a further scheme of the invention: in the step S1, the positive sample selects pictures of the head and the tail of the vehicle with different vehicle types, angles and distances, and the negative sample selects a non-vehicle picture in the driving environment.
As a further scheme of the invention: the specific operation of step S1 is: and performing image graying processing on all samples, normalizing the size to be 24 multiplied by 24, extracting and calculating a Haar-like characteristic value by means of an integrogram, and training by using an AdaBoost algorithm to obtain the AdaBoost vehicle detection classifier.
As a further scheme of the invention: in the step S4: the truncated final tracking area is scaled to 23 x 23 size.
As a further scheme of the invention: in the step S5: and selecting a 35 multiplied by 35 size as a region of interest in the current frame image.
Compared with the prior art, the invention has the beneficial effects that: the method has the advantages that the detected vehicle is taken as a tracking target, sub-pixel level searching and matching are carried out around the target area, and the size of a tracked marking frame is continuously updated, so that the accuracy of vehicle tracking is improved while the real-time performance of an algorithm is ensured, more accurate early warning is realized, and the driving safety is improved; in addition, the method can realize the search and matching at the sub-pixel level, thereby reducing the dependence on a high-resolution camera, reducing the cost and having good application value.
Drawings
FIG. 1 is a schematic flow diagram of the process of the present invention;
FIG. 2 is a diagram of the results tracked using the CMT algorithm;
FIG. 3 is a graph of the results of the tracking by the method 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.
Referring to fig. 1 to 3, the present invention provides a technical solution: a high-precision vehicle tracking method based on digital image correlation specifically comprises the following steps:
s1, collecting a positive sample and a negative sample; preprocessing all samples; extracting and calculating a characteristic value; training by using the characteristic values of all samples to obtain a vehicle detection classifier;
s2, unframing the video to be tested, preprocessing the current frame image, extracting and calculating the characteristic value of the current frame image, inputting the characteristic value into a vehicle detection classifier, marking the vehicle image area meeting the similarity index by a marking frame, and taking the vehicle image area marked by the marking frame as an initial tracking area;
s3, intercepting a final tracking area, wherein the final tracking area takes the center of the initial tracking area in the step S2 as the center, and the side length of the final tracking area is 0.8 times of that of the initial tracking area;
s4, scaling the intercepted final tracking area to 23 multiplied by 23 size, and scaling the current frame image by the same scaling;
s5, taking the zoomed final tracking area as a reference image subarea, taking the central point of the reference image subarea as the center, selecting 35 x 35 size as an interesting area in the current image, adopting a digital image correlation method to search and match at a sub-pixel level, searching a target image subarea, when ZNSD is larger than or equal to a set threshold value, indicating that the tracking is successful, and marking the target image subarea again by using a marking frame; when the value is less than the threshold value, it indicates that the tracking has failed, and the process proceeds to S2.
In step S1, the positive sample selects pictures of the head and the tail of the vehicle with different models, angles and distances, and the negative sample selects non-vehicle pictures in the driving environment, such as: not including trees, roads, sky, etc. of the vehicle.
The specific operation of step S1 is: and performing image graying processing on all samples, normalizing the size to be 24 multiplied by 24, extracting and calculating a Haar-like characteristic value by means of an integrogram, and training by using an AdaBoost algorithm to obtain the AdaBoost vehicle detection classifier.
Firstly, vehicle detection is carried out by using a classical AdaBoost + Haar characteristic detection algorithm, and a detected vehicle is used as an initial tracking area; secondly, considering that the detected vehicle area boundary part contains more backgrounds, the center of the detected vehicle area is taken as the center, and the side length is 0.8 times of the original side length to be taken as the final vehicle tracking area, so that the background interference can be effectively reduced, and the calculation amount is reduced.
As can be seen from FIG. 2 and FIG. 3, the scale scaling of the mark frame tracked by the method of the present invention can perform stable and high-precision tracking, and the CMT algorithm is affected by image noise in the tracking process and has large fluctuation on the scale scaling, especially the CMT algorithm cannot effectively realize accurate tracking at a long distance, and meanwhile, when the angle change of an object is large, a tracking failure is easily caused because a feature point cannot be found. In addition, the method has better tracking real-time performance, greatly reduces the tracking time consumption compared with a CMT algorithm, ensures the precision and reduces the time consumption.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.