The method of splicing target tracks and device
Technical field
The present invention relates to Flame Image Process, video monitoring, the method for splicing target tracks in particularly a kind of target following.
Background technology
Moving object detection, to follow the tracks of be the basis of intelligent video monitoring technology, its testing result, tracking results directly affect the later stage incident (such as: invasion, article are left over, article are stolen, vehicle reverse driving etc.) the alert rate of mistake and the false alarm rate that detect.Therefore, the method for moving object detection, tracking has obtained paying close attention to widely.
Publication number is that the one Chinese patent application of CN 1875379A discloses a kind of scope of having considered each matching characteristic and variance, to object tracking and the system in the video image.Publication number is that the one Chinese patent application of CN 101017572A discloses a kind of method of following the tracks of non-rigid object in the frame video sequence that is used in; From video, extract the characteristic that comprises location of pixels and attribute; With covariance matrix of these feature constructions; The purpose that this covariance matrix is used to follow the tracks of changes through manage deformation of body and appearance based on the average update mechanism of Lie algebra as the descriptor of object.
Above-mentioned method for tracking target can be followed the tracks of the target in the ideal scenario, but in the reality because the influence of surrounding enviroment like the light influence, can cause the track fracture of target following, make BREAK TRACK.
In sum, press for a kind of surrounding enviroment that can adapt to of proposition at present and change, solve the splicing target tracks method of target following track fracture.
Summary of the invention
In view of this, fundamental purpose of the present invention is to propose a kind of surrounding enviroment that can adapt to and changes, and solves the splicing target tracks method and the device of target following track fracture.
For achieving the above object, according to first aspect of the present invention, a kind of method of splicing target tracks is provided, this method comprises:
Judge whether to overlap, to the judgement that overlaps of the area of the overlapping region of target of prediction that trend is arranged and newly-generated target, if target of prediction and newly-generated target overlap, think that then target of prediction is a target to be spliced, newly-generated target is a candidate target;
Calculate matching factor, the matching factor of calculated candidate target and target to be spliced;
Accomplishing the coupling of the candidate target in the current frame image calculates; Judge whether that the matching factor of accomplishing interior whole candidate targets of present frame and target to be spliced calculates; If accomplish, then select the optimal candidate target in the current frame image, judge whether to overlap otherwise get back to;
Select the optimal candidate target in the current frame image, in present frame, from candidate target, select with the highest candidate target of object matching coefficient to be spliced as the optimal candidate target;
Judge whether splicing, in the time window of setting, select the optimal candidate target, and judge whether target to be spliced meets the splicing condition,, then handle target to be spliced, judge whether to overlap otherwise get back to if meet the splicing condition;
Handle target to be spliced, the target to be spliced that satisfies the splicing condition is carried out Data Update, data are replaced by the optimal candidate target in the time window, destroy this optimal candidate target simultaneously.
Preferably, the method for judging that overlaps may further comprise the steps:
Calculate the said area tgt_area that the target of prediction of trend is arranged;
Calculate the area overlap_area of the overlapping region of said target of prediction that trend arranged and said newly-generated target;
The ratio R 1 of reference area tgt_area and area overlap_area is if said ratio R 1, then judges saidly have the target of prediction of trend and said newly-generated target to overlap greater than first threshold 1.
Preferably, the method for calculating matching factor is the target to be spliced that trend is arranged for each, when having candidate target, calculates the matching factor of target to be spliced and each candidate target, and said have the target to be spliced of trend to comprise one or more candidate targets; The computing formula of matching factor is following:
C=α·C
dist+β·C
hist+γ·C
area
Wherein, C
DistBe Distance Matching coefficient, C
HistBe histogram matching factor, C
AreaBe area matched coefficient; α, β, γ are respectively Distance Matching weights, histogram coupling weights, area matched weights.
Preferably, Distance Matching coefficient C
DistComputing formula following:
Wherein, x
Pre, y
PreBe respectively the horizontal ordinate and the ordinate of target to be spliced; x
New, y
NewBe respectively the horizontal ordinate and the ordinate of candidate target; Width, height are respectively the width and the height of target to be spliced; Coef is the smallest match coefficient.
Preferably, histogram matching factor C
HistComputing formula following:
Wherein, T
New.hist, T
Pre.hist the histogram of representing candidate target and target to be spliced respectively.
Preferably, area matched coefficient C
AreaComputing formula following:
Wherein, T
New.area, T
Pre.area the area of representing candidate target and target to be spliced respectively.Max (. .), Min (. .) respectively expression get maximal value, minimum value function.
Preferably, said splicing condition comprises: 1) have a frame optimal candidate target at least; 2) rise time of optimal candidate target is later than the time that target to be spliced transfers target of prediction to; 3) time window accumulative total frame number is greater than the 3rd threshold value 3; 4) occurrence number of the mode of optimal candidate target half the greater than the time window totalframes in the time window.
Preferably, said method also comprises a noise filtering disposal route, calculates the ratio R 2 of area of area and the target of prediction of newly-generated target, if this ratio R 2 less than second threshold value 2, then should newly-generated target be thought noise and filtering.
According to second aspect of the present invention, a kind of device of splicing target tracks is provided, this device comprises:
The overlapping judge module is used for the judgement that overlaps of area to the overlapping region of target of prediction that trend is arranged and newly-generated target, if target of prediction and newly-generated target overlap, thinks that then target of prediction is a target to be spliced, and newly-generated target is a candidate target;
The matching factor computing module is used for the matching factor of calculated candidate target and target to be spliced;
Accomplish the coupling computing module of the candidate target in the current frame image; Be used to judge whether that the matching factor of accomplishing interior whole candidate targets of present frame and target to be spliced calculates; If accomplish, then select the optimal candidate target in the current frame image, judge whether to overlap otherwise get back to;
Select the optimal candidate object module in the current frame image, be used in present frame from candidate target select with the highest candidate target of object matching coefficient to be spliced as the optimal candidate target;
Judge whether concatenation module, be used in the time window of setting, selecting the optimal candidate target, and judging whether target to be spliced meets the splicing condition,, then handle target to be spliced, judge whether to overlap otherwise get back to if meet the splicing condition;
Handle object module to be spliced, be used for the target to be spliced that satisfies the splicing condition is carried out Data Update, data are replaced by the optimal candidate target in the time window, destroy this optimal candidate target simultaneously.
Compared with prior art, the advantage of the joining method of target trajectory of the present invention is to adapt to the variation of surrounding enviroment, can solve the problem of target trajectory fracture in the target following process, realizes the splicing of the target trajectory of fracture.The joining method of target trajectory of the present invention like this has range of application widely.
Description of drawings
Fig. 1 shows the process flow diagram according to the method for splicing target tracks of the present invention;
Fig. 2 shows the overlapping figure according to of the present invention one routine target of prediction and newly-generated target;
Fig. 3 shows according to an example of the present invention according to the time window match map that judges whether to splice;
Fig. 4 shows the framework synoptic diagram according to the device of splicing target tracks of the present invention.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, below in conjunction with embodiment and accompanying drawing, to further explain of the present invention.
The present invention is applicable to any target following technology, and the trajectory analysis that can be used for the target following later stage is handled.
Fig. 1 shows the process flow diagram according to the method for splicing target tracks of the present invention.As shown in Figure 1, the method for splicing target tracks of the present invention can comprise:
Judge whether to overlap 101, to the judgement that overlaps of the area of the overlapping region of target of prediction that trend is arranged and newly-generated target, if target of prediction and newly-generated target overlap, think that then target of prediction is a target to be spliced, newly-generated target is a candidate target.
Calculate matching factor 102, the matching factor of calculated candidate target and target to be spliced.
Accomplish the coupling of the candidate target in the current frame image and calculate 103, judge whether that the matching factor of accomplishing interior whole candidate targets of present frame and target to be spliced calculates.If accomplish, then select the optimal candidate target 104 in the current frame image; Judge whether to overlap 101 otherwise get back to.
Select the optimal candidate target 104 in the current frame image, in present frame, from candidate target, select with the highest candidate target of object matching coefficient to be spliced as the optimal candidate target.
Judge whether to splice 105, in the time window of setting, select the optimal candidate target, and judge whether target to be spliced meets the splicing condition.If meet the splicing condition, then handle target 106 to be spliced; Judge whether to overlap 101 otherwise get back to.
Handle target 106 to be spliced, the target to be spliced that satisfies the splicing condition is carried out Data Update, data are replaced by the optimal candidate target in the time window, destroy this optimal candidate target simultaneously.
Fig. 2 shows the overlapping figure according to of the present invention one routine target of prediction and newly-generated target.At first calculate the area tgt_area of the target of prediction (the with dashed lines rectangle is represented in Fig. 2) that trend is arranged, calculate the area overlap_area (in Fig. 2, representing) of the overlapping region of target of prediction and newly-generated target (in Fig. 2, representing) with solid-line rectangle with grey rectangle; Calculate the ratio R 1 of area overlap_area of area tgt_area and the overlapping region of target of prediction then, this ratio R 1 is the overlapping area ratio of this target of prediction and newly-generated target.If said ratio R 1, then judges saidly have the target of prediction of trend and said newly-generated target to overlap greater than first threshold 1, assert that it is target to be spliced that the target of prediction of trend is arranged this moment, newly-generated target is a candidate target.Wherein, first threshold 1 belongs to setting threshold, can set according to the required concrete scene of user, and for example when scene was the warehouse, first threshold 1 can be set at 0.5.
In order to remove the interference of noise targets, can also comprise a noise filtering disposal route in the method for this splicing target tracks.Calculate the ratio R 2 of area of area and the target of prediction of newly-generated target, if this ratio R 2 less than second threshold value 2, then should newly-generated target be thought noise and filtering.Wherein, first threshold 1 belongs to setting threshold, can set according to the required concrete scene of user, and for example when scene was the warehouse, first threshold 2 can be set at 0.1.
For each target to be spliced that trend is arranged, can there be one or more candidate targets (also possibly not have candidate target) in calculating matching factor 102 steps.When having candidate target, calculate the matching factor of target to be spliced and each candidate target.The computing formula of this matching factor is following:
C=α·C
dist+β·C
hist+γ·C
area
Wherein, C
DistBe Distance Matching coefficient, C
HistBe histogram matching factor, C
AreaBe area matched coefficient.α, β, γ are respectively Distance Matching weights, histogram coupling weights, area matched weights.In the present invention, α, β, γ can set according to the actual scene demand, and for example when scene was the warehouse, α, β, γ can be set at 0.5,0.2 and 0.3 respectively.
1) Distance Matching coefficient C
Dist
Wherein, x
Pre, y
PreBe respectively the horizontal ordinate and the ordinate of target to be spliced; x
New, y
NewBe respectively the horizontal ordinate and the ordinate of candidate target; Width, height are respectively the width and the height of target to be spliced.Coef is the smallest match coefficient, and in the present invention, coef can set according to the actual scene demand, and for example when scene was the warehouse, coef can be set at 0.6.
2) histogram matching factor C
Hist
Wherein, T
New.hist, T
Pre.hist the histogram of representing candidate target and target to be spliced respectively.
3) area matched coefficient C
Area
Wherein, T
New.area, T
Pre.area the area of representing candidate target and target to be spliced respectively.Max (. .), Min (. .) respectively expression get maximal value, minimum value function.
Judge whether to splice that the splicing condition comprises described in 105 steps: 1) have a frame optimal candidate target at least; 2) rise time of optimal candidate target is later than the time that target to be spliced transfers target of prediction to; 3) time window accumulative total frame number is greater than the 3rd threshold value 3; 4) occurrence number of the mode of optimal candidate target half the greater than the time window totalframes in the time window.Wherein, mode refers to the maximum number of frequency of occurrence in one group of number.Wherein, the 3rd threshold value 3 belongs to setting threshold, can set according to the required concrete scene of user, and for example when scene was the warehouse, the 3rd threshold value 3 can be set at 5 frames.
More than the concrete numerical value of given each threshold value be an enforceable object lesson, but do not represent all scopes of each threshold value value.
Fig. 3 shows according to an example of the present invention according to the time window match map that judges whether to splice.As shown in Figure 3, Tpredict representes target to be spliced, and Tnew1 representes candidate target 1, and Tnew2 representes candidate target 2.With 5 frames the [t-4 of time window; T] in the frame; Candidate target 1 is complementary in t-4, t-3, t frame and target to be spliced respectively; Candidate target 2 is complementary at t-1 frame and target to be spliced, because the number of times that candidate target 1 and target to be spliced are complementary in this time window half the greater than time window, so candidate target 1 is the optimal candidate target of time window.
Handle in splicing target 106 steps in having obtained time window after the optimal candidate target; Target to be spliced is spliced processing; Upgrade the related data in the tracker simultaneously, the data that are about to target to be spliced replace with optimal candidate target in the time window, destroy this optimal candidate target simultaneously.For the target to be spliced that does not find the optimal candidate target, continue to seek possible candidate target until final destruction.
Fig. 4 shows the framework synoptic diagram according to the device of splicing target tracks of the present invention.As shown in Figure 4, a kind of device 4 of splicing target tracks can comprise:
Overlapping judge module 5 is used for the judgement that overlaps of area to the overlapping region of target of prediction that trend is arranged and newly-generated target, if target of prediction and newly-generated target overlap, thinks that then target of prediction is a target to be spliced, and newly-generated target is a candidate target.
Matching factor computing module 6 is used for the matching factor of calculated candidate target and target to be spliced.
Accomplish the coupling computing module 7 of the candidate target in the current frame image; Be used to judge whether that the matching factor of accomplishing interior whole candidate targets of present frame and target to be spliced calculates; If accomplish, then select the optimal candidate target in the current frame image, judge whether to overlap otherwise get back to.
Select the optimal candidate object module 8 in the current frame image, be used in present frame from candidate target select with the highest candidate target of object matching coefficient to be spliced as the optimal candidate target.
Judge whether concatenation module 9, be used in the time window of setting, selecting the optimal candidate target, and judging whether target to be spliced meets the splicing condition,, then handle target to be spliced, judge whether to overlap otherwise get back to if meet the splicing condition.
Handle object module 10 to be spliced, be used for the target to be spliced that satisfies the splicing condition is carried out Data Update, data are replaced by the optimal candidate target in the time window, destroy this optimal candidate target simultaneously.
Compared with prior art, the invention has the advantages that the variation that can adapt to surrounding enviroment, can solve the problem of track fracture in the target following process, realize the splicing of the target trajectory of fracture.
The above; Being merely preferred embodiment of the present invention, is not to be used to limit protection scope of the present invention, is to be understood that; The present invention is not limited to described implementation here, and these implementation purpose of description are to help those of skill in the art to put into practice the present invention.Any those of skill in the art are easy to further improving without departing from the spirit and scope of the present invention and perfect; Therefore the present invention only receives the restriction of the content and the scope of claim of the present invention, and its intention contains all and is included in alternatives and equivalent in the spirit and scope of the invention that is limited accompanying claims.