Summary of the invention
The invention provides a kind of method for tracking target based on image block characteristics and tracker, can solve the not high problem of target following accuracy in prior art.
The invention provides a kind of method for tracking target based on image block characteristics, comprise the steps:
Set up the datum target template according to the feature of datum target image block and background image piece;
The feature of the datum target image block in clarification of objective undetermined and described datum target template is carried out similarity relatively;
Determine target location undetermined according to the similarity comparative result.
The described datum target template of setting up is preferably following steps:
Extract described datum target image block and described background image piece;
Extract the feature of described datum target image block and the feature of described background image piece;
The feature of described datum target image block and the feature of described background image piece are carried out identification relatively;
Set up the datum target template of the feature that comprises the datum target image block according to the identification comparative result.
Extract described datum target image block and be preferably following steps: determine the datum target initial position datum target to be divided into one or more subbase standard target image blocks, the position of recording each subbase standard target image block by background modeling or manual the demarcation;
Extract described background image piece and be preferably following steps: choose one or more rectangular areas from the datum target surrounding, choose the background image piece from the rectangular area.
The feature of the feature of described datum target image block or background image piece is preferably: contour feature and/or architectural feature and/or textural characteristics and/or color characteristic and/or motion state feature;
The feature of extracting the feature of datum target image block or background image piece is preferably the centrosymmetric local binary patterns CSLBP that comprises by adding up each pixel in described datum target image block or described background image piece and the histogram of described local binary patterns, extracts the architectural feature of described datum target image block and the architectural feature of described background image piece;
The feature of extraction datum target image block or the feature of background image piece are preferably and comprise by adding up the gradient orientation histogram HOG of described datum target image block or described background image piece, extract the textural characteristics of described datum target image block or the textural characteristics of described background image piece;
The feature of extraction datum target image block or the feature of background image piece are preferably and comprise by adding up the color histogram HOC of described datum target image block or described background image piece, extract the color characteristic of described datum target image block or the color characteristic of described background image piece.
The step of described identification comparison is preferably: based on each feature of datum target image block similarity S with respect to the background image block feature identical with its type, according to formula
Calculate identification d;
If described identification is greater than the identification threshold value preferably the feature of this datum target image block is listed in described datum target template.
Described feature in clarification of objective undetermined and described datum target template is carried out the similarity comparative optimization is following steps: extract current location image block to be set the goal; Extract the feature of current location target image piece undetermined; Each feature of current location target image piece undetermined and the feature of all same types in the datum target template are carried out similarity relatively; If the maximal value of similarity more than or equal to matching threshold the feature of current location target image piece undetermined corresponding to the maximal value of described similarity be considered as waiting to set the goal successful matching characteristic.
Describedly determine that target location undetermined is preferably following steps: the feature off-set value of calculating the relatively described successful matching characteristic of waiting to set the goal of feature in datum target template corresponding to the maximal value of similarity; Feature off-set value according to all calculated datum target template off-set value; Determine target location undetermined according to described datum target template off-set value and a upper position to be set the goal, described target location undetermined is considered as current location to be set the goal.
Feature in described datum target template can comprise matching characteristic formation and the formation of reserve feature, can comprise in described matching characteristic formation for carrying out similarity matching characteristic relatively with clarification of objective undetermined, can comprise the standby matching characteristic that is used for carrying out with clarification of objective undetermined the similarity comparison in the formation of described reserve feature;
Described similarity comparative optimization is following steps: extract current location image block to be set the goal; Extract the feature of current location target image piece undetermined; Each feature of current location target image piece undetermined and the feature of all same types in the datum target template are carried out similarity relatively; If the maximal value of similarity more than or equal to matching threshold the feature of current location target image piece undetermined corresponding to the maximal value of described similarity be considered as waiting to set the goal successful matching characteristic; Otherwise the signature in datum target template corresponding to the maximal value of similarity is unsuccessfully; If the frequency of failure greater than setting value, is deleted this feature, and select the feature identical with deleted feature same type to fill up in the matching characteristic formation from the formation of reserve feature.
The present invention also provides a kind of Target Tracking System based on image block characteristics, comprises the module of setting up the datum target template according to the feature of datum target image block and background image piece; The feature of datum target image block in clarification of objective undetermined and datum target template is carried out similarity module relatively; Determine the module of target location undetermined according to the similarity comparative result.
The described module of setting up the datum target template preferably includes: extract datum target image block submodule and extract background image piece submodule, extract the datum target image block feature submodule and extract the feature of background image piece submodule, the feature of described datum target image block and the feature of described background image piece are carried out identification submodule relatively; Set up the submodule of the datum target template that comprises the datum target feature according to the identification comparative result;
The module that feature in described clarification of objective undetermined and datum target template is carried out the similarity comparison preferably includes: extract current location target image piece undetermined submodule, extract current location target image block feature undetermined submodule, with the feature of each feature of current location target image piece undetermined and all same types in the datum target template carry out the submodule of similarity comparison, according to similarity comparative result determine to wait the to set the goal submodule of successful matching characteristic;
Describedly determine that according to the similarity comparative result module of target location undetermined preferably includes: calculate the submodule of the feature off-set value of feature in datum target template corresponding to the maximal value of similarity and the described successful matching characteristic of waiting to set the goal, submodule that feature off-set value according to all calculated datum target template off-set value, determine the submodule of target location undetermined according to datum target template off-set value and a upper position to be set the goal.
By the invention provides, can reach following effect:
One, the target following accuracy improves.The present invention proposes the method for using based on image block, namely use the moving target various piece is extracted the method that feature generates templates of moving objects, and the scheme of carrying out motion target tracking with multiple characteristics of image, can evade moving target is blocked, the institutes such as moving target posture conversion cause the global feature problem that great changes have taken place on single-frame images of moving target, thus the accuracy that can improve motion target tracking.
Two, antijamming capability strengthens.The present invention uses the manifold mode of image block to implement comprehensive the tracking to moving target, and adopts architectural feature, textural characteristics, color characteristic that it is expressed, and effectively raises antijamming capability.
Three, online updating saves time.The present invention adopts production to obtain templates of moving objects, it is also the method for small-sample learning, saved the plenty of time of off-line learning templates of moving objects, also make template more press close to moving target, again in conjunction with the method for online updating, make template more complete to the expression of moving target, and consuming time shorter.
Embodiment
Technical scheme below with reference to accompanying drawing 1,2,3 or 4 pairs of various embodiments of the present invention is carried out clear, complete description, and obviously, described embodiment is only a part of embodiment of the present invention, rather than whole embodiment.Based on a kind of method for tracking target of the present invention and tracker, can solve the not high problem of target following accuracy in prior art.
The invention provides a kind of method for tracking target based on image block characteristics, comprise the steps:
Set up the datum target template according to the feature of datum target image block and background image piece;
The feature of the datum target image block in clarification of objective undetermined and described datum target template is carried out similarity relatively;
Determine target location undetermined according to the similarity comparative result.
The described datum target template of setting up generally includes following steps:
Extract described datum target image block and described background image piece;
Extract the feature of described datum target image block and the feature of described background image piece;
The feature of described datum target image block and the feature of described background image piece are carried out identification relatively;
Set up the datum target template of the feature that comprises the datum target image block according to the identification comparative result.
Fig. 1 step 101: extract datum target image block and background image piece;
Extracting described datum target image block can comprise: determine the datum target initial position by background modeling or manual the demarcation, datum target is divided into one or more subimage blocks, record the coordinate of each subimage block;
Be specially: obtain the first frame from video, reach datum target initial position in the first frame, this initial position can obtain by modules such as background modelings, perhaps uses manually and demarcates.The datum target initial position is defined as<x, y, w, h 〉, wherein x is the horizontal ordinate of datum target initial position, and y is the ordinate of datum target initial position, and w is the width of datum target, and h is the height of datum target.
Then according to predefined sampling step frequency r, the image block number that datum target is divided into is: N=[(w-s)/r+1] * [(h-s)/r+1], the datum target image block is expressed as
Wherein i is the image block index, and s is the height and width of image block, and its size is s*s.With reference to Fig. 2, for each image block P
i, also need to record its coordinate
So just obtained required formation datum target image block.
Extracting described background image piece can comprise: choose one or more rectangular areas from the datum target surrounding, choose image block from the rectangular area;
Be specially: when choosing the datum target image block, the datum target surrounding is got the background image piece under motion state, the scope of getting is four rectangles, four rectangles can be covered with the zone of datum target surrounding, also can not be covered with the zone of target surrounding, four rectangles can be big or small homogeneous, identical, also can big or small heterogeneity, not identical; When the position of datum target is<x, y, w, h〉time, evenly get image block in this zone, obtain
Individual image block, wherein s is width and the height of background image piece, consistent with the datum target tile size, the background image piece is expressed as { P
bj}
j=1 N, with reference to Fig. 3.
A kind of implementation that the extracting method of above datum target image block and background image piece only extracts for image block, in specific implementation, sampling step size frequently can be set according to the situation of arithmetic capability, step, the less image block that obtains was more much more intensive frequently, and capability requirement is also larger.For common computer (3G hertz CPU), the step frequently arranges and is generally 4, and the step of double-core frequently can be made as 1.If arithmetic capability allows, also can be with the image block zone of extracting as a setting, the zone of all non-moving targets.In the video edge, if the distance at moving target and video edge directly abandons using this respective regions less than the size s of image block, do not use it to carry out the extraction of background image piece for moving target.
Fig. 1 step 102, extract datum target image block characteristics and background image block feature:
The feature of the feature of described datum target image block or background image piece is preferably: contour feature and/or architectural feature and/or textural characteristics and/or color characteristic and/or motion state feature;
The feature of extraction datum target image block or the feature of background image piece are preferably and comprise: by adding up the gradient orientation histogram HOG of described datum target image block or described background image piece, extract the textural characteristics of described datum target image block or the textural characteristics of described background image piece;
Specific algorithm is: be at first that gray scale represents with all pixel transitions in datum target image block or background image piece, then calculate the centrosymmetric local binary patterns of all pixels in datum target image block or background image piece.Account form is as follows, as reference Fig. 4, datum target or background pixel gray-scale value is designated as g0, and around it, gray-scale value of 8 pixels is designated as g
1~g
8, the centrosymmetric local binary patterns of this pixel is calculated as follows:
CSLBP(p
0)=S(|g
1-g
5|)*2
0+S(|g
2-g
6|)*2
1+S(|g
3-g
7|)*2
2+S(|g
4-g
8|)*2
3
Wherein S (x) is a two-valued function, and is as follows:
Wherein t is default two-valued function threshold value
After processing like this, we have just obtained the centrosymmetric local binary patterns of each pixel in datum target image block or background image piece, and the scope of its value is 0-15.
Then datum target image block or background image piece zone are divided into four block (upper lefts, the upper right, the lower-left, the bottom right, decile), the pixel of each block is corresponded in 16 passages (value) of this block, and the value that counts all passages of each block links the architectural feature that has just obtained this image block again.
The feature of extraction datum target image block or the feature of background image piece are preferably and comprise: by adding up the color histogram HOC of described datum target image block or described background image piece, extract the color characteristic of described datum target image block or the color characteristic of described background image piece.
Specific algorithm is: at first all pixel transitions with datum target image block or described background image piece zone are that gray scale represents, then use two filtering cores [1,0,1] and [1,0,1]
TTo image block areas filtering, obtain two filtered image blocks respectively, be designated as
Wherein i and j represent respectively horizontal ordinate and the ordinate of pixel.
Then use following formula to calculate gradient:
Its corresponding weights are
Re-use θ=arctan[grad (p
i,j)] try to achieve gradient angle corresponding to each pixel.
Here again 0 to 360 degree is divided into 8 passages, each passage takies 45 degree.Each pixel corresponds to the gradient of oneself in passage, here the isostructure feature equally is divided into each image block four blocks again, each block calculates respectively the value (each pixel is used its weights addition after corresponding to passage) of 8 passages, again all values of four blocks is linked the proper vector of one 32 dimension of generation, this has just consisted of gradient orientation histogram, obtains the textural characteristics of image block.
The feature of extraction datum target image block or the feature of background image piece are preferably and comprise: by adding up the color histogram HOC of described datum target image block or described background image piece, extract the color characteristic of described datum target image block or the color characteristic of described background image piece.
Specific algorithm is: each space with three color spaces of RGB is divided into 4 passages here, and passage 0 respective value is the point of 0-63; Passage 1 respective value is the point of 64-127; Passage 2 respective value are the point of 128-191; Passage 3 respective value are the point of 192-255.Three spaces are combined just 4*4*4=64 Color Channel, and the color value of pixels all in image block is corresponded in corresponding passage, has just obtained the color histogram of this image block.
After having extracted architectural feature, textural characteristics or the color characteristic of all datum target image blocks or background image piece, we have just obtained may have the local feature set based on image block of differentiating performance
Wherein N represents to consist of the number of the image block of moving target.And the local feature set of background image piece
N wherein
BThe number of expression background area image piece, y represents the local feature type.
Fig. 1 step 103: the feature of described datum target image block and the feature of described background image piece are carried out identification relatively; Set up the datum target template of the feature that comprises the datum target image block according to the identification comparative result.
The feature of described datum target image block and the feature of described background image piece are carried out identification relatively; The step of setting up the datum target template of the feature that comprises the datum target image block according to the identification comparative result preferably includes: each feature of datum target image block and the feature of all same types of background image piece are carried out similarity S relatively; According to formula
Calculate identification d; When identification is preferably listed the feature of this datum target image block in described datum target template in greater than the identification threshold value.
Specific algorithm is:
First to the proper vector of datum target image block or background image piece coupling
Add up all dimensions and D
1, D
2, respectively with each dimension of datum target image block and background image block eigenvector respectively divided by own all dimensions and, just calculate the probability distribution of corresponding discrete type, P
1={ p
1,1..., p
1, nAnd P
2={ p
2,1..., p
2, n;
Then calculate the KL distance that can obtain two vectors by following formula:
After the KL distance of each feature of the datum target that each feature of having calculated all formation datum targets is obtained the feature of all same types of background image piece, can obtain the maximal value of KL distance in all couplings, be designated as M.
By following formula: calculate each feature of datum target image block and corresponding KL apart from the similarity S of each feature of the background image piece of maximum:
S(x,y)=1-KL(x,y)/M;
Use following formula that the identification that all occupy the relative background image block feature of datum target image block characteristics is calculated, both can draw the identification d of the feature of this expression datum target image block:
Wherein, the identification of each feature x of d (x) expression datum target, f
iRepresent i single features that consists of datum target, y
iRepresent i characteristic type that consists of the single features of datum target,
Represent j feature that is extracted by the background image piece, its characteristic type is y
i, the similarity of two single features of s (x, y) expression.
Described template is generally the datum target image block characteristics and the set of background image block feature generates.
After having calculated identification, identification and predefined identification threshold value k are compared, if its identification joins in the feature formation of datum target template greater than threshold value k, the characteristic quantity that holds in template can be limited or unlimited, if limited, can set saturation, such as, hold 30, expression has had enough features to carry out the tracking of moving target, gives up the remaining local feature based on image block.
Fig. 1 step 104 is carried out similarity relatively with the feature in clarification of objective undetermined and described datum target template;
Described feature in clarification of objective undetermined and described datum target template is carried out the similarity comparative optimization is following steps: extract current location image block to be set the goal; Extract the feature of current location target image piece undetermined; Each feature of current location target image piece undetermined and the feature of all same types in the datum target template are carried out similarity relatively; If the maximal value of similarity more than or equal to matching threshold the feature of current location target image piece undetermined corresponding to the maximal value of described similarity be considered as waiting to set the goal successful matching characteristic.
Specific algorithm is:
As new image frame I to be set the goal of input
nWhen (n=1,2...), carry out following coupling for all features in the datum target template:
At first, according to current location<x to be set the goal
i, y
i, calculate the region of search that this target signature undetermined is mated, use<x
i-3/2*s, y
i-3/2*s, 3*s, 3*s〉quadruple notation this rectangular area, wherein s is the height and width of image block, then in this rectangular area according to the sampling step frequently r carry out image sampling, obtain N
s=[(3*s-s)/r+1]
2Individual image block (wherein r is designed to the approximate number of s, therefore image block can be paved with match search zone), target image piece undetermined is expressed as
Then according to the type μ of this clarification of objective undetermined
iCarry out feature extraction:
Architectural feature: carry out centrosymmetric local binary patterns and extract;
Textural characteristics: carry out the extraction of gradient orientation histogram;
Color characteristic: carry out the extraction of color histogram;
Characteristic extraction procedure is with Fig. 1 step 102,
After completing, feature extraction just obtained the feature set of our target image piece undetermined
Then with the feature set of target image piece undetermined
In each feature the feature of the datum target image block of same type in the datum target template is carried out the calculating of KL distance one by one, computing method are with Fig. 1 step 103, and obtain maximum matching result (least coupling) M, then can obtain the similarity of the feature in each feature set, account form is as follows:
Use at last formula
Obtain the best target signature undetermined of single features matching effect in the datum target template, record simultaneously similarity
On predefined matching threshold, match hit is described as this similarity R, the single features of current datum target template of mating unsuccessfully mated frame number t continuously
iBe set to 0, and matching result is designated as
Wherein
The center of image block corresponding to best datum target template single features is mated in expression, uses two tuples to be expressed as<x
i, y
i; The index of the feature in the datum target template that p represents to match.If this opposite best matching result R illustrate that it fails to match under predefined matching threshold, this time with regard to direct in current datum target template of mating the datum target image block individual features unsuccessfully mate continuously frame number t
iOn add 1, record it it fails to match number of times.
Fig. 1 step 105 is determined target location undetermined according to the similarity comparative result;
Describedly determine that target location undetermined is preferably following steps: the feature off-set value of calculating the relatively described successful matching characteristic of waiting to set the goal of feature in datum target template corresponding to the maximal value of similarity; Feature off-set value according to all calculated datum target template off-set value; Determine target location undetermined according to datum target template off-set value and a upper position to be set the goal, described target location undetermined is considered as current location to be set the goal.
Specific algorithm is:
To relatively wait the to set the goal calculations of offset of successful matching characteristic matching result of each feature that the match is successful in the datum target template, suppose being characterized as in the datum target template
Its correspondence successful matching characteristic of waiting to set the goal is
The following formula of computing method:
Wherein
Be expressed as<Δ x
i, Δ y
i
Obtaining the skew of each feature that the match is successful uses following formula to calculate the skew of whole datum target template afterwards:
Wherein
Can be expressed as<Δ x Δ y 〉
The last position that just can obtain current goal to be set the goal<x+ Δ x, y+ Δ y 〉, wherein x and y are respectively horizontal ordinate and the ordinate of the upper position of waiting to set the goal.
Fig. 1 step 106 is upgraded the template that consists of datum target according to matching result
Feature in described datum target template can comprise matching characteristic formation and the formation of reserve feature, can comprise in described matching characteristic formation for carrying out similarity matching characteristic relatively with clarification of objective undetermined, can comprise standby matching characteristic in the formation of described reserve feature;
Feature capacity in the matching characteristic formation is limited, represents that these features have enough determined coupling to be set the goal and determined target location undetermined, such as: 30 features; The feature capacity of reserve feature formation also can be for limited, and namely ensure enough features and add and the matching characteristic formation reduce again system's computational burden, such as: 30; After the feature quantity of reserve feature formation reaches some, complete the datum target template and generate step, give up the feature of remaining datum target image block.
Described similarity comparative optimization is following steps: extract current location image block to be set the goal; Extract the feature of current location target image piece undetermined; Each feature of current location target image piece undetermined and the feature of all same types in the datum target template are carried out similarity relatively; If the maximal value of similarity more than or equal to matching threshold the feature of current location target image piece undetermined corresponding to the maximal value of described similarity be considered as waiting to set the goal successful matching characteristic; Otherwise the signature in datum target template corresponding to the maximal value of similarity is unsuccessfully; If the frequency of failure greater than setting value, is deleted this feature, and select to fill up in the matching characteristic formation with the feature of deleted feature same type from the formation of reserve feature.
Specific algorithm is: all features in the matching characteristic formation in the datum target template and the formation of reserve feature are checked, as the continuous failed matching times t of certain feature
iGreater than predefined maximum it fails to match number of times t
maxThe time, directly this feature is deleted from formation;
Then judge whether deleted feature in the matching characteristic formation, if there is deletion directly to select feature to add in the matching characteristic formation from the formation of reserve feature;
Judge whether that again the formation of reserve feature is free, as long as pool queue is free, just again obtain the image block of the formation datum target of datum target current location (position of having upgraded), and the background image piece, obtain during the current feature that identification arranged most joins the formation of reserve feature at applied probability model.Concrete computation process and step 101,102,103 is identical.
Return step 105 when ought obtain new position at last and carry out, the method for taking to detect in real time real-time update is carried out motion target tracking.
The present invention also provides a kind of Target Tracking System based on image block characteristics, comprises the module of setting up the datum target template according to the feature of datum target image block and background image piece; The feature of datum target image block in clarification of objective undetermined and datum target template is carried out similarity module relatively; Determine the module of target location undetermined according to the similarity comparative result.
The described module of setting up the datum target template preferably includes: extract datum target image block submodule and extract background image piece submodule, extract the datum target image block feature submodule and extract the feature of background image piece submodule, the feature of described datum target image block and the feature of described background image piece are carried out identification submodule relatively; Set up the submodule of the datum target template that comprises the datum target feature according to the identification comparative result;
The module that feature in described clarification of objective undetermined and datum target template is carried out the similarity comparison preferably includes: extract current location target image piece undetermined submodule, extract current location target image block feature undetermined submodule, with the feature of each feature of current location target image piece undetermined and all same types in the datum target template carry out the submodule of similarity comparison, according to similarity comparative result determine to wait the to set the goal submodule of successful matching characteristic;
Describedly determine that according to the similarity comparative result module of target location undetermined preferably includes: calculate the submodule of the feature off-set value of feature in datum target template corresponding to the maximal value of similarity and the described successful matching characteristic of waiting to set the goal, submodule that feature off-set value according to all calculated datum target template off-set value, determine the submodule of target location undetermined according to datum target template off-set value and a upper position to be set the goal.
In the present invention, because target is kept in motion, therefore, described datum target is all relatively to wait to set the goal (conversion position), that is to say, datum target also is kept in motion, the feature of datum target image block also is in variable condition, background characteristics also is in variable condition, and still, datum target is relative with waiting to set the goal.
By the invention provides, can reach following effect:
One, the target following accuracy improves, the present invention proposes the method for using based on image block, namely use the moving target various piece is extracted the method that feature generates templates of moving objects, and the scheme of carrying out motion target tracking with multiple characteristics of image, can evade moving target is blocked, the institutes such as moving target posture conversion cause the global feature problem that great changes have taken place on single-frame images of moving target, thus the accuracy that can improve motion target tracking.
Two, antijamming capability strengthens.The present invention uses the manifold mode of image block to implement comprehensive the tracking to moving target, and adopts architectural feature, textural characteristics, color characteristic that it is expressed, and effectively raises antijamming capability.
Three, online updating saves time.The present invention adopts production to obtain templates of moving objects, it is also the method for small-sample learning, saved the plenty of time of off-line learning templates of moving objects, also make template more press close to moving target, again in conjunction with the method for online updating, make template more complete to the expression of moving target, and consuming time shorter.
Several embodiment that mention in the present invention, those of ordinary skills are resulting all other embodiment under the prerequisite of not making creative work, all belong to the scope that the present invention protects.
Various embodiment provided by the invention can be as required combination mutually in any way, the technical scheme that obtains by this combination, also within the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification and not break away from the spirit and scope of the present invention the present invention.Like this, if of the present invention these are revised and within modification belongs to the scope of claim of the present invention and equivalent technologies thereof, the present invention also comprises these changes and modification interior.