Summary of the invention
The features and advantages of the present invention are partly statement in the following description, or can be apparent from this description, or can learn by putting into practice the present invention.
Can only trigger candid photograph to vehicle for overcoming traditional ground inductive coil, cannot carry out process tracking to vehicle, need excavated pavement, affect the problem of city look and feel, the invention provides a kind of traffic intersection left and right vehicle wheel steering detection method violating the regulations and system, adopt the method for intelligent video analysis, on monitor video, draw virtual coil, analyze the movement locus of vehicle by signature tracking, detect and whether pass through predefined virtual coil, judge that whether vehicle breaks rules and regulations to turn to, and alleviates the workload of artificial check and control; Because the triggering of vehicle is captured by the mode of video virtual coil, avoid the mode of conventional art landfill inductive coil on road surface simultaneously, need not break road breaking face.
It is as follows that the present invention solves the problems of the technologies described above adopted technical scheme:
According to an aspect of the present invention, provide a kind of traffic intersection left and right vehicle wheel steering detection method of breaking rules and regulations, comprise the following steps:
Obtain video image from the monitoring video flow decoding of traffic intersection in real time;
Vehicle through traffic intersection is identified, and vehicle is carried out to movement locus detection; Vehicle is carried out to movement locus and detect and comprise vehicle is carried out to mark, and adopt the average conversion method based on color characteristic to follow the tracks of respectively to the vehicle of mark, obtain the movement locus of vehicle; Average conversion method based on color characteristic comprises the following steps:
S31, video image is carried out to color space conversion;
S32, carry out color layering calculating;
S33, calculation template characteristic model;
S34, at present frame initial position calculated candidate target signature model;
The weights of S35, computational data point;
S36, according to the weights calculated candidate target reposition of data point;
If S37 candidate target reposition and previous candidate target position are less than 1 pixel or reach maximum iteration time, stop; Otherwise, candidate target reposition is substituted to previous candidate target position, forward step S34 to;
On the added turning lane of video image, preset at least one virtual location, do not allow to turn to and the movement locus of vehicle during by virtual location at traffic intersection signal lamp, judge that vehicle has occurred to break rules and regulations to turn to.
According to one embodiment of present invention, preset two virtual locations on the added turning lane of video image, wherein first virtual location is arranged on the beginning that turns in track, and second virtual location is arranged in added turning lane or turns to end; Start vehicle to carry out movement locus detection during by the first virtual location at vehicle, if the movement locus of vehicle by the second virtual location, judges vehicle, violating the regulations turning to occurred.
According to one embodiment of present invention, vehicle is identified and comprised the following steps:
S11, obtained video image is carried out to background modeling;
S12, determining after background distributions according to background modeling, carrying out moving Object Segmentation and morphology processing, obtaining motion target area;
If S13 moving target by the first virtual location, starts vehicle to carry out movement locus detection.
Preferably, background modeling adopts multi-modal Gaussian Background model.
According to another aspect of the present invention, provide a kind of traffic intersection left and right vehicle wheel to break rules and regulations to turn to detection system, comprising:
Monitoring unit, for carrying out video monitoring to the vehicle of traffic intersection;
Decoding unit, obtains video image for the monitoring video flow decoding from traffic intersection in real time;
Vehicle identification and movement locus detecting unit, for the vehicle through traffic intersection is identified, and carry out movement locus detection to vehicle; This vehicle identification and movement locus detecting unit be also for vehicle is carried out to mark, and adopt the average conversion method based on color characteristic to follow the tracks of respectively to the vehicle of mark, obtains the movement locus of vehicle; This vehicle identification and movement locus detecting unit also for video image being carried out to color space conversion, color layering calculating, calculation template characteristic model, at the weights of present frame initial position calculated candidate target signature model, computational data point, according to the weights calculated candidate target reposition of data point, judge that candidate target reposition and previous candidate target position are less than 1 pixel or reach maximum iteration time, stop; Otherwise, candidate target reposition is substituted to previous candidate target position;
The detecting unit that turns to violating the regulations, for preset at least one virtual location on the added turning lane of video image, and during by virtual location, judge that vehicle has occurred to break rules and regulations to turn at traffic intersection signal lamp does not allow to turn to and vehicle identification and movement locus detecting unit detect vehicle movement track.
According to one embodiment of present invention, break rules and regulations to turn to detecting unit on the added turning lane of video image, to preset two virtual locations, wherein first virtual location is arranged on the beginning that turns in track, and second virtual location is arranged in added turning lane or turns to end; Vehicle identification and movement locus detecting unit start vehicle to carry out movement locus detection during by the first virtual location at vehicle, and the detecting unit that turns to violating the regulations during by the second virtual location, judge that vehicle has occurred to break rules and regulations to turn at the movement locus of vehicle.
According to one embodiment of present invention, vehicle identification and movement locus detecting unit carry out background modeling to obtained video image; Determine after background distributions according to background modeling, carry out moving Object Segmentation and morphology processing, obtain motion target area; In the time that moving target passes through the first virtual location, start vehicle to carry out movement locus detection.
The traffic intersection left and right vehicle wheel of the present invention steering detection method of breaking rules and regulations, adopt the method for intelligent video analysis, on monitor video, draw virtual coil (virtual location is set), analyze the movement locus of vehicle by signature tracking, detect and whether pass through predefined virtual coil, judge that whether vehicle breaks rules and regulations to turn to, and alleviates the workload of artificial check and control; Because the triggering of vehicle is captured by the mode of video virtual coil, avoid the mode of conventional art landfill inductive coil on road surface simultaneously, need not break road breaking face.
By reading instructions, those of ordinary skills will understand feature and the content of these technical schemes better.
Embodiment
Can only trigger candid photograph to vehicle for overcoming traditional ground inductive coil, cannot carry out process tracking to vehicle, need excavated pavement, affect city look and feel, the invention provides a kind of conversion of the average based on color characteristic (mean-shift) tracking, also replaced the method for the landfill inductive coil on former destruction road surface simultaneously by the method for video virtual coil.
As shown in Figure 1, the traffic intersection left and right vehicle wheel of the embodiment of the present invention steering detection method of breaking rules and regulations, comprises the following steps:
Video image is obtained in S1, the decoding of the real-time monitoring video flow from traffic intersection;
S2, to identifying through the vehicle of traffic intersection, and vehicle is carried out to movement locus detection;
S3, on the added turning lane of video image, preset at least one virtual location, do not allow to turn to and the movement locus of vehicle during by virtual location at traffic intersection signal lamp, judge that vehicle has occurred to break rules and regulations to turn to.
In a preferred embodiment of the invention, on the added turning lane of video image, preset two virtual locations, wherein first virtual location is arranged on the beginning that turns in track, and second virtual location is arranged in added turning lane or turns to end's (be preferably arranged on and turn to end); Start vehicle to carry out movement locus detection during by the first virtual location at vehicle, if the movement locus of vehicle by the second virtual location, judges vehicle, violating the regulations turning to occurred.
In the embodiment of the present invention, vehicle is identified and comprised the following steps:
S11, obtained video image is carried out to background modeling;
S12, determining after background distributions according to background modeling, carrying out moving Object Segmentation and morphology processing, obtaining motion target area;
If S13 moving target by the first virtual location, starts vehicle to carry out movement locus detection.
Preferably, background modeling adopts multi-modal Gaussian Background model.
Preferably, vehicle is carried out to movement locus and detect and comprise vehicle is carried out to mark, and adopt the average conversion method based on color characteristic to follow the tracks of respectively to the vehicle of mark, obtain the movement locus of vehicle.
Preferably, the average conversion method based on color characteristic comprises the following steps:
S31, video image is carried out to color space conversion;
S32, carry out color layering calculating;
S33, calculation template characteristic model;
S34, at present frame initial position calculated candidate target signature model;
The weights of S35, computational data point;
S36, according to the weights calculated candidate target reposition of data point.
If S37 candidate target reposition and previous candidate target position are less than 1 pixel or reach maximum iteration time, stop; Otherwise, candidate target reposition is substituted to previous candidate target position, forward step S34 to.
The method of the present embodiment realizes and mainly comprising: Gaussian Background modeling, target following, result are judged; Gaussian Background modeling can be determined the approximate region of detection; Vehicle tracking mainly uses mean-shift method based on color characteristic to follow the tracks of the center position of vehicle, and position is coupled together to formation movement locus of object; Result judges it is whether to judge whether to occur left and right by two predefined virtual coils by judgment object track to turn.
General traffic lights has three arrows, and left arrow when red represents to forbid turning left, and right arrow when red represents to forbid turning right, and intermediate representation stops, and the present invention can detect when left and right arrow is bright.When general camera is taken at the parting of the ways, what use is full-view camera, track that vehicle travels at the beginning (with camera just to) and can photograph with the track that track intersects, can be shown on image, virtual location (or claiming virtual coil) is exactly that the track place (turning to beginning) starting in image manually marks a position, the track place (turning to end) that intersects in the track of travelling at the beginning with vehicle is same to be marked a position and (certainly all draws at image place, if judgement is turned right, on the track of turning right, draw a virtual location, if judgement is turned left, need on the track of turning left, draw a virtual location, be that single judgement is turned left or turned right and all needs two virtual locations, judgement simultaneously needs three virtual locations of picture).If the track of car is by two virtual locations, car has occurred to break rules and regulations to turn left or turn right when red light (in the situation that of left side red light or the right when red).
The present invention is in red light, Real-time Obtaining video flowing, if have vehicle through; follow the tracks of by the method for video virtual coil, detect the moving region of vehicle by Gaussian Background modeling, vehicle is carried out to mark, use the mean-shift method based on color characteristic to follow the tracks of respectively to the vehicle of mark, obtain the movement locus of vehicle, if detect that movement locus passes through predefined virtual coil, think that vehicle generation left/right is violating the regulations to turn to, otherwise be not.Below several steps of the embodiment of the present invention are described in detail successively:
The first step, obtain video data from live video stream decoding
1) video decode upgrades up-to-date decode component and decoding relation table automatically;
2) automatically search corresponding decode component;
3) automatically building complete decoding link according to decode component decodes;
4) each frame that video decode and playing device produce decoding sends to follow-up unit and carries out analyzing and processing.
Second step, virtual coil trigger
Can set in advance a virtual location (or virtual coil), if there is vehicle process, start to follow the tracks of by the first virtual coil; Virtual coil is just equivalent to a switch, when vehicle just starts track algorithm by the first virtual coil time, if not by just not following the tracks of, with saving resource.
1) movement background modeling, adopts multi-modal Gaussian Background modeling in the present embodiment, can certainly adopt other movement background modeling method;
The video image that adopts multi-modal Gaussian Background model to take hard-wired video camera in the present embodiment carries out background modeling, and each pixel is set up to 3 background models, and concrete step is: the pixel of supposing the t two field picture of input is I
t, μ
i, t-1be the average of the pixel value of i the Gaussian distribution of (t-1) two field picture, it is that each pixel value is added and divided by the number of pixel, σ that the average of pixel value equals
i, t-1be the standard deviation of the pixel value of i the Gaussian distribution of (t-1) two field picture, D is for meeting formula | I
t-μ
i, t-1|≤D. σ
i, t-1preset parameter, this parameter can be obtained by practical experience, wherein, μ
i,t=(1-α) μ
i, t-1+ ρ I
t,
ρ=α/ω
i,t, α is learning rate, 0≤α≤1, and ρ is parameter learning rate, ω
i,tthe weights of i Gaussian distribution of t two field picture.All weights that normalization calculates, and each gauss of distribution function is pressed to ω
i,t/ σ
i,tarrange from big to small, if i
1, i
2... i
krepresent each Gaussian distribution, by i
1, i
2... i
kaccording to ω
i,t/ σ
i,torder is from big to small arranged, if a front M Gaussian distribution meets formula:
This M Gaussian distribution is considered to background distributions, and wherein, τ is weight threshold, can obtain according to actual conditions, conventionally τ value 0.7.
2) moving Object Segmentation and morphology processing
After having determined background distributions, the background model that present frame is corresponding with the background distributions of this present frame is subtracted each other, obtain the moving region of present frame, binaryzation and morphology processing are carried out in the moving region obtaining, make to cut apart the fuzzy motion target area obtaining more complete, independent.
3), if moving target triggers the first virtual coil, start to follow the tracks of.
The 3rd step, vehicle is carried out to the mark line trace of going forward side by side, adopt average conversion (mean-shift) method based on color characteristic
Conventionally by color histogram, (after color histogram normalization, each component is equivalent to a probability to Mean-shift track algorithm, theirs and be 1, same, this component is that the gray-scale value of the pixel of this one deck also has a probability) describe as clarification of objective, set up probability density function, by the similarity (being that central point probability is similar) between similarity function tolerance object module and candidate target, by asking the maximal value of similarity function to obtain the average drifting vector about target, thereby tracking problem is converted into the pattern matching problem based on average drifting, final iterative search is to the position of target.
When starting to enter camera to the marking of cars once, wait for bus leave camera after this mark just can reuse.Such as a car is labeled as 1, be all 1 from entering camera to leaving camera, when vehicle leaves after camera, carry out again a car, this mark 1 can be used to this car of mark, has avoided the unconfined increase of mark.
Concerning the finite sequence S in n dimension Euclidean space X, the sample average at x ∈ X place, sample number strong point is defined as:
Wherein, K is kernel function; W is the weight function of sample.Difference m (x)-x is called as Mean-shift vector, repeatedly data point is moved until the process restraining is called as Mean-shift algorithm towards Mean-shift direction vector.As shown in Figure 3, the concrete steps of tracking are as follows:
S101, vehicle is carried out to mark
Because may there be several cars a video image the inside simultaneously by virtual coil, such as having parallel San Tiao road on the road starting, San Tiao has car on road, for fear of the confusion between car and car, so vehicle is carried out to mark.
S102, color space conversion
RGB color space model is realized very desirable to hardware, but some difference of color of it and human intelligible, and the mode that hsv color space adopts tone, saturation degree and three kinds of features of brightness to combine represents color space, meet preferably the perception of the mankind to color, can directly obtain valuable information from image itself, carrying out Shot Detection with hsv color space has good efficiency and effect.
We need to come colo(u)r breakup in hsv color space, thus first by image from RGB color space conversion to hsv color space:
S103, color layering are calculated
Have the just vector of the representative dimension that is how many of how many layer, such as points 72 layers, just can form one 72 proper vector of tieing up, there are how many points every layer of the inside, and the value of the corresponding component of proper vector is exactly how many.This step is in order to extract color characteristic.
Color layering is exactly that color space is mapped in certain subset, thereby improves image retrieval speed.General color of image system nearly 2
24plant color, and the color that human eye can really be distinguished is limited, therefore, in the time carrying out image processing, need to carries out layering to color space, the dimension size of layering is extremely important, and layering dimension is higher, and retrieval precision is just higher, but retrieval rate can decline thereupon.
Color layering is divided into the color layering of equivalent spacing and the layering of non-equivalent spacing color, if because the dimension of equivalent spacing layering is too low, precision can decline greatly, can cause again calculation of complex if too high, by analysis and experiment, we select the layering of non-equivalent spacing color, step is as follows:
According to people's perception, tone H is divided into 8 parts, saturation degree S and brightness V are divided into 3 parts, according to color space and people, the subjective perception characteristic of color are quantized to layering, and formula is as follows:
According to above method, color space is divided into 72 kinds of colors.
C) three components are fused into one-component:
Y=HQsQv+SQv+V
Tone, saturation degree and brightness during to people's recognition image impact effect different, so the weight of each component is also different.Wherein, QS and QV are respectively the quantification progression of S and V, in problem experiment, get QS=3, QV=3.Therefore be actually
Y=9H+3S+V
Like this, H, S, tri-components of V merge in vector Y, the span of Y be [0,1 ..., 71].
S104, calculation template characteristic model
We have extracted the color characteristic of target above, component and be 1 after color characteristic normalization (each component divided by component and), the probability of each component is the value after normalization, the gray-scale value of the each pixel of image changes into the probable value of the component at pixel place, and each pixel has a probable value, substitute gray-scale value by probable value; The probable value that this step is equivalent to each pixel is used about the kernel function of target's center's point and is represented (this is a kind of mathematical formulae), and pixel value has been changed into probable value, final should similar iteration of carrying out below according to the probability of same object same pixel.
Wherein, y
0for the center of To Template; { x
i, i=1,2 ..., n
hit is each location of pixels in template; Function b is R
2→ 1,2 ..., m} mapping, carries out the quantification of m level the color of relevant position pixel; δ is delta function; C
hbe normaliztion constant, k (x) is kernel function; H is the kernel function bandwidth of manually setting.
S105, calculated candidate target signature model (our target is to trace into target, finds central point,, using the central point of present frame target as initial value, finds next candidate's central point by iteration, finally finds the central point at the actual place of target)
At present frame initial position calculated candidate target signature model:
Wherein, y
1it is present frame tracking window center.
The weights of S106, computational data point
This is according to two conditions that probability similarity is best above, by calculating similarity, obtains with Lagrangian the iteration weight that parameter value obtains.Computational data point x
iweights formula as follows:
S107, calculated candidate target reposition
Mean-shift makes a little to move according to greatest gradient direction, the direction that maximum possible moves, and this formula is exactly the next point obtaining according to gradient direction.Calculated candidate target reposition formula is as follows:
G (x) is the negative inverse of kernel function; G (x)=-k ' is (x).
S108, threshold decision
Mainly according to tracking target central point one by one pixel move, in the time that mobile pixel is greater than 1 point, continue iteration, until stop while satisfying condition.
If || y
2-y
1|| < ε or reached maximum iteration time, stop, otherwise y
1← y
2, use the value of y2 to substitute the value of y1, upgrade candidate target position, forward step S105 to.The selection of ε should make y
1with y
2spacing be less than 1 pixel, the position of current goal and the positional distance of candidate target are less than 1.Threshold value is a pixel distance, and in fact, the process of general control polyalgorithm iteration is less than left and right 15 times.
Obtaining behind a series of positions, drawing line by method of interpolation, be movement locus.
The 4th step, result are judged
The movement locus of car, by predefined second virtual coil, thinks that left/right has occurred to be turned to.In the time that red signal is effective, if there is movement locus to pass through predefined two virtual coils, thinks violating the regulations turning to occurred.
As shown in Figure 2, the embodiment of the present invention provides a kind of traffic intersection left and right vehicle wheel to break rules and regulations to turn to detection system simultaneously, comprising:
Monitoring unit 11, for carrying out video monitoring to the vehicle of traffic intersection;
Decoding unit 12, obtains video image for the monitoring video flow decoding from traffic intersection in real time;
Vehicle identification and movement locus detecting unit 13, for the vehicle through traffic intersection is identified, and carry out movement locus detection to vehicle;
The detecting unit 14 that turns to violating the regulations, for preset at least one virtual location on the added turning lane of video image, and during by virtual location, judge that vehicle has occurred to break rules and regulations to turn at traffic intersection signal lamp does not allow to turn to and vehicle identification and movement locus detecting unit detect vehicle movement track.
According to a preferred embodiment of the invention, break rules and regulations to turn to detecting unit 14 on the added turning lane of video image, to preset two virtual locations, wherein first virtual location is arranged on the beginning that turns in track, and second virtual location is arranged in added turning lane or turns to end; Vehicle identification and movement locus detecting unit 13 start vehicle to carry out movement locus detection during by the first virtual location at vehicle, and the detecting unit 14 that turns to violating the regulations during by the second virtual location, judge that vehicle has occurred to break rules and regulations to turn at the movement locus of vehicle.
According to a preferred embodiment of the invention, vehicle identification and movement locus detecting unit 13 carry out background modeling to obtained video image; Determine after background distributions according to background modeling, carry out moving Object Segmentation and morphology processing, obtain motion target area; In the time that moving target passes through the first virtual location, start vehicle to carry out movement locus detection.
According to a preferred embodiment of the invention, vehicle identification and movement locus detecting unit 13 carry out mark to vehicle, and adopt the average conversion method based on color characteristic to follow the tracks of respectively to the vehicle of mark, obtain the movement locus of vehicle.
The traffic intersection left and right vehicle wheel of the present embodiment breaks rules and regulations to turn to detection system can adopt specifically described method above, is not repeated in this description at this.
Adopt the method for the invention, compared with prior art, by virtual coil and the conversion of the average based on color characteristic (mean-shift) tracking, solve the left and right vehicle wheel test problems that turns to violating the regulations, avoid classic method landfill inductive coil to trigger candid photograph to vehicle, cannot carry out to vehicle a difficult problem for process tracking, also solve the problem on former landfill inductive coil destruction road surface simultaneously, save manpower and materials.Utilize the present invention, it is capable of automatic alarm when vehicle peccancy turns to, but rely on traditional ground inductive coil, can only trigger candid photograph to vehicle, cannot carry out process tracking to vehicle, method and system provided by the invention, has simultaneously also been solved traditional approach and need to have been destroyed the problem of the landfill inductive coil on road surface by the method for video virtual coil.
With reference to the accompanying drawings of the preferred embodiments of the present invention, those skilled in the art do not depart from the scope and spirit of the present invention above, can have multiple flexible program to realize the present invention.For example, illustrate as the part of an embodiment or the feature described can be used for another embodiment to obtain another embodiment.These are only the better feasible embodiment of the present invention, not thereby limit to interest field of the present invention, the equivalence that all utilizations instructions of the present invention and accompanying drawing content are done changes, within being all contained in interest field of the present invention.