Summary of the invention
Based on this, be necessary to provide a kind of based on the high vehicle flowrate method of the accuracy of detection of video.
A kind of vehicle flowrate method, comprise the steps: to define track, and described track is the polygon of sealing; Detect the vehicle of present frame, and the vehicle that is positioned at described track in present frame is formed to the observation list; The state of the vehicle in the existing vehicle list of prediction, described state comprises position, speed and the size of the vehicle in existing vehicle list; Calculate vehicle in described observation list and the degree of association of the vehicle in existing vehicle list, and: when the described degree of association means to observe vehicle in list associated with the vehicle in existing vehicle list, use the state of the vehicle in the observation list to upgrade the state of the vehicle in the existing vehicle list of associated; When the described degree of association means to observe the vehicle in list, be while newly sailing the vehicle in described track into, will observe the vehicle in list add existing vehicle list; When the described degree of association mean in existing vehicle list vehicle not with the observation list in arbitrary vehicle at once, the corresponding vehicle in existing vehicle list is deleted.
In embodiment, the step of the degree of association of the vehicle in the vehicle in described calculating observation list and existing vehicle list specifically comprises therein:
Calculate the matching degree of all existing vehicles and observation, form associated cost matrix:
C
i,j=α·Dist
pos(i,j)+β·Dist
size(i,j)+γ·Dist
hist(i,j);
Wherein: α, beta, gamma are weight coefficient, and alpha+beta+γ=1, α, beta, gamma ∈ [0,1]; Dist
pos(i, j) is the positional distance of j car in i car in existing vehicle list and observation list:
(x
i, y
i) for having the coordinate of i car in the vehicle list, (x
j, y
j) for observing the coordinate of j car in list; Dist
Size(i, j) is the large small distance of i car and j observation:
W
iAnd h
iFor width and the height of i car in existing vehicle list, w
jAnd h
jWidth and height for j car in the observation list; Dist
Hist(i, j) is the histogram distance of j car in i car in existing vehicle list and observation list:
Wherein, { x
k}
K=1 ..., NFor the normalization histogram of i car in existing vehicle list, { y
k}
K=1 ..., NNormalization histogram for j car in the observation list;
Described associated cost matrix is carried out to linear distribution to be solved, obtain row associated allocation array and row associated allocation array, the element in described row associated allocation array and row associated allocation array is for the degree of association of the vehicle and the vehicle in existing vehicle list that mean to observe list.
Therein in embodiment, when the value of i element in described row associated allocation array is 0, its number of times that is 0 is counted, if described count value reaches setting numerical value, mean that the vehicle in existing vehicle list is not corresponding with the arbitrary vehicle in the observation list, the corresponding vehicle in existing vehicle list is deleted;
When the value of i element in described row associated allocation array is not 0, the state of i car in the existing vehicle list of the state renewal associated of i car in use observation list.
In embodiment, described setting numerical value is 5 therein.
Therein in embodiment, the state of i car in described use observation list upgrades in the step of state of i car in the existing vehicle list of associated, adopts Kalman filter or particle filter to proofread and correct.
Therein in embodiment, when the value of i element in described row associated allocation array is 0, its number of times that is 0 is counted, if described count value reaches setting numerical value, mean that the vehicle in the observation list is newly to sail the vehicle in described track into, the described vehicle newly sailed in track is added in existing vehicle list.
In embodiment, described setting numerical value is 3 therein.
In embodiment, in the step in described definition track, receive the vertex information of user's input therein, utilize described vertex information to form the polygon of sealing.
In embodiment, the described vehicle that will be arranged in described track in present frame forms the step of observation list therein, adopt rectangle frame that judgement represents vehicle whether the method in representing the polygon in track judge that vehicle is whether in described track.
In embodiment, in the step of the vehicle of described detection present frame, utilize integration channel characteristics and Adaboost sorter to carry out vehicle detection therein.
In above-mentioned car statistics method, compare by observing vehicle in list and the vehicle in existing vehicle list, realize the accurate tracking to all vehicles in track, thereby realize vehicle flowrate accurately.
Embodiment
Below in conjunction with the drawings and specific embodiments, vehicle flowrate method of the present invention is further described.
As shown in Figure 1, be the vehicle flowrate method flow diagram of an embodiment.The method comprises the steps:
Step S101: definition track.Described track is the polygon of sealing.
Step S102: the vehicle that is positioned at described track in present frame is formed to the observation list.
Step S103: the state of the vehicle in the existing vehicle list of prediction.Described state comprises position, speed and the size of the vehicle in existing vehicle list.
Step S104: calculate vehicle in described observation list and the degree of association of the vehicle in existing vehicle list.
Step S105: the state of the vehicle in the existing vehicle list of the state renewal associated of the vehicle in use observation list.When the described degree of association means to observe vehicle in list associated with the vehicle in existing vehicle list, carry out this step S105.
Step S106: the corresponding vehicle that will have in the vehicle list is deleted.When the described degree of association mean in existing vehicle list vehicle not with the observation list in arbitrary vehicle at once, carry out this step S106.
Step S107: will observe the vehicle in list add existing vehicle list.When the described degree of association means to observe the vehicle in list, be, while newly sailing the vehicle in described track into, to carry out this step S107.
When the vehicle newly sailed into was arranged, vehicle flowrate increased by 1.
In said method, compare by observing vehicle in list and the vehicle in existing vehicle list, realize the accurate tracking to all vehicles in track, thereby realize vehicle flowrate accurately.
The vehicle flowrate method of the present embodiment is carried out statistical vehicle flowrate based on the video analysis that monitoring camera provides, and the basis of analysis is each frame of video in video.
In step S101, described track is the polygon of sealing.This polygon is to utilize the polygon vertex information that the user inputs to form.The technology of often using in graphical analysis is namely that edge is cut apart, although can utilize the edge cutting techniques to differentiate track, utilizes the user to specify summit to form polygon more simple and quick.In the polygonal track of sealing, be namely the target area that the present embodiment method is processed, process the i.e. vehicle in this target area of object.
In step S102, utilize integration channel characteristics and Adaboost sorter to carry out vehicle detection.This integration channel characteristics and Adaboost sorter are this area routine techniquess, are not repeated herein.The vehicle detected adopts the rectangle frame representative.Like this, the rectangle frame that represents vehicle by judgement whether in representing the polygon in track, can judge that vehicle is whether in described track.Judge that whether rectangle frame also belongs to conventional method in polygon, be not repeated herein.The observation list is the vehicle list that is positioned at described track detected.
In step S103, can adopt the state of the vehicle in linear prediction, Kalman filtering or the existing vehicle list of particle filter prediction.Wherein existing vehicle list is the vehicle list of recording in the process of processing video frames.When starting most, this list is empty, and in follow-up processing, and the vehicle that will meet certain condition adds or from list, deleting.Vehicle in existing vehicle list obtains position, speed and the size of all vehicles by predicted state.
In step S104, the step of the degree of association of the vehicle in the vehicle in the calculating observation list and existing vehicle list is specifically calculated the matching degree of all existing vehicles and observation, forms associated cost matrix:
C
i,j=α·Dist
pos(i,j)+β·Dist
size(i,j)+γ·Dist
hist(i,j)。
Wherein: α, beta, gamma are weight coefficient, and alpha+beta+γ=1, α, beta, gamma ∈ [0,1]; Dist
pos(i, j) is the positional distance of j car in i car in existing vehicle list and observation list:
(x
i, y
i) for having the coordinate of i car in the vehicle list, (x
j, y
j) for observing the coordinate of j car in list; Dist
Size(i, j) is the large small distance of i car and j observation:
W
iAnd h
iFor width and the height of i car in existing vehicle list, w
jAnd h
jWidth and height for j car in the observation list; Dist
Hist(i, j) is the histogram distance of j car in i car in existing vehicle list and observation list:
Wherein, { x
k}
K=1 ..., NFor the normalization histogram of i car in existing vehicle list, { y
k}
K=1 ..., NNormalization histogram for j car in the observation list.
Described associated cost matrix is carried out to linear distribution and solve, obtain row associated allocation array u and row associated allocation array v.Element in row associated allocation array u and row associated allocation array v is for the degree of association of the vehicle and the vehicle in existing vehicle list that mean to observe list.Adopt existing linear distribution algorithm can realize that above-mentioned linear distribution solves.
Resulting row associated allocation array u and row associated allocation array v are analyzed respectively, to process accordingly respectively.
I element u in row associated allocation array u
iValue be not 0 o'clock, show the u in i car and the observation list in existing vehicle list
iObservation is corresponding, the state of i car in the existing vehicle list of the state renewal associated of i car in now use observation list.Being specially Kalman filter or particle filter proofreaies and correct.
I element u in row associated allocation array u
iValue be 0 o'clock, its number of times that is 0 is counted, for example adopt the disappearance counter of a correspondence to store this count value.Each while processing a frame video image, if to i element u in should the capable associated allocation array u of video image
iValue be 0, value that should the disappearance counter adds 1.If described count value reaches setting numerical value, in the present embodiment, described setting numerical value is 5, means that the vehicle in existing vehicle list is not corresponding with the arbitrary vehicle in the observation list, and the corresponding vehicle in existing vehicle list is deleted.Can maintain like this real-time of existing vehicle list.
When the value of i element in row associated allocation array v is 0, its number of times that is 0 is counted, while processing a frame video image, if to i element v in should the row associated allocation array v of video image at every turn
iValue be 0, this count value is added to 1.If described count value reaches setting numerical value, in the present embodiment, described setting numerical value is 3, means that the vehicle in the observation list is newly to sail the vehicle in described track into, and the described vehicle newly sailed in track is added in existing vehicle list.
Above-mentioned car statistics method is used all vehicles in integration channel characteristics and Adaboost detection of classifier video, and precision is high.Under the mal-conditions such as, illumination variation intensive at vehicle, shade, sleet, very high verification and measurement ratio and extremely low rate of false alarm are also arranged.Use the associated tracking of overall arest neighbors, still can follow the tracks of accurately all vehicles, the track that obtains travelling in the situation that vehicle is intensive.Can under various illumination, meteorology, road conditions condition, count accurately vehicle flowrate.
The above embodiment has only expressed several embodiment of the present invention, and it describes comparatively concrete and detailed, but can not therefore be interpreted as the restriction to the scope of the claims of the present invention.It should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these all belong to protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be as the criterion with claims.