A kind of road pedestrian event detecting method of based on motion trajectory analysis
Technical field
The invention belongs to the video detection field, be specifically related to a kind of road pedestrian event detecting method of based on motion trajectory analysis.
Background technology
Road pedestrian event refers to the pedestrian in the situation that enter without any safeguard measure on car lane, the behavior that the jammer motor-car normally travels.Although traffic control department takes measures, the situation that the pedestrian swarms into car lane happens occasionally, and its danger is very large, easily causes traffic congestion, even leads to traffic hazard, causes for people's normal life and seriously influences.Traditional pedestrian's event detecting method mainly contains temperature checking method, electronic coil detection method, digital video detection method, and wherein temperature checking method easily is subject to the vehicle interference; The electronic coil poor expandability must suspend traffic, destroy the road surface during installation and maintenance, these methods can not be used widely in real life.
Present new project adopts installation more and more, safeguard do not need to destroy roadbed, surveyed area large, implement the convenient, flexible transport information detection technique based on video.Become the focus of research based on the pedestrian detection method of video, existing method mainly contains based on the neural network pedestrian detection, based on template matches detection method of wavelet transformation etc.Although these methods can realize pedestrian's affair alarm, the complex disposal process of video data, poor reliability can not satisfy the requirement of real-time of detection, can't satisfy the requirement of practical application.
Summary of the invention
For shortcomings and deficiencies of the prior art, the object of the invention is to, a kind of road pedestrian event detecting method of based on motion trajectory analysis is provided, the method can realize in real time, detect reliably all pedestrian's events in range of video.
In order to realize above-mentioned task, the present invention adopts following technical scheme to be achieved:
A kind of road pedestrian event detecting method of based on motion trajectory analysis, the method is carried out according to following steps:
Step 1 is set up image pixel to the mapping relations of road surface actual range, i.e. mapping table;
Step 2, the first two field picture and background image all are divided into a plurality of zones under identical piece coordinate system, the size of background is W*H, and the block size of division is w*h, the piece zone number T that divides is T=(W/w) * (H/h), all pixel value B in i piece
iExpression, total number N=w*h of i the interior pixel of piece, B
iW*h pixel value of middle preservation set up right angle two-dimensional coordinate system Y take the lower left corner of i piece as initial point, the pixel value B of (m, n) point in i piece
i(m, n) expression, wherein:
W is the pixel of background level direction;
H is the pixel of background vertical direction;
W is the pixel of the Width of i piece;
H is the pixel of the short transverse of i piece;
i=1,2,3…T;
M represents the horizontal ordinate of arbitrary pixel under coordinate system Y in i piece, m=0,1,2...w-1;
N represents the ordinate of arbitrary pixel under coordinate system Y in i piece, n=0,1,2...h-1;
Step 3 to each piece in the first two field picture, finds the background piece identical with this piece position in background image, and calculates the absolute value sum of the gray scale difference value of its corresponding background piece of this piece among same pixel position;
Greater than the threshold value A of setting, this piece is object block when the absolute value sum of gained, is 255 with the gray-scale value assignment of all pixels in this object block,
The threshold value A that is less than or equal to setting when the absolute value sum of gained, this piece is the background piece, is 0 with the gray-scale value assignment of all pixels in the background piece, wherein:
The span of described threshold value A is the area of (10~20) * piece;
At last the background in the first two field picture and target are separated, obtained the binary image of the first two field picture;
Step 4, to the binary image that obtains according to from left to right, order from top to bottom scans take piece as unit, and adjacent object block is labeled as same target, calculates simultaneously height and the width of each target-marking, when the value of height/width is in threshold value B scope, this binary image is carried out rim detection, seek best angle point, namely when laterally detecting data and vertically detecting data simultaneously greater than threshold value T, judge that this point is candidate angular, wherein:
The scope of described threshold value B is 2~10;
The value of described threshold value T is 180;
Step 5, select in these angle points laterally to detect data and vertically detect data and minimum point as the clarification of objective point, create simultaneously an object construction body, record these clarification of objective point positions and coupling lock-on counter information, coupling lock-on counter R is initialized as zero for the first time, and the unique point coordinate is (x
1, y
1), record simultaneously the image of a block size centered by this unique point as template, the pixel value two-dimensional array B of all pixels in this template
t[N] expression, in this piece, the pixel value of pixel (m, n) is B
t(m, n);
Step 6 is in the second two field picture, with the image block B of the first frame recording
t[N] is template, with the characteristic point position (x of this template
1, y
1) centered by, choose the square area of 4 block sizes as the region of search in current frame image, according to from left to right, method from top to bottom, search one by one, the number of to be searched is designated as N, uses B
jAny one search piece in [N] expression current search zone obtains both absolute value difference and SAD,
Wherein:
j=1,2,3....N
With absolute difference and minimum as matching criterior, the piece of choosing N absolute value difference and middle minimum is match block, is designated as B
s[N] namely found the matching characteristic point in present frame, record simultaneously the position (x of new matching characteristic point
2, y
2), and in order to the piece image B centered by New Characteristics point
s[N] is as new template B
t[N] mates simultaneously lock-on counter R and adds 1;
Step 7, from the 3rd two field picture to the M two field picture, M is the positive integer greater than 60, repeating step six, when R equals threshold value C, execution in step eight;
Step 8, when coupling lock-on counter R equals threshold value C, all unique point (x
1, y
1) ... (x
60, y
60) consist of the pursuit path of target, by the mapping table of setting up in finding step one, obtain actual range corresponding to pursuit path, consecutive point be spaced apart every frame time, so can obtain the array of one group of time and actual range, utilize least square fitting can try to achieve the speed of pursuit path, when this speed satisfies the scope of threshold value D, determine that namely this target is the pedestrian, wherein:
The value of described threshold value C is 60;
The scope of described threshold value D is (0.3~2.0) m/s.
Road pedestrian event detecting method based on video of the present invention, compared with prior art, can detect all pedestrian targets in range of video, be not subjected to environmental restraint, can detect real-time video, and detection time is short, be easy to realize, accuracy is higher, is well suited for real-time detection pedestrian event, has broad application prospects.
Description of drawings
Fig. 1 is the first frame video image.
Fig. 2 is the connected component labeling schematic diagram, and in figure, a is first connected domain, and b is second connected domain.
Fig. 3 is the first two field picture binaryzation mark result images, and in figure, white portion is the binaryzation target-marking of present frame.
Fig. 4 is the second frame video image, the target signature point of the white crosses point in figure for asking for.
Fig. 5 is the slip scan schematic diagram, and the solid-line rectangle frame is to be searched, and dotted line is held the expression region of search, and its central point A is the position of previous frame unique point, and the solid-line rectangle frame is step-length according to a pixel, according to from left to right, and slip scan from top to bottom.
Fig. 6 is the 60th frame binaryzation signature, and the white lines in figure are the pursuit path line.
Fig. 7 is the actual motion geometric locus figure that in Fig. 6, pursuit path is corresponding, and the horizontal ordinate in figure is the time, and the unit interval is 0.04s, and ordinate is actual range, and unit is cm.
Fig. 8 is pedestrian's event detection result.
Below in conjunction with drawings and Examples, content of the present invention is described in further detail.
Embodiment
The present embodiment provides a kind of road pedestrian event detecting method of based on motion trajectory analysis, thus by block-based binarization segmentation, block-based connected component labeling, unique point choose, target trajectory coupling follows the tracks of and asks for pedestrian target speed with least square fitting and determine whether pedestrian's event.Need to prove, in procedure of the present invention handled image be in video positive seasonal effect in time series the first two field picture in edge, the second two field picture, the 3rd two field picture ..., M (M is positive integer) two field picture.
If the size of each frame video image is W*H, the size of each piece is w*h, and wherein W is the pixel of each frame video video image horizontal direction, and H is the pixel of each frame video image vertical direction, w is the width in each piece zone, and h is the height in each piece zone.
Need to prove and mapping table in the present embodiment adopt patent of invention " a kind of video camera geometric calibration method under linear model " (open (bulletin) number: the video camera geometric calibration method CN102222332A) obtains.
The method of the present embodiment specifically adopts following steps to realize:
Step 1 is set up image pixel to the mapping relations of road surface actual range, i.e. mapping table;
Step 2, the first two field picture and background image all are divided into a plurality of zones under identical piece coordinate system, the size of background is W*H, and the block size of division is w*h, the piece zone number T that divides is T=(W/w) * (H/h), all pixel value B in i piece
iExpression, total number N=w*h of i the interior pixel of piece, B
iW*h pixel value of middle preservation set up right angle two-dimensional coordinate system Y take the lower left corner of i piece as initial point, the pixel value B of (m, n) point in i piece
i(m, n) expression, wherein:
W is the pixel of background level direction;
H is the pixel of background vertical direction;
W is the pixel of the Width of i piece;
H is the pixel of the short transverse of i piece;
i=1,2,3…T;
M represents the horizontal ordinate of arbitrary pixel under coordinate system Y in i piece, m=0,1,2...w-1;
N represents the ordinate of arbitrary pixel under coordinate system Y in i piece, n=0,1,2...h-1;
Step 3 to each piece in the first two field picture, finds the background piece identical with this piece position in background image, and calculates the absolute value sum of the gray scale difference value of its corresponding background piece of this piece among same pixel position,
Greater than the threshold value A of setting, this piece is object block when the absolute value sum of gained, is 255 with the gray-scale value assignment of all pixels in this object block,
The threshold value A that is less than or equal to setting when the absolute value sum of gained, this piece is the background piece, is 0 with the gray-scale value assignment of all pixels in the background piece, wherein:
The span of described threshold value A is the area of (10~20) * piece;
At last the background in the first two field picture and target are separated, obtained the binary image of the first two field picture;
Step 4, according to from left to right, order from top to bottom scans take piece as unit, and adjacent object block is labeled as same target to the binary image that obtains, calculate simultaneously height and the width of each target-marking, when the value of height/width is in threshold value B scope, this binary image is carried out rim detection, seek best angle point, namely when laterally detecting data and vertically detecting data simultaneously greater than threshold value T, the value of described threshold value T is 180, just judges that this point is candidate angular, wherein:
The scope of described threshold value B is 2~10;
Step 5, select in these angle points laterally to detect data and vertically detect data and minimum point as the clarification of objective point, create simultaneously an object construction body, record these clarification of objective point positions and coupling lock-on counter information, coupling lock-on counter R is initialized as zero for the first time, and the unique point coordinate is (x
1, y
1), record simultaneously the image of a block size centered by this unique point as template, the pixel value two-dimensional array B of all pixels in this template
t[N] expression, in this piece, the pixel value of pixel (m, n) is B
t(m, n);
Step 6, in the second two field picture, and with the image block B of the first frame recording
t[N] is template, with the characteristic point position (x of this template
1, y
1) centered by, the square area of choosing 4 block sizes at current frame image is as the region of search, according to from left to right, and method from top to bottom, search one by one, the number of to be searched is designated as N, uses B
jAny one search piece in [N] expression current search zone obtains both absolute value difference and SAD,
Wherein:
j=1,2,3....N
With absolute difference and minimum as matching criterior, the piece of choosing N absolute value difference and middle minimum is match block, is designated as B
s[N] namely found the matching characteristic point in present frame, record simultaneously the position (x of new matching characteristic point
2, y
2), and in order to the piece image B centered by New Characteristics point
s[N] is as new template B
t[N] mates simultaneously lock-on counter R and adds 1;
Step 7, from the 3rd two field picture to the M two field picture, M is the positive integer more than or equal to 60, repeating step six, when R equals threshold value C, execution in step eight;
Step 8, when coupling lock-on counter R equals threshold value C, all unique point (x
1, y
1) ... (x
60, y
60) consist of the pursuit path of target, by the mapping table of setting up in finding step one, obtain actual range corresponding to pursuit path, consecutive point be spaced apart every frame time, so can obtain the array of one group of time and actual range, utilize least square fitting can try to achieve the speed of pursuit path, when this speed satisfies the scope of threshold value D, determine that namely this target is the pedestrian, wherein:
The value of described threshold value C is 60;
The scope of described threshold value D is (0.3~2.0) m/s;
Below provide specific embodiments of the invention, need to prove that the present invention is not limited to following specific embodiment, all equivalents of doing on present techniques scheme basis all fall into protection scope of the present invention.
Embodiment:
In embodiment in processing procedure the sample frequency of video be 25 frame per seconds, every two field picture size is 720 * 288, the size in every zone is 8 * 6, and two field picture is divided into 90 * 48 piece zones, and target area binarization segmentation threshold value A is 576, the scope of threshold value B is 2~10, the value of threshold value T is 180, and the value of threshold value C is 60, and the scope of threshold value D is (0.3~2.0) m/s,, defer to said method and successively the first frame to the 60 two field pictures are processed to shown in Figure 8 as Fig. 1.
As can be seen from Figure 6 in figure white wire be the pedestrian from the movement locus of the first frame to the 60 frames, the lower end of this track enters scene for the first time for the pedestrian, the characteristic point position that finds, topmost point is the unique point that the 60th frame coupling finds.
Fig. 7 is actual range curve map corresponding to Fig. 6 pursuit path, adopt least square method to this section track fitting, can try to achieve pedestrian's actual motion speed 1.46m/s, as shown in Figure 8, this movement velocity is in the scope of threshold value D, so testing result is pedestrian's event of this road.