Summary of the invention
The present invention is directed to the deficiencies in the prior art, propose a kind of scene of a traffic accident digitizing reconstructing method based on monitoring video.Achieve the field digitized reconstruct of different highway sections state of motion of vehicle, solved the monitoring problem of interior state of motion of vehicle on a large scale, improved the mensuration precision simultaneously, reduced cost.
The present invention is achieved by the following technical solutions:
A kind of scene of a traffic accident digitizing reconstructing method based on monitoring video comprises following four steps:
The first step, the initial moment of the vehicle that monitors according to camera and vehicle travel exceed the camera head monitor field range termination constantly, with the video sequence in this time period by OpenCV HighGUI(open computer vision advanced figure user interface) Video processing function in the module is decomposed into continuous frame images, and records the license plate number of frame rate and the driving vehicle of this video sequence;
Second step, being chosen in the fixation mark thing that is positioned on the road surface that position and shape remain unchanged in the whole monitor procedure is the fixed reference thing, on the fixed reference thing, every width of cloth two field picture is demarcated the reference mark successively, described reference mark is at least four, and wherein three can not conllinear, again according to previously selected coordinate system, determine image space coordinate and the corresponding object space coordinate thereof at described reference mark, solve corresponding DLT(direct linear transformation) value of coefficient;
The 3rd step, choose the contact point of some wheels and ground in the vehicle as observation point, from continuous frame images, obtain this observation point successively at difference image space coordinate constantly by Visual C++ application program, and resolve the object space coordinate of corresponding this observation point of the moment in conjunction with the value of above-mentioned two-dimentional DLT coefficient of trying to achieve respectively;
The 4th step, obtain the trajectory of vehicle movement by fitting of a polynomial according to the above-mentioned different object space coordinates of observation point constantly of trying to achieve, trajectory carries out the curvilinear integral of arc length is obtained the displacement curve of vehicle movement thus then, the rate curve of vehicle movement and accelerating curve are then determined by first order derivative and the second derivative of this displacement curve respectively, thereby state of motion of vehicle are carried out field digitized reconstruct.
In the described first step, described two field picture refers to the picture material of each frame of extracting from video sequence, then it is preserved into the image of JPG or BMP form, wherein each two field picture correspondence the corresponding sports position of different moment vehicles, the time interval between adjacent two two field pictures is determined by the frame rate of this video sequence.
The extraction scope of described video sequence associated frame began to finish constantly to the vehicle termination that exceeds the camera head monitor field range of travelling from the initial moment that camera monitors vehicle, this scope can arrange video attribute by function cvSetCaptureProperty(before extracting video sequence image) arrange, for determining the time interval between adjacent two frames, can obtain video attribute by function cvGetCaptureProperty() obtain the frame rate of this video sequence.
Described camera is fixed on the position of certain altitude (on 3 meters), can overlook monitoring to the vehicle that travels on the road; Camera remains unchanged at the whole monitor procedure China and foreign countries element of orientation, thus the motion conditions of vehicle in can the same angular field of view of continuous monitoring; In the monitoring visual field scope of camera, can photograph fixed reference thing on the road surface such as crossing, well lid or other has fixed area of obvious characteristic etc., in order in the operation of postorder, can demarcate it.
The monitoring visual field scope of described camera refers to following whole scene scope that can photograph of situation that camera remains unchanged at elements of exterior orientation, and wherein the elements of exterior orientation of camera comprises three outer orientation vertical elements
With three foreign side's parallactic angle elements
, it determined camera in the object space coordinate system the position and towards.
Described reference mark is positioned on the fixed reference thing, its image space coordinate is determined according to the image space coordinate system that with summit, an image left side is initial point, two-dimentional Descartes's rectangular coordinate that its object space coordinate is set up according to the scene is determined, the image space coordinate at each reference mark and corresponding object space coordinate thereof are kept at from MFC(microsoft foundation class storehouse) base class CPoint class (some class) in the object making up of the CPoint2 class (extension point class) that derives from, the CPoint2 class is except the attribute and behavior of having inherited the CPoint class, also encapsulate image space coordinate and the corresponding object space coordinate thereof at reference mark, set up the correct mapping relations between them.For guaranteeing to solve the value of all two-dimentional DLT coefficients, should determine image space coordinate and the corresponding object space coordinate thereof at four reference mark at least, and in these four reference mark any 3 can not conllinear.
Described DLT coefficient resolve the two kinds of situations that are divided into: when having only four reference mark, can be at first by the image space coordinate at reference mark and corresponding object space coordinate thereof according to the 2 d dlt formula group that establishes an equation, then by OpenCV(open computer vision) API(application programming interfaces in the nucleus module) function finds the solution the approximate value that this system of linear equations can draw the DLT coefficient; When having four above reference mark, for improving precision and reliability, can be the image space coordinate at reference mark
Be considered as observed reading, add corresponding accidental error correction
With non-linear object lens photogrammetric distortion
List error equation, draw the value of DLT coefficient again according to the corresponding normal equation of least square method iterative.
In described the 3rd step, described observation point is benchmark with the contact point on wheel and ground, and it all is apparent in each two field picture, thereby can directly determine its image space coordinate at image by Visual C++ application program, for guaranteeing that observation point has enough spacings in adjacent two moment, every interval n two field picture obtains the image space coordinate of an observation point, finding the solution in two kinds of situation of the object space coordinate of different observation point constantly: when having only four reference mark,, find the solution this system of linear equations by the api function in the OpenCV nucleus module then and obtain according to the 2 d dlt formula group that establishes an equation by the value of the image space coordinate in the corresponding moment and the DLT coefficient of trying to achieve; When having four above reference mark, should be at first the image space coordinate of observation point be carried out distortion correction, obtained according to the 2 d dlt formula group that establishes an equation by the value of the image space coordinate after the correction in the corresponding moment and the DLT coefficient of trying to achieve again; Said n is the integer greater than zero.
Described state of motion of vehicle comprises: vehicle track at any time, displacement, speed and acceleration.
Compared with prior art, the present invention has the following advantages:
(1) but duplicate measurements checking, for afterwards secondary evidence obtaining provides legal basis
Because monitoring video has intactly been preserved the travel situations of vehicle in relevant road segments, obtain trajectory, displacement, speed and the accelerating curve that vehicle travels so can from video, carry out field digitized reconstruct to vehicle motion state at that time according to the present invention, and can carry out repeated authentication to measurement result.
(2) monitoring range is wide
Along with the foundation of intelligent transportation net, at each intersection and busy highway section monitoring camera is installed all, improved the real-time monitoring of Traffic Information and monitoring capability on a large scale greatly.As long as the highway section of monitoring camera is installed, all can utilizes the present invention to carry out the field digitized reconstruct of state of motion of vehicle, thereby realize the monitoring function on a large scale of state of motion of vehicle.
(3) Installation and Debugging are convenient, and maintenance cost is low
The present invention need not increase extras, and the effective information that only needs to extract driving vehicle on the basis of original monitoring camera from monitor video can be realized the field digitized reconstruct of state of motion of vehicle.For the highway section that monitor and control facility is not installed as yet, the Installation and Debugging of monitoring camera are also very convenient, and maintenance cost is low.
(4) state of motion of vehicle is measured the precision height
Because the present invention adopts error equation effectively to proofread and correct picture point observational error and non-linear object lens photogrammetric distortion, and accurately realized the field digitized reconstruct of state of motion of vehicle by 2 d dlt and fitting of a polynomial, so can obtain higher mensuration precision.
Embodiment
Below in conjunction with accompanying drawing embodiments of the invention are elaborated: present embodiment is to implement under the prerequisite with the technical solution of the present invention, provided detailed embodiment and concrete operating process, but protection scope of the present invention is not limited to following embodiment.
As shown in Figure 1, the overall flow based on the scene of a traffic accident digitizing reconstruct of monitoring video mainly comprises: extract video frame images, carry out the reference mark and demarcate, find the solution two-dimentional DLT coefficient, obtain observation point image space coordinate, find the solution several steps such as observation point object space coordinate and the field digitized reconstruct of state of motion of vehicle.The sequencing of finding the solution according to system describes in detail successively below:
Described camera is fixed on the position of certain altitude (on 3 meters), can overlook monitoring to the vehicle that travels on the road; Camera remains unchanged at the whole monitor procedure China and foreign countries element of orientation, thus the motion conditions of vehicle in can the same angular field of view of continuous monitoring; In the monitoring visual field scope of camera, can photograph fixed reference thing on the road surface such as crossing, well lid or other has fixed area of obvious characteristic etc., in order in the operation of postorder, can demarcate it.
The monitoring visual field scope of described camera refers to following whole scene scope that can photograph of situation that camera remains unchanged at elements of exterior orientation.Wherein the elements of exterior orientation of camera comprises three outer orientation vertical elements
With three foreign side's parallactic angle elements
, it determined camera in the object space coordinate system the position and towards.
The first step is extracted the frame relevant with detecting the vehicle movement position continuously from the monitor video sequence, and it is preserved into the image of JPG or BMP form.
At first make up a CvCapture (video obtains structure) class pointer, from file, obtain video by the Video processing function cvCaptureFromFile(in the OpenCV HighGUI module then) it is pointed to the monitor video file, simultaneously it is carried out initialization and distributes video flowing.Then by function cvQueryFrame(extracting two field picture) grasp and return the two field picture in the current monitor video sequence successively, again it is preserved into the image of JPG or BMP form, constantly repeat this operation till the whole extractions of the frame relevant with detecting the vehicle movement position are finished.
The extraction scope of video sequence associated frame began to finish constantly to the vehicle termination that exceeds the camera head monitor field range of travelling from the initial moment that camera monitors vehicle, and this scope can arrange video attribute by function cvSetCaptureProperty(before extracting video sequence image) arrange.For determining the time interval between adjacent two frames, can obtain video attribute by function cvGetCaptureProperty() obtain the frame rate of this video sequence.The license plate number of driving vehicle can directly read out from the monitor video image.
Second step, every width of cloth two field picture is carried out the reference mark successively demarcate, adopt least square method to calculate the value of corresponding DLT coefficient by image space coordinate and the corresponding object space coordinate thereof at reference mark according to the 2 d dlt formula.
As shown in Figure 2, select crossing in the image as the fixed reference thing in the present embodiment, and it is carried out the reference mark demarcate.The initial point of reference mark image space coordinate system is based upon the place, left summit of image, and its x axle along continuous straight runs is being to the right for just, and its y axle is vertically downwards for just; The initial point of reference mark object space coordinate system is based upon an angle point of crossing
The place, to the right for just, its Y-axis is downward for just along the long limit of crossing along the minor face of crossing for its X-axis.As shown in FIG., the choose angle point of capable lateral road
Demarcate Deng as the reference mark, and its image space coordinate and corresponding object space coordinate thereof are kept in the object that the CPoint2 class that derives from from the base class CPoint class of MFC creates.
Fixed reference thing in the image is carried out just can finding the solution the value of two-dimentional DLT coefficient according to the suitable method of number selection at reference mark after the reference mark demarcates.When having only four reference mark, can be at first by the image space coordinate at reference mark and corresponding object space coordinate thereof according to the 2 d dlt formula group (1) that establishes an equation, then by the api function cvSolve(Solving Linear in the OpenCV nucleus module) find the solution the approximate value that this system of linear equations can draw the DLT coefficient.
(1)
Wherein:
Be respectively n reference mark at horizontal ordinate and the ordinate of image space;
Be respectively n reference mark at horizontal ordinate and the ordinate of object space;
Be the 2 d dlt coefficient.
When having four above reference mark, for improving precision and reliability, can be the image space coordinate at reference mark
Be considered as observed reading, add corresponding accidental error correction
With non-linear object lens photogrammetric distortion
List error equation (2), draw the value of DLT coefficient again according to the corresponding normal equation of least square method iterative (4).
Wherein:
Be the image space coordinate;
Be the coordinate of principal point in image space coordinate system;
Be symmetry object lens distortion factor undetermined;
Be asymmetry object lens distortion factor undetermined;
Be radius vector, its value is:
If only get
, then corresponding error equation is expressed as with the form of matrix:
According to least square indirect adjustment principle, the normal equation corresponding with this error equation is:
Because error equation is nonlinear, therefore the whole process of resolving must adopt process of iteration, and it finds the solution flow process as shown in Figure 3 in detail.
The 3rd step, choose the contact point of some wheels and ground in the vehicle as observation point, from continuous frame images, obtain this observation point successively at difference image space coordinate constantly by Visual C++ application program, and resolve the object space coordinate of corresponding this observation point of the moment in conjunction with the value of the two-dimentional DLT coefficient of trying to achieve respectively.
As shown in Figure 2, choose the contact point on car the near front wheel and ground as observation point.This observation point image space coordinate can at first be loaded into the two field picture that extracts the client area of window application successively by Visual C++ application program, directly select to obtain at image by mouse, keyboard or touch-screen etc. then.For guaranteeing that observation point has enough spacings in adjacent two moment, every interval n(n is for greater than zero integer) two field picture obtains the image space coordinate of an observation point.
The object space coordinate of different observation point constantly then by the value of the image space coordinate in the corresponding moment and the DLT coefficient of trying to achieve according to the 2 d dlt formula group (5) that establishes an equation, find the solution this system of linear equations by the api function cvSolve in the OpenCV nucleus module then and obtain.When having four above reference mark, should be at first the image space coordinate of observation point be carried out distortion correction, use respectively
With
Value as in (5) formula
With
The value substitution find the solution and get final product.
(5)
Wherein:
Horizontal ordinate and ordinate for the image space that is respectively observation point;
Be respectively observation point at horizontal ordinate and the ordinate of object space;
Be the 2 d dlt coefficient.
In the 4th step, state of motion of vehicle is carried out field digitized reconstruct.At first obtain the trajectory of vehicle movement by fitting of a polynomial according to the object space coordinate of difference moment observation point, trajectory carries out the curvilinear integral of arc length is obtained the displacement curve of vehicle movement thus then, and the rate curve of vehicle movement and accelerating curve are then determined by first order derivative and the second derivative of this displacement curve respectively.
The track of vehicle polynomial fitting is:
(6)
Wherein: n is polynomial number of times;
Be multinomial coefficient.
Be respectively observation point at horizontal ordinate and the ordinate of object space.
The displacement of vehicle movement is:
(7)
The speed of vehicle movement is:
(8)
The acceleration of vehicle movement is:
(9)
Present embodiment adopts Visual C++ platform development, by good Windows GUI(Windows graphical user interface) interface and user carry out alternately.On the basis of original traffic monitoring camera, by from monitor video, extracting effective information, realized the field digitized reconstruct of state of motion of vehicle.This method not only monitoring range is wide, and Installation and Debugging are convenient, and cost is low; Also but duplicate measurements is verified, collecting evidence for secondary afterwards provides legal basis.