CN-115410170-B - Road video camera parameter determination and moving target calculation method and system
Abstract
The invention discloses a road video camera parameter determining and moving target calculating method and system. Firstly, carrying out edge detection on a road in a video to obtain a pixel coordinate set of a broken line end point of the road and a pixel coordinate set of a solid line intersection point of a horizontal axis of a parallel image. And then in an actual road physical coordinate system, matching and optimizing three camera parameters, namely a focal distance pixel ratio, a physical distance between the dotted line end point and the camera and a rotation angle of the camera shooting direction relative to the road direction by taking the vertical distance between the dotted line and the solid line, the distance between the adjacent dotted line end point and the camera mounting height as known quantities and combining the coordinate sets of the related points of the dotted line and the solid line. After the internal and external parameters of the camera are calculated, the video tracking result of the moving target can be combined, and the physical distance and coordinates of the moving target in each frame and the average speed of different frames can be solved. Compared with the prior art, the invention can simplify the necessary conditions for detection and effectively detect the distance, coordinates and speed information of the moving target.
Inventors
- XU FAN
- HUANG DONG
- Chen Chuibin
- LIN ZEBIN
- Lv Xiufu
- CHEN JIANFEI
- HUANG YIWEN
Assignees
- 南京航空航天大学
- 南京安通气象数据有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20220905
Claims (10)
- 1. A method for determining parameters of a road video camera, comprising the steps of: S1, carrying out edge detection on a road in a video to obtain a pixel coordinate set of an end point of a broken line of the road in an image, taking the end point as a starting point to serve as a straight line parallel to a transverse axis of the image, and intersecting a solid line adjacent to the broken line to obtain a pixel coordinate set of an intersection point; S2, inputting the pixel coordinate set of the virtual solid line, the vertical distance D between the virtual line and the solid line, the endpoint distance C between the adjacent virtual lines and the camera mounting height H, which are measured by the S1, into a pixel physical mapping model as known quantities to perform camera parameter matching optimization, namely, taking cosine value of rotation angle of camera shooting direction relative to road direction At the position of Performing training fitting on the internal values to remove solutions which do not conform to actual physical conditions, and outputting a plurality of groups of focal length pixel ratios And the physical distance of the dashed end point closest to the camera from the point where the camera projects onto the road surface Wherein the pixel physical mapping model is a line-to-line mapping model based on a first triangle formed by the pixel coordinates of each pair of virtual solid lines on the camera and the image, and a second triangle formed by the pixel coordinates of each pair of virtual solid lines on the camera and the actual road, and the similarity of the second triangle formed by the actual road coordinates corresponding to the pixel coordinates of each pair of virtual solid lines on the camera and the actual road, and the line-to-line mapping model of the line connection between the virtual solid lines is established; S3, according to the calculated result And (3) with Inverting the pixel coordinate set of the virtual solid line into the actual physical coordinate, and performing inversion optimization, namely determining three optimal internal and external parameters of the camera, including the focal length pixel ratio, through two optimal matching standards of parallelism and rotation angle Physical distance of the dashed end point closest to the camera from the point where the camera projects onto the road surface Rotation angle of camera shooting direction relative to road direction 。
- 2. The method of claim 1, wherein the image pixel coordinate system has an image center as an origin of coordinates and a lateral direction as a lateral direction An axis in the longitudinal direction of The real road coordinate system takes the point of the projection of the camera onto the road surface as an original point, the line of the projection of the camera onto the road surface in the shooting direction as a Y axis, the line perpendicular to the Y axis as an X axis and the line of the connection between the camera and the projection point as a Z axis.
- 3. The method according to claim 2, wherein in S2, the following is performed on At the position of Substituting the internal value and the pixel coordinate set obtained in the step S1 into a pixel physical mapping model for rotation fitting: ; obtaining the result Wherein, the method comprises the steps of, In order to obtain the number of results, Is the same as the point on the real line In the case of axis coordinates The absolute value of the difference in the axis coordinates, At the end of the dotted line The axis of the rotation is set to be at the same position, The point closest to the camera is point number 1, the index of the point taken.
- 4. The method according to claim 2, wherein in S3, the plurality of sets obtained in S2 、 And (3) with And inverting the pixel coordinate set of the dotted line into the actual physical coordinate by a plane geometric formula mapped by the two coordinate systems: ; Wherein the method comprises the steps of Is the pixel coordinates of the end point of the road dotted line, The pixel coordinates of the intersection point are obtained for the intersection of the solid lines adjacent to the broken line, And Respectively is And Is used for the physical coordinates of the object.
- 5. The method for determining parameters of a road video camera according to claim 1, wherein in S3, the obtained actual physical coordinates are plotted, the corresponding solution when the line made is not a straight line is screened out according to the optimal matching standard of parallelism, two functional straight lines are established according to the actual physical coordinates for the remaining solution, and the optimal matching standard of rotation angle is used: ; Deriving an optimal set of solutions Wherein Is the first The rotation angle of the camera shooting direction relative to the road direction in the group solution, According to the first The slope of the function straight line corresponding to the broken line established by the actual physical coordinates calculated by the group solution, According to the first The slope of the functional straight line corresponding to the solid line established by the actual physical coordinates calculated by the group solution, Is a preset threshold.
- 6. The method for calculating the road moving target under unknown camera internal parameters is characterized by comprising the following steps: The road video camera parameter determination method according to any one of claims 1-5, determining camera optimum parameters including focal length pixel ratio Physical distance of the dashed end point closest to the camera from the point where the camera projects onto the road surface And a rotation angle of the camera shooting direction with respect to the road direction ; Identifying and tracking moving targets of two adjacent frames in the video to obtain a lower left corner and a lower right corner of an identification frame, and making a straight line parallel to a transverse axis of an image on the bottom of the moving target identification frame to obtain an intersection point coordinate with a dotted line direction and an intersection point coordinate with a solid line direction; Substituting the obtained camera parameters, the vertical distance D between the dotted line and the solid line, the camera mounting height H and the measured pixel coordinates into a pixel physical mapping model as known quantities, solving the moving distance of the moving target in the time of two adjacent frames of video, inverting the coordinate set of the identification frame into the actual physical coordinates to obtain the horizontal axis coordinates of the target, namely obtaining the distance, the coordinates and the speed information of the moving target at different moments.
- 7. The method for calculating a moving object of a camera-internal unknown lower road according to claim 6, wherein the following formula is used: ; solving the moving distance of the moving target in the time of two adjacent frames of video And the ordinate of the target point closest to the camera Wherein, the method comprises the steps of, Is the same as the point on the real line In the case of axis coordinates The absolute value of the difference in the axis coordinates, Is the intersection point on the dotted line The axis of the rotation is set to be at the same position, For the index of the point taken, the point closest to the camera is point number 1, ; The lower left corner coordinates of the frame will be identified Lower right angular position Inversion into actual physical coordinates: ; Obtaining the corresponding actual abscissa And The X-axis coordinate of the moving object is Then in the XYZ actual physical coordinate system, the coordinates of the moving object are Speed of the current moving object The speed calculation formula can be used for obtaining: Wherein t is the interval time of two adjacent frames of pictures, and V is the speed of a moving target.
- 8. A road video camera parameter determination system, comprising: The edge detection and coordinate acquisition module is used for carrying out edge detection on the road in the video to obtain a pixel coordinate set of a dotted line end point of the road in the image, taking the end point as a starting point to serve as a straight line parallel to a transverse axis of the image, and intersecting with a solid line adjacent to the dotted line to obtain a pixel coordinate set of an intersection point; The training fitting and matching optimization module is used for taking the measured pixel coordinate set of the virtual solid line, the vertical distance D between the virtual line and the solid line, the distance C between the end points of the adjacent virtual lines and the mounting height H of the camera as known quantity input pixel physical mapping model to carry out matching optimization on the parameters of the camera, namely, the cosine value of the rotation angle of the shooting direction of the camera relative to the road direction At the position of Performing training fitting on the internal values to remove solutions which do not conform to actual physical conditions, and outputting a plurality of groups of focal length pixel ratios And the physical distance of the dashed end point closest to the camera from the point where the camera projects onto the road surface Wherein the pixel physical mapping model is a line-to-line mapping model based on a first triangle formed by the pixel coordinates of each pair of virtual solid lines on the camera and the image, and a second triangle formed by the pixel coordinates of each pair of virtual solid lines on the camera and the actual road, and the similarity of the second triangle formed by the actual road coordinates corresponding to the pixel coordinates of each pair of virtual solid lines on the camera and the actual road, and the line-to-line mapping model of the line connection between the virtual solid lines is established; And an inversion optimization module for obtaining from the calculation And (3) with Inverting the pixel coordinate set of the virtual solid line into the actual physical coordinate, and performing inversion optimization, namely determining three optimal internal and external parameters of the camera, including the focal length pixel ratio, through two optimal matching standards of parallelism and rotation angle Physical distance of the dashed end point closest to the camera from the point where the camera projects onto the road surface And a rotation angle of the camera shooting direction with respect to the road direction 。
- 9. A camera-internal unknown lower road moving target computing system, comprising: The edge detection and coordinate acquisition module is used for carrying out edge detection on the road in the video to obtain a pixel coordinate set of a dotted line end point of the road in the image, taking the end point as a starting point to serve as a straight line parallel to a transverse axis of the image, and intersecting with a solid line adjacent to the dotted line to obtain a pixel coordinate set of an intersection point; The training fitting and matching optimization module is used for taking the measured pixel coordinate set of the virtual solid line, the vertical distance D between the virtual line and the solid line, the distance C between the end points of the adjacent virtual lines and the mounting height H of the camera as known quantity input pixel physical mapping model to carry out matching optimization on the parameters of the camera, namely, the cosine value of the rotation angle of the shooting direction of the camera relative to the road direction At the position of Performing training fitting on the internal values to remove solutions which do not conform to actual physical conditions, and outputting a plurality of groups of focal length pixel ratios And the physical distance of the dashed end point closest to the camera from the point where the camera projects onto the road surface Wherein the pixel physical mapping model is a line-to-line mapping model based on a first triangle formed by the pixel coordinates of each pair of virtual solid lines on the camera and the image, and a second triangle formed by the pixel coordinates of each pair of virtual solid lines on the camera and the actual road, and the similarity of the second triangle formed by the actual road coordinates corresponding to the pixel coordinates of each pair of virtual solid lines on the camera and the actual road, and the line-to-line mapping model of the line connection between the virtual solid lines is established; an inversion optimization module for obtaining the data according to the calculation And (3) with Inverting the pixel coordinate set of the virtual solid line into the actual physical coordinate, and performing inversion optimization, namely determining three optimal internal and external parameters of the camera, including the focal length pixel ratio, through two optimal matching standards of parallelism and rotation angle Physical distance of the dashed end point closest to the camera from the point where the camera projects onto the road surface And a rotation angle of the camera shooting direction with respect to the road direction ; The target tracking and coordinate acquiring module is used for identifying and tracking moving targets of two adjacent frames in the video to obtain a lower left corner and a lower right corner coordinate set of the identification frame, and making a straight line parallel to a transverse axis of the image on the bottom of the moving target identification frame to obtain an intersection point coordinate in the direction of a dotted line and an intersection point coordinate in the direction of a solid line; And the moving target calculation module is used for substituting the obtained camera parameters, the vertical distance D between the dotted line and the solid line, the camera mounting height H and the measured pixel coordinates as known quantities into a pixel physical mapping model, solving the moving distance of the moving target in the time of two adjacent frames of video, inverting the coordinate set of the identification frame into the actual physical coordinates to obtain the horizontal axis coordinates of the target, and obtaining the distance, the coordinates and the speed information of the moving target at different moments.
- 10. A computer system comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the computer program when loaded to the processor implements the steps of the road video camera parameter determination method according to any one of claims 1-5 or the steps of the camera unknown under road moving object calculation method according to any one of claims 6 or 7.
Description
Road video camera parameter determination and moving target calculation method and system Technical Field The invention belongs to the technical field of road detection, and particularly relates to a road video camera parameter determination and moving target calculation method and system. Background The traditional method for measuring the speed of the road moving target mainly comprises three types of coil speed measurement, laser speed measurement and radar speed measurement. The three speed measuring modes have respective defects. The coil speed measurement is carried out by using a plurality of strands of copper wires to manufacture an induction coil, then burying the induction coil under a lane, and calculating the speed of a vehicle by recording the time difference of the vehicle passing through the two coils. The laser speed measurement is to calculate the speed of the vehicle by transmitting laser pulse and receiving reflected pulse, and the method has high accuracy, high anti-interference capability, high cost and poor stability of precise instruments. The radar speed measurement is carried out by utilizing the Doppler effect, and the method has the advantages that the detector can be composed of a plurality of detections, so that the multi-lane detection is realized, but the cost is higher and the installation of equipment is more complicated. With the progress of the road image capturing and image recognition processing technology, a target vehicle can be positioned from each frame of video image captured by a road camera, and the vehicle speed can be calculated according to the running track and the time between two adjacent frames. The highway speed measurement technology based on this principle is called video speed measurement. Compared with the traditional speed measuring technologies, the video speed measuring method has the following outstanding advantages. Firstly, shooting of road vehicles can be achieved only by a high-resolution camera, equipment is greatly simplified, no large influence is caused on road surfaces, secondly, compared with laser speed measurement, equipment is lower in interference caused by air image and higher in stability, thirdly, the final result of an algorithm can be optimized in an optimal mode, accuracy is greatly improved, and fourthly, the steps of speed measurement, vehicle identification and the like can be integrated through video speed measurement, so that working efficiency is greatly improved. However, the common video speed measurement needs to use the camera internal parameters, and the cameras on the road are generally installed in advance, so that the camera internal parameters and the camera deflection angle are difficult to obtain. Disclosure of Invention Aiming at the problems in the prior art, the invention aims to provide a method and a system for determining parameters of a road video camera and calculating a moving target so as to simplify the necessary conditions for detection and realize the calculation of the road moving target video under the condition that the internal parameters of the camera are unknown. The invention provides a road video camera parameter determining method, which comprises the following steps: S1, carrying out edge detection on a road in a video to obtain a pixel coordinate set of an end point of a broken line of the road in an image, taking the end point as a starting point to serve as a straight line parallel to a transverse axis of the image, and intersecting a solid line adjacent to the broken line to obtain a pixel coordinate set of an intersection point; S2, taking the pixel coordinate set of the virtual solid line measured in the S1 and the vertical distance D between the virtual line and the solid line, the end point distance C between the adjacent virtual lines and the camera mounting height H as known quantities to input a pixel physical mapping model for carrying out camera parameter matching optimization, namely taking the cosine value cos theta of the rotation angle of the camera shooting direction relative to the road direction within 0-1 for carrying out training fitting to remove solutions which do not meet the actual physical condition, and outputting a plurality of groups of focal length pixel ratios The pixel physical mapping model is a line-to-line mapping model based on the similarity of a first triangle formed by the camera and pixel coordinates of each pair of virtual and solid lines on an image and a second triangle formed by the camera and actual road coordinates corresponding to the pixel coordinates of each pair of virtual and solid lines on an actual road, and is established for connecting lines between the virtual and solid lines; S3, according to the calculated result Inverting the pixel coordinate set of the virtual solid line to the actual physical coordinate with Y 1, and performing inversion optimization, namely determining three optimal internal and external parameters of the camer