Embodiment
Core concept of the present invention is the camera for fixed viewpoint, add up each position in the display foreground zone of its monitoring and the size of target may occur, and for target newly occurring, judge that according to the target sizes that statistics obtains target newly occurring is single target or multiple goal, then adopts respectively different coupling follow-up mechanism to single target and a plurality of targets.The present invention relates to two treatment schemees, one is the self study treatment scheme, and another is actual tracking treatment scheme, and wherein, the result of self study serves actual tracking.
Fig. 1 is according to the block diagram of video tracking equipment of the present invention.As shown in Figure 1, this equipment comprises background modeling and foreground extracting module, the target numbers determination module, and coupling tracking module, and target information update module, wherein, the coupling tracking module comprises matching module and tracking module.
Keep the appearance object queue that target information appears in a record.
Background modeling and foreground mask extraction module are used for present frame is carried out background modeling and extracts foreground mask, draw foreground area formation in the present frame by foreground mask being carried out connected domain analysis.
The target numbers determination module is used for judging that described each foreground area of foreground area formation comprises single target or a plurality of target, comprises single target and is known as respectively single goal foreground area and multi-target foreground zone with the foreground area that comprises a plurality of targets.
The coupling tracking module is used for adopting different coupling follow-up mechanism to process described single goal foreground area with the multi-target foreground zone respectively, finds the described whole or local corresponding relation that target and described one prospective zone occur respectively occurring in the object queue.
The target information update module is used for upgrading the appearance target information that object queue occurs according to described corresponding relation, the with it information of corresponding appearance target appears in the object queue such as upgrading with one prospective zone or its a part of information, wherein, foreground area or its a part of information can comprise its position and size information; And upgrade simultaneously the supplementary that this target occurs, this supplementary also belongs to and target information occurs, can comprise presenting number of times, losing frame number etc. of target occurring.
Fig. 2 is the process flow diagram that according to an embodiment of the invention self study is processed.
On the one hand, in tracing process, carry out following self study always and process, and learning outcome is served actual tracing process.
As shown in Figure 2, the flow process that self study is processed comprises: at first, the picture frame of inputting is carried out background modeling and extracts foreground mask, foreground mask is carried out connected domain analysis, draw present frame and comprise a plurality of foreground area, namely set up the foreground area formation in the present frame; Then according to the appearance object queue of keeping in the present frame and the foreground area formation that draws, the foreground area in the foreground area formation and the appearance target that occurs in the object queue are mated, draw foreground area and the corresponding relation that target occurs; Upgrade the information that target occurs according to described corresponding relation; Determine to occur whether simple target of target according to the multiframe information that target occurs; Yardstick to the simple target that draws is added up, and draws the yardstick probability model of simple target.The yardstick probability model can be used for aforementioned target numbers determination module to single target or the judgement of a plurality of targets.
Below, the flow process that self study of the present invention is processed is described in detail.
The 201st step, the processing of carrying out background modeling and extracting foreground mask, foreground mask carried out connected domain analysis after, obtain present frame and contain altogether M foreground area, namely set up the foreground area formation of present frame.
In order to record the relevant information of the target that occurred, can keep one in the system and be used for preserving the appearance object queue that target occurs, this formation is initialized as sky, namely do not comprise any target information, the 202nd step of system can be determined foreground area obtained above and the corresponding relation of target occur, and adopt the information updating of foreground area target information to occur in the 203rd step.
The 202nd step, adopt matching algorithm to determine to occur the corresponding relation of target and foreground area, specific algorithm is as follows:
The matching degree of each foreground area in target and the described foreground area formation appears in each that calculate in the current appearance object queue of keeping, and represents with matching value.Can adopt the overlapping area of the rectangular area of rectangular area, place that target occurs and foreground area to draw matching degree; Can draw matching degree according to described overlapping area and the ratio that the rectangular area area of target occurs; Can draw matching degree according to the ratio of the rectangular area area of the rectangular area area that target occurs and foreground area.At last, set up a matching degree matrix with each matching value that target and each foreground area occur.In a further advantageous embodiment, also can utilize the rectangular area of appearance target of prediction and the rectangular area of the foreground area in the present frame to draw matching degree, namely according to the target position in each frame and size information before present frame occurring, can adopt but be not limited to kalman (Kalman) wave filter and set up its parameter model, position and the size of target in present frame appears in prediction, the rectangular area of target in present frame appears in i.e. prediction, then when calculating matching degree, adopt the rectangular area of foreground area in prediction rectangular area that target occurs and the present frame to compare.
After having determined the matching degree of target and each foreground area respectively to occur, can according to but be not limited to following mode and determine corresponding relation:
In the matching degree matrix, find out maximum matching value, think that this maximum matching value corresponding appearance target and foreground area are complementary.Then, all relevant with described coupling foreground area and relevant with the appearance target of described coupling matching degree value are got rid of outside the scope of next time searching maximum matching value, namely from the candidate who seeks maximum matching degree, delete, such as, the matching degree that the appearance target of described coupling foreground area column and described coupling is expert at is set to 0.Maximum matching value is sought in continuation in the matching degree matrix, until do not have the foreground area of coupling and target occurs.
Preferably, a smallest match degree threshold value can be set, think that matching value does not mate less than appearance target and the foreground area of this threshold value.
In the 203rd step, upgrade target information according to the corresponding relation that target and foreground area occur.
The target information that initialization occurs in the object queue is sky; If the current object queue that occurs thinks then that for empty all foreground area all do not have corresponding target;
Target information can comprise position and the size information of target, and presents number of times and lose frame number information.
For target and the foreground area of determining the coupling corresponding relation, with the target information of the foreground area information updating coupling of coupling, and the number of times that presents of target added 1, lose frame number and be set to 0, wherein, described foreground area information can comprise its position and size information.
For there not being foreground area and the target of mating corresponding relation, to occur not having in the object queue frame number of losing of the target of coupling to add 1, do not add to and occur in the object queue as target newly occurring there being the foreground area of coupling in the foreground area formation, and the frame number of losing of this new interpolation target is set to 0, present number of times and be set to 1.If target present number of times greater than its predetermined threshold value, think that this target is a real goal, thereby just it processed in the 204th step below, the 205th step.If target lose frame number greater than its predetermined threshold value, think that this target loses, it is carried out frame losing processes, namely from object queue occurs, delete.
In the 204th step, according to target multiframe information, determine the whether single target that occurs of target.
In the situation that known target information in multiframe can have a lot of methods to judge whether it is the single target that occurs.
Consider that the same state of target between consecutive frame that occur has continuity, a kind of mode is for to judge according to the intensity of variation that the information of target in consecutive frame occurs whether its state has continuity and determine that this target occurs and whether is simple target.
And satisfy the size that successional target information comprises target, and the position, the information such as speed, wherein, the size of target can be target width, object height, perhaps target area.And for adopting minimum boundary rectangle to describe the situation of target, described target width/highly/area is the width// area of the minimum boundary rectangle in target place.
A kind of embodiment is as follows:
Adopt target width or changing value highly and predetermined threshold value comparison in adjacent two frames, if greater than threshold value, think that then the unexpected variation of size has occured target, thinks that its state does not have continuity, thereby think that it is not a simple target, but the merging of target or has separately occured.Only have when target in all consecutive frames the marked change of size occurs not all, think that just target has continuity, be simple target.
A kind of more excellent embodiment judges for the method that adopts position and size information to combine whether the dbjective state of adjacent two frames has continuity.That is to say, adopt the rectangle width of same target in consecutive frame, height and central point are determined the degree of its state variation, determine whether it has continuity.
A kind of position and size information simply utilized determines whether target has successional mode and be: adopt absolute value and the predetermined threshold value of the area difference of target in adjacent two frames to compare, if greater than threshold value, then thinking does not have continuity, otherwise thinks to have continuity.
A kind of concrete compute mode is as follows: hypothetical target corresponding rectangle frame in adjacent two frames is respectively R
1(cx1, cy1, w1, h1) and R
2(cx2, cy2, w2, h2), cx1 wherein, cx2 is respectively the horizontal ordinate of the central point of two rectangle frames, cy1, cy2 is respectively the ordinate of the central point of two rectangle frames, w1, w2 are respectively the width of two rectangle frames, h1, h2 is respectively the height of two rectangle frames, and the distance between the central point of these two rectangle frames is dis=sqrt ((cx1-cx2) so
2+ (cy1-cy2)
2).Thus, can define intensity of variation is:
Wherein, sqrt is extracting operation, and min is for getting the medium and small value computing of two numbers, and max is for getting large value computing in two numbers, and exp is for taking from right exponent arithmetic, and DR and SR are default constant, and the better span of DR is [0.3,3], and the better span of SR is [0.5,2].Adopt intensity of variation obtained above and threshold ratio, if at intensity of variation described in certain consecutive frame greater than threshold value, think that then state does not have continuity, it or not simple target, if all less than threshold value, think then that state has continuity at intensity of variation described in all frames, it is simple target.
In another example, the information of target in present frame that also can obtain with the target information prediction of each frame of front, and adopt the information of forecasting and the real information of target in present frame that obtain to judge relatively whether its state has continuity, and then judge whether this target is same object.A kind of decision procedure is according to target information in each frame before present frame, adopts kalman (Kalman) wave filter to set up the target information model, and the information of target of prediction in next frame.Then judge the continuity of information of forecasting and the current real information of target, and then judge whether target is simple target.
In addition, also can determine whether target is simple target according to the overall variation degree of target multiframe information.A kind of mode for the standard of calculating target multiframe information and threshold ratio, if greater than threshold value, then think not to be simple target, otherwise, think simple target.
In the 205th step, the target scale statistical module is added up the yardstick of simple target according to the simple target result of determination, obtains the yardstick probability model of diverse location place simple target.
The yardstick of target can be for the width of target, highly, girth or area, be used for weighing the big or small degree of target.
According to the projective transformation principle, same target pixel size of diverse location in image is different, therefore, need to be the probability model of each different target scale of position statistics, referred to as the yardstick probability model, this model description the probability distribution of yardstick of this position target.
A kind of simple method is to be target scale probability model of each pixels statistics.But the defective of the method is that the data volume of operand and storage is all larger.A kind of better method is at first being divided into image different subregions, and simple mode is for to be divided into respectively P with image along the horizontal and vertical direction, Q part, thus it is regional that image-region is divided into P * Q one's share of expenses for a joint undertaking.Can certainly adopt the mode that is not five equilibrium to divide subregion.Be different subregions, adopt the probability model of this this target information of location of Information Statistics that falls into this regional target.Judge whether target falls into this regional mode and can select, and judges whether the central point of this target falls into this zone, if fall into, thinks that then target falls into this zone.
Above-mentioned probability model also has a variety of selections, such as the mode that can be adopted as a Gauss model of every sub regions statistics.But, because the target in the image may comprise a plurality ofly, such as existing people, vehicle is arranged again, therefore, adopt a Gauss model can not react the different big or small of different target.A kind of more effective mode is for adopting gauss hybrid models to carry out probability statistics.The mode of statistics target scale probability distribution can also be selected the mode of the histogram distribution of statistical yardstick.
Adopt to divide subregion and adopt gauss hybrid models to carry out the embodiment of probability statistics as follows:
At first, whole image is divided into a plurality of zonules, is GMM model of each zonule initialization.Secondly, with simple target in multiframe information width and highly form one group of parameter, this parameter group is inserted the GMM model of this target's center pixel zonule of living in.
If this GMM model is not also set up gaussian kernel, then set up a gaussian kernel for this initialized GMM model, the average of this gaussian kernel is this parameter group, and setting its covariance matrix value is default value, and setting its weight is 1.
If there has been gaussian kernel in this GMM model, then to judge and insert parameter value and the mahalanobis distance at this gaussian kernel center and the relation of predetermined threshold value, the size of described threshold value and zonule is relevant.If the minimum mahalanobis distance of all gaussian kernel and insertion parameter value is less than threshold value in this GMM model, then think and insert parameter value and this gaussian kernel coupling, adopt and insert average and the covariance matrix value that parameter value upgrades this gaussian kernel, and the weight of this gaussian kernel is added 1; If the minimum mahalanobis distance of all gaussian kernel and insertion parameter value is greater than threshold value in this GMM model, think that then this insertion parameter value does not meet any existing gaussian kernel, then a newly-built gaussian kernel in this GMM model, and set its average and be this insertion parameter value, its covariance matrix is default value, and setting its weight is 1.
Further, the maximum number that can set gaussian kernel in the GMM model is U, and U is that the number that may occur the object yardstick in the scene adds 1, and such as occurring car and truck two class yardsticks in the scene, the value of then setting U is 3.Thereby, when in the GMM model, needing a newly-built gaussian kernel, if existing gaussian kernel number has reached limit value U in this GMM model, then delete first the gaussian kernel of its weight minimum, and then with newly-built gaussian kernel as new gaussian kernel.
Further, in order to upgrade faster, namely forget target component in the past, can be before each frame be processed, the weight with all already present gaussian kernel becomes original α doubly first, i.e. w
N+1=α * w
n, carry out again above-mentioned processing, wherein α has determined the speed forgotten, it is 0 to 1 constant, w
N+1Be the weight of the gaussian kernel of present frame, w
nWeight for the gaussian kernel of former frame.
Further, in order to get rid of the interference of noise, more excellent mode is that the GMM model that further above-mentioned study is drawn is processed with filtering noise before yardstick probability model obtained above is used for actual the tracking.A kind of mode is as follows: in the definition GMM model normalized weight of each gaussian kernel be this gaussian kernel weight divided by all gaussian kernel weights in the model with, if normalized weight greater than setting threshold, such as 5%, thinks that then this gaussian kernel is effective; Otherwise, think that the occurrence frequency of the corresponding target of this gaussian kernel is too little, do not consider, namely this gaussian kernel is invalid, deletes from mixture model.
By above-mentioned processing, obtain the gauss hybrid models of diverse location place simple target, then described gauss hybrid models is applied in the actual tracking processing.
Fig. 3 is the actual according to an embodiment of the invention process flow diagram of processing of following the tracks of.
On the other hand, carrying out simultaneously actual tracking processes.
As shown in Figure 3, at first foreground mask is carried out connected domain analysis, draw present frame and comprise a plurality of foreground area, namely set up the foreground area formation in the present frame; Then the learning outcome that draws according to self study, namely the yardstick probability model of the simple target at diverse location place is judged in the foreground area formation to comprise single target or a plurality of target in each foreground area; According to judged result, respectively simple target is adopted different coupling follow-up mechanism with multiple goal, adopt matching algorithm to determine to occur the corresponding relation of target and described foreground area to the single goal foreground area, adopt track algorithm to determine to occur the corresponding relation of the regional area of target and described foreground area to multi-target foreground zone, final updating target information and with its output.
Below, actual flow process of following the tracks of of the present invention is described in detail.
The 301st step, adopt the foreground extraction technology to obtain foreground mask, and and then adopt connected domain analysis method to obtain foreground area;
Keeping one object queue occurs and target information occurs with preservation;
In the 302nd step, determine to comprise in the foreground area single target or a plurality of target according to the yardstick information of each foreground area.
The simplest a kind of mode is to adopt yardstick and the predetermined threshold value mode relatively of foreground area, if the yardstick of foreground area, thinks then that this foreground area is the single goal zone less than threshold value, otherwise, think the multiple goal zone.
A kind of more excellent decision method is, judges that according to the simple target yardstick probability model that yardstick and the learning process of foreground area obtains foreground area comprises single target or a plurality of target.
A kind of feasible method is input in the simple target yardstick probability model obtained above for the yardstick with foreground area, and the yardstick that obtains foreground area meets the probability of simple target yardstick probability model.If described probability, thinks then that target is not single target less than threshold value, otherwise, think that target is single target.
For the method that adopts gauss hybrid models as the yardstick probability model, better mode is for only containing a target in the supposition one prospective zone, the yardstick input information of this foreground area in the GMM model at this place, target position, is found the minimum mahalanobis distance of each effective gaussian kernel of yardstick information and gauss hybrid models.If this distance, thinks then that current foreground area only comprises the target of the corresponding yardstick of this gaussian kernel less than threshold value; Otherwise, think that current region comprises a plurality of targets.
The 303rd step, different coupling follow-up mechanism is adopted respectively in single goal foreground area and multi-target foreground zone, that is, the single goal foreground area is adopted matching algorithm, track algorithm is adopted in the multi-target foreground zone.
So-called matching algorithm is made foreground area as a whole exactly, determines the corresponding relation of target in the whole and object queue of the foreground area that obtains; And track algorithm is not then made foreground area as a wholely, but adopts topography's range searching algorithm, determines to be arranged in the regional area image the most close with target object queue on the foreground area.
In the 303-1 step, the single goal foreground area is handled as follows:
Each the matching degree of target and each single goal foreground area occurs in the calculating present frame.Can adopt the overlapping area of the rectangular area of rectangular area that target occurs and foreground area to draw matching degree; Or draw matching degree according to the ratio of the area in described overlapping area and target rectangle zone; Or draw matching degree according to the ratio of target area and region area.At last, set up a matching degree matrix with each target and each regional matching value.
After having determined the matching degree of target and each single goal foreground area respectively to occur, can according to but be not limited to following mode and determine the single goal foreground area and the corresponding relation of target occurs:
In the matching degree matrix, find out maximum matching value, think that this maximum matching value corresponding appearance target and foreground area are complementary.Then, all matching degree value relevant with described coupling foreground area and that be correlated with described coupling target are got rid of outside the scope of next time searching maximum matching value, namely from the candidate who seeks maximum matching degree, delete, such as, the matching degree that described coupling foreground area column and described coupling target are expert at is set to 0.Maximum matching value is sought in continuation in the matching degree matrix, until do not have foreground area and the target of coupling.
Preferably, a smallest match degree threshold value can be set, think that matching value does not mate less than target and the foreground area of this threshold value.
In the 303-2 step, appearance target and the multi-target foreground zone of not mating is handled as follows:
Adopt track algorithm to determine the appearance target of not mating and the corresponding relation in multi-target foreground zone.Tracking has a lot of prior aries, preferably, can adopt mean shift (mean shift) or particle filter (Particle Filter) algorithm.This foreground area is regional as mother, and search for therein the subregion that mates most with each target.Preferably, the target sizes of current location can be attached in the mean shift searching algorithm and go.After finding the coupling subregion, the information of this mother zone of deletion and employing coupling subregion is come more fresh target from the foreground area formation.Then, unmatched residue foreground area is carried out connected domain analysis in should the mother zone, find the rectangular area that wherein comprises and it is added in the foreground area formation as new foreground area, add simultaneously, adopt the single goal decision method in the 302nd step to judge that this foreground area is single goal foreground area or multi-target foreground zone.
Continued to adopt the 303rd step that the remaining foreground area of not mating in target and the foreground area formation was processed, until do not find appearance target and the foreground area of new correspondence, finished for the 303rd step and process.
Disposal route to the multi-target foreground zone also can adopt following method, be to obtain the GMM model during tracking module is processed according to self study to rebulid the foreground area formation, and so that in the newly-established foreground area formation each zone comprise simple target, then adopt the matching algorithm in 303-1 step that target is mated tracking, concrete execution in step is as follows.
At first determine the target numbers that all foreground area in the foreground area formation comprise in width and short transverse, this need to all be handled as follows each foreground area in all foreground area:
Suppose that the maximum target number that the one prospective zone comprises at Width is M, the maximum target number that comprises in short transverse is N;
Calculate successively (
,
), m=1 wherein, 2...M; N=1,2...N with its substitution Gauss model, draws the matching degree of each foreground area and GMM model, wherein w
iBe the width of i foreground area, h
iBe its height.In the matching degree result of each foreground area and GMM model, find out m corresponding to maximum matching degree and n, be respectively m
MaxAnd n
Max, think that this foreground area comprises m at Width
MaxIndividual target comprises n in short transverse
MaxIndividual target.
If m
MaxAnd n
MaxIn any one greater than 1, then this foreground area is divided equally according to Width and short transverse and is m
Max* n
MaxIndividual rectangle.With this m
Max* n
MaxIndividual rectangle adds the foreground area formation to as new foreground area, and deletes the former foreground area of being divided equally.
If m
MaxAnd n
MaxBe 1 all, then it does not processed.
Then, adopt matching process in 303-1 step to determine to occur the corresponding relation of single goal foreground area in target and the new foreground area formation.
The 304th step is according to the corresponding relation renewal target information of above-mentioned the 303rd appearance target that obtains of step with foreground area.
The target information that initialization occurs in the object queue is sky; If the current object queue that occurs thinks then that for empty all foreground area all do not have corresponding target;
Target information can comprise position and the size information of target, and presents number of times and lose frame number information.
For target and the foreground area of determining the coupling corresponding relation, use the target information of the foreground area information updating coupling of coupling, and the number of times that presents of target is added 1, lose frame number and be set to 0.
For there not being foreground area and the target of mating corresponding relation, will occur not having in the object queue frame number of losing of the target of coupling to add 1.
Do not adopt following method to process to mating foreground area: only not comprise a target if mate foreground area, then it is added to as fresh target and object queue occurs, and the frame number of losing of this new interpolation target is set to 0, present number of times and be set to 1; Otherwise, adopt algorithm of target detection that described zone is analyzed, each target that is wherein comprised is also added it to and object queue occurred, and the frame number of losing of this new interpolation target is set to 0, presents number of times and is set to 1.Algorithm of target detection can be any prior art, such as pedestrian detection algorithm, vehicle detecting algorithm etc.
If target lose frame number greater than its predetermined threshold value, think that this target loses, it is carried out frame losing processes, namely from object queue occurs, delete.
Because the coupling foreground area after processing through above-mentioned matching tracking method all only comprises a target, overcome by shade, the problem of the foreground object adhesion that noise causes has improved the effect of tracking and matching, has improved prior art.By the top description of reality being followed the tracks of processing, should be appreciated that in actual tracing process, can move simultaneously self-learning module, and self-learning module is constantly updated actual tracking and matching module by upgrading the yardstick probability model, improves constantly system performance.And above-mentioned mechanism does not need manual intervention, fully automatically finishes, and has very high practical value.
Obviously, under the prerequisite that does not depart from true spirit of the present invention and scope, the present invention described here can have many variations.Therefore, the change that all it will be apparent to those skilled in the art that all should be included within the scope that these claims contain.The present invention's scope required for protection is only limited by described claims.