Background technology
Traditional video monitoring can not satisfy the demands, and watch-dog is not only wanted energy coding transmission video, also wants to analyze the content in the identification video.And to accomplish this point, most basic requirement is partitioned into moving target exactly in video sequence, just distinguish sport foreground and background.
The moving Object Segmentation method has a lot, roughly can be divided into three major types: optical flow method, frame-to-frame differences point-score, background subtraction point-score.Wherein, the optical flow method operand big and retrain more, though and the frame-to-frame differences point-score calculates simply, form cavity, incomplete target and false target easily, so the comparatively practicality of background subtraction point-score and obtains better effects.Its technical essential is structural setting, then with current picture subtracting background picture to obtain difference image, utilize difference result to be partitioned into moving target at last.So how the most important place of these class methods is structural setting and how upgrades background.
Background subtraction point-score the inside has a class to utilize a plurality of Gaussian distribution to construct and upgrade the background of each picture element, like this when background changes, old background can not abandon yet when producing new background, and when background returns back to old background, algorithm can quick identification go out old background, and need not to adapt to again.Its speed of convergence and segmentation effect are better than general background difference algorithm.Through literature search, find that following paper and patent use this technology, and do not have essential distinction,
W.E.L.Grimson,C.Stauffer,R.Romano,L.Lee,″Using?AdaptiveTracking?to?Classify?and?Monitor?Activities?in?a?Site,″cvpr,p.22,1998?IEEE?Computer?Society?Conference?on?Computer?Vision?andPattern?Recognition(CVPR’98),1998
Stauffer?C,Grimson?W.E.L.Adaptive?background?mixture?modelsfor?real-time?tracking.in?Proceedings.1999?IEEE?Computer?SocietyConference?on?Computer?Vision?and?Pattern?Recognition(Cat.No?PR00149).IEEE?Comput.Soc.Part?Vol.2,1999.
Patent 03151406.5
Patent 200710069927.0
First problem of this technology is that distribution and the emerging distribution at the beginning of each pixel is uncertain, all is endowed bigger variance, and speed of convergence is slower like this, and misjudgement easily.Second problem is the related information of frame before and after not utilizing, the generation that distributes utilizes the value iteration of this each frame of pixel to form fully, the distribution of Chan Shenging does not have association in time like this, not real distribution probably, when this pixel has recovered the background of previous certain distribution by the time, instead because this true distribution is replaced, be prospect and be mistaken as.The 3rd problem is that all color components are done same processing, makes effectively to extract shadow information, causes removing shade from prospect.The 4th problem is that a large amount of divisions, ordering and judgement are arranged, and algorithm logic complexity and calculated amount are big, causes taking out a calculating in present stage, and result of calculation is just accurate inadequately naturally like this.
Generally speaking, this technology is feasible in theory, and practicality is not high, need improve on a large scale just to reach practical purpose.
Summary of the invention
The objective of the invention is to have poor practicability at existing background subtraction point-score, speed is slow, the problem of poor accuracy, invent a kind of through improvement, a plurality of Gaussian distribution of use construct the background in the video sequence and then are partitioned into the moving Object Segmentation method based on a plurality of Gaussian distribution of prospect.
Technical scheme of the present invention is:
A kind of moving Object Segmentation method based on a plurality of Gaussian distribution is characterized in that:
(1), the distribution of all background pixels points of initialization, give the distribution that can not exist in the reality, and weight be made as 0;
(2), the image that collects of accumulation, up to the 2n+1 frame or more than the 2n+1 frame, the image that this moment, desire was handled is a n+1 frame or more than the n+1 frame; The frame that this desire is handled is called present frame;
(3), handle each pixel of present frame successively, each just processed pixel is called present picture element with following method:
A) obtain the three-component arbitrary component of color space of present picture element successively, this component value of this component value of preceding n pixel continuous in time and back n pixel continuous in time calculates their distribution respectively;
B) the still distribution of back n pixel formation of the distribution that the n pixel formed before this component value of judgement present picture element more met;
C) if having and meet, distribute with this and represent this component value of present picture element, change d over to), if do not have, then change f over to);
D) compare one by one with the distribution that meets and all background distributions of this component of present picture element, obtain the degree mp of " similar " mutually, upgrade background distributions, and obtain " similar " weight mpw of corresponding proportion, mp is added in the original weight that distributes again; If all background distributions all with the distribution that is compared not " approaching ", then that distribution of weight minimum in the background distributions is replaced with the distribution that is compared, and the weight of the background distributions that this is new is made as smaller value, as 1;
E) mpw that obtains is added up, all background weight are added up, judge the proportionate relationship of the former with the latter, affiliated under a proportional relationship interval assignment.Change h over to);
F) this deal value of present picture element and all background distributions of this component of present picture element are compared one by one, if this deal value of present picture element by a certain background distributions " acceptance " of this component of present picture element, is then taken out the weight of this background distributions;
G) weight of taking out is added up, all background weight are added up, judge the proportionate relationship of the former with the latter, affiliated under a proportional relationship interval assignment;
H) three-component 3 values corresponding to present picture element that will calculate above add up, if surpass certain threshold value, judge that then this point is the foreground point, otherwise are background;
(4), make total system " forget " background in past gradually, so that system adapts to the change of background;
(5), obtain the 2 values image that a width of cloth only comprises prospect and background this moment, can use corrosion and expansion algorithm in addition perfect, re-use the connection algorithm and obtain each sport foreground.
Beneficial effect of the present invention:
1, the pixel value of frame directly calculated distribution before and after the present invention utilized, and was adjusted according to follow-up distribution.And general many Gaussian distribution method is very rough initial distribution of hypothesis, moves closer to true distribution again.Therefore the present invention more accurately fast.
2, the present invention distinguish the time go up isolated point and and the time point that distributes and be associated before and after going up, the present invention just can only write down the distribution that forward-backward correlation is arranged of necessary being like this, and only upgrade background distributions with the distribution of necessary being, and general many Gaussian distribution method can be used as same distribution to the color component of no time correlation, and instead the distribution of this falseness has replaced real background distributions.Therefore the present invention more quick and precisely.
3, the present invention both can adopt the color space that brightness such as rgb and aberration mix, the color space that also can adopt brightness such as yuv to separate with aberration.And when adopting the latter, can adopt different computing method, thereby effectively extract shadow information and got rid of YUV.And general many Gaussian distribution method does not have this ability, makes shadow image appear in the prospect yet, so that disturbs location and identification to object.Therefore the present invention more quick and precisely.
4, logic of the present invention is simple relatively, and has avoided a lot of divisions consuming time, ordering and judgement, existing typical hardware to have enough computing powers to carry out pointwise and calculated in real time, makes the present invention can be partitioned into small moving object.Therefore the present invention more quick and precisely.
Embodiment
The present invention is further illustrated below in conjunction with embodiment.
A kind of moving Object Segmentation method based on a plurality of Gaussian distribution may further comprise the steps:
(1), the distribution of all background pixels points of initialization, give the distribution that can not exist in the reality, and weight be made as 0;
(2), the image that collects of accumulation, up to the 2n+1 frame or more than the 2n+1 frame, the image that this moment, desire was handled is a n+1 frame or more than the n+1 frame; The frame that this desire is handled is called present frame;
(3), handle each pixel of present frame successively, each just processed pixel is called present picture element with following method:
A) obtain the three-component arbitrary component of color space of present picture element successively, this component value of this component value of preceding n pixel continuous in time and back n pixel continuous in time calculates their distribution respectively;
B) the still distribution of back n pixel formation of the distribution that the n pixel formed before this component value of judgement present picture element more met;
C) if having and meet, distribute with this and represent this component value of present picture element, change d over to), if do not have, then change f over to);
D) compare one by one with the distribution that meets and all background distributions of this component of present picture element, obtain the degree mp of " similar " mutually, upgrade background distributions, and obtain " similar " weight mpw of corresponding proportion, mp is added in the original weight that distributes again; If all background distributions all with the distribution that is compared not " approaching ", then that distribution of weight minimum in the background distributions is replaced with the distribution that is compared, and the weight of the background distributions that this is new is made as smaller value, as 1;
E) mpw that obtains is added up, all background weight are added up, judge the proportionate relationship of the former with the latter, affiliated under a proportional relationship interval assignment.Change h over to);
F) this deal value of present picture element and all background distributions of this component of present picture element are compared one by one, if this deal value of present picture element by a certain background distributions " acceptance " of this component of present picture element, is then taken out the weight of this background distributions;
G) weight of taking out is added up, all background weight are added up, judge the proportionate relationship of the former with the latter, affiliated under a proportional relationship interval assignment;
H) three-component 3 values corresponding to present picture element that will calculate above add up, if surpass certain threshold value, judge that then this point is the foreground point, otherwise are background;
(4), make total system " forget " background in past gradually, so that system adapts to the change of background;
(5), obtain the 2 values image that a width of cloth only comprises prospect and background this moment, can use corrosion and expansion algorithm in addition perfect, re-use the connection algorithm and obtain each sport foreground.
Below be that the present invention is further illustrated for example with an example.
This example adopts the yuv color space, and y is adopted different processing with the uv component.Concrete treatment step is as follows:
1, the background distributions of all pixels of initialization, so 3 distributions of each color component are totally 9 distributions of each pixel.Each distribution is initialized as average 1, mean square deviation 1, weight 0.
2, continuous acquisition 2n+1 two field picture calculates at the n+1 frame then.This example is gathered the 2*4+1=9 frame, and the 5th frame is a present frame.
3, each present picture element is done following calculating, and each background distributions of the y component of present picture element is called curybdi, and each background distributions of the uv component of present picture element is called curjbdi, i=0,1,2.j=u,v。
A) obtain the value of this pixel y component, be called cury, obtain the value of the same component of preceding 4 frame co-located pixels, obtain the value of the same component of back 4 frame co-located pixels.
B) obtain the average and the mean square deviation of the y component value of preceding 4 frame co-located pixels, obtain the average and the mean square deviation of the y component value of back 4 frame co-located pixels.
C) absolute value of the difference of the average of calculating cury and front and back distribution.Try to achieve that distribution of absolute value minimum, be called maxyhit.If this absolute value is less than 2.5 times of mean square deviations of maxyhit, and the mean square deviation of maxyhit changes d over to less than certain threshold value), otherwise change i over to).
D) maxyhit and curybdi being done comparison one by one, obtain 2 similarity degree, is a number percent, is called mpi.And obtain the similar weight mpwi that obtains in the curybdi according to mpi.The weight * mpi of mpwi=curybdi.
E) upgrade the average * mpi/8 of average * (1-mpi/8)+maxyhit of average=curybdi of curybdi:curybdi with mpi, the mean square deviation * mpi/8 of the mean square deviation * of mean square deviation=curybdi of curybdi (1-mpi/8)+maxyhit.Weight+mpi of weight=curybdi of curybdi.
F) if mpi, thinks then that maxyhit is similar to curybdi greater than certain threshold value.
G) all mpwi are added up, the weight of all curybdi is added up, use the former then, obtain a number percent p divided by the latter.If p is less than 0.2, my=2 then; P is less than 0.8 else if, then my=0; Otherwise my=-2.
H) if maxyhit and all curybdi are dissimilar, then distribute and replace that curybdi of weight minimum with this, its weight is made as 1, and establishes my=2.Change k over to).
I) cury and each curybdi are done comparison one by one, if cury drops in 2.5 times of mean square deviation scopes of certain curybdi, the weight of mpwi=curybdi then, otherwise mpwi=0.
J) all mpwi are added up, all curybdi are added up, divided by the latter, obtain a number percent p with the former.If p is less than 0.15, my=4 then, otherwise my=0.
K) establish x=0.
L) if x=0, the j=u in the then following variable; If x=1, the j=v in the then following variable;
If x=2 changes over to v).
M) obtain the value of this pixel u component or v, be called curj, j=u or j=v.Obtain the same component value of preceding 4 frame co-located pixels, obtain the same component value of back 4 frame co-located pixels.
N) obtain the average and the mean square deviation of the j component value of preceding 4 frame co-located pixels, obtain the average and the mean square deviation of the j component value of back 4 frame co-located pixels.J=u or v.
O) absolute value of the difference of the average of calculating curj and front and back distribution.Try to achieve that distribution of absolute value minimum, be called maxjhit.If this absolute value is less than 2.5 times of maxjhit
Mean square deviation, and the mean square deviation of maxjhit changes p over to less than certain threshold value), otherwise change s over to).J=u or v.
P) maxjhit and curjbdi are done comparison one by one, obtain that the most similar curjbdi, and the similarity degree of record, be a number percent, be called mpji.J=u or v.
Q), assert that then maxjhit is similar to curjbdi, and upgrade this curjbdi if mpji is very approaching greater than the average of certain threshold value or maxjhit and curjbdi:
The average * 0.05 of the average * 0.95+maxjhit of average=curjbdi of curjbdi, the mean square deviation * 0.05 of the mean square deviation * 0.95+maxjhit of mean square deviation=curjbdi of curjbdi, the weight of weight=curjbdi of curjbdi+1, and the weight of record mw=curjbdi.The weight of all curjbdi being added up is called sw again, uses mw divided by sw then, obtains a number percent pj.If pj is less than 0.8, mj=2 then; P is less than 0.5 else if, then mj=1; Otherwise mj=0.J=u or v.
R) if maxyhit and all curjbdi are dissimilar, then distribute and replace that curjbdi of weight minimum with this, its weight is made as 1, and establishes mj=2.J=u or v.Change u over to).
S) curj and each curjbdi are done comparison one by one, if curj drops in 2.5 times of mean square deviation scopes of certain curjbdi, the weight of mpwji=curjbdi then.J=u or v.
T) all mpwji are added up, all curjbdi are added up, divided by the latter, obtain a number percent p with the former.If p is less than 0.15, mj=2 then, otherwise mj=0.J=u or v.
U) x=x+1 changes l over to).
V) m=my+mu+mv, if m less than 4, this pixel is exactly a background, otherwise is exactly prospect.
4, all background distributions are carried out gradually " forgeing ", specific practice is the weight * 0.99 of weight=this distribution of each distribution.
5, obtain the 2 values image that a width of cloth only comprises prospect and background this moment, can use corrosion and expansion algorithm in addition perfect, re-use the connection algorithm and obtain each sport foreground.
Certainly; the present invention also can have other various embodiments; under the situation that does not deviate from spirit of the present invention and essence thereof; those of ordinary skill in the art can make various corresponding changes and distortion according to the present invention, but these corresponding changes and distortion all should belong to the protection domain of the appended claim of the present invention.Such as adopting which kind of color space, each color component adopts several Gaussian distribution, and how each color space is treated with a certain discrimination, the concrete numerical value of each threshold value and coefficient, the depicting method of similarity degree, adopting mean square deviation still is the variance index, background distributions update method or the like.
The part that the present invention does not relate to prior art that maybe can adopt all same as the prior art is realized.