A method and system for road video camera parameter determination and moving target calculation

By using edge detection and pixel physical mapping models, combined with the optimal matching criteria of parallelism and rotation angle, the intrinsic and extrinsic parameters of the camera are derived, solving the problem of calculating moving targets under unknown camera intrinsic parameters, and realizing accurate detection of the distance, coordinates and velocity of moving targets.

CN115410170BActive Publication Date: 2026-05-08NANJING UNIV OF AERONAUTICS & ASTRONAUTICS +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
Filing Date
2022-09-05
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively calculate the distance, coordinates, and speed of moving targets on roads when camera intrinsic parameters and camera deflection angles are unknown.

Method used

The pixel coordinates of the endpoints of the dashed road lines are obtained by edge detection. The camera parameters are matched and optimized using a pixel physical mapping model. The camera's intrinsic and extrinsic parameters are derived by combining the optimal matching criteria of parallelism and rotation angle. The coordinates of the recognition box of the moving target in the video are then derived to the actual physical coordinates, and the distance, coordinates and speed of the moving target are calculated.

Benefits of technology

In the absence of unknown camera intrinsic parameters and camera deflection angle, the prerequisites for moving target detection are simplified, enabling effective detection of distance, coordinates, and velocity information of moving targets in videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115410170B_ABST
    Figure CN115410170B_ABST
Patent Text Reader

Abstract

The application discloses a road video camera parameter determination and mobile target calculation method and system. Firstly, edge detection is performed on a road in a video to obtain a pixel coordinate set of road dashed line endpoints and a pixel coordinate set of intersection points of parallel image horizontal axes and solid lines. Then, in an actual road physical coordinate system, taking the vertical distance between the dashed line and the solid line, the distance between adjacent dashed line endpoints and the camera installation height as known quantities, and combining the related point coordinate sets of the dashed line and the solid line, three camera parameters, including a focal length pixel ratio, the physical distance between the dashed line endpoint and the camera and the rotation angle of the camera shooting direction relative to the road direction, are matched and optimized. After the calculated camera internal and external parameters, the physical distance, the coordinate and the average speed of the mobile target in different frames can be solved in combination with the mobile target video tracking result. Compared with the prior art, the application can simplify the necessary conditions required for detection and effectively detect the distance, the coordinate and the speed information of the mobile target.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of road detection technology, and specifically relates to a method and system for determining road video camera parameters and calculating moving targets. Background Technology

[0002] Traditional methods for measuring the speed of moving targets on roads mainly include three types: coil speed measurement, laser speed measurement, and radar speed measurement. Each of these methods has its own drawbacks. Coil speed measurement requires an induction coil made of multiple strands of copper wire, which is then buried under the lane. The vehicle speed is calculated by recording the time difference between the time a vehicle passes two coils. While this method offers high accuracy and low cost, the installation is cumbersome and obstructs traffic. Laser speed measurement uses emitted laser pulses and received reflected pulses to calculate vehicle speed. While this method offers good accuracy and strong anti-interference capabilities, it is costly and the stability of the precision instruments is relatively poor. Radar speed measurement utilizes the Doppler effect. Its advantage lies in the ability to use multiple detectors for multi-lane detection; however, it is costly and the equipment installation is complex.

[0003] With advancements in highway camera and image recognition processing technologies, target vehicles can be located from individual frames of video footage captured by highway cameras, and their speed can be calculated based on their trajectory and the time interval between adjacent frames. Highway speed measurement technology based on this principle is called video speed measurement. Compared to traditional speed measurement technologies, video speed measurement has several significant advantages: First, it only requires a high-resolution camera to capture vehicles on the highway, greatly simplifying the equipment and having minimal impact on the road surface; second, compared to laser speed measurement, its equipment is less susceptible to weather interference and has higher stability; third, the final algorithm result can be optimized, significantly improving accuracy; fourth, video speed measurement integrates speed measurement and vehicle identification steps, greatly improving work efficiency. However, ordinary video speed measurement requires camera intrinsic parameters, but highway cameras are generally pre-installed, making it difficult to obtain camera intrinsic parameters and camera deflection angles. Summary of the Invention

[0004] Purpose of the invention: In view of the problems existing in the prior art, the purpose of this invention is to provide a method and system for determining road video camera parameters and calculating moving targets, so as to simplify the necessary conditions for detection and realize the calculation of road moving target video when the camera intrinsic parameters are unknown.

[0005] Technical solution: The present invention provides a method for determining parameters of a road video camera, comprising the following steps:

[0006] S1: Perform edge detection on the road in the video to obtain the pixel coordinate set of the endpoints of the dashed road in the image, and draw a straight line parallel to the horizontal axis of the image with the endpoints as the starting point. The intersection point with the solid line adjacent to the dashed line is obtained as the pixel coordinate set of the intersection point.

[0007] S2: Using the pixel coordinate set of the dashed and solid lines measured in S1, along with the vertical distance D between the dashed and solid lines, the distance C between adjacent dashed line endpoints, and the camera mounting height H, as known quantities, input the pixel physical mapping model for camera parameter matching optimization. This involves using the cosine of the rotation angle between the camera's shooting direction and the road direction (cosθ) within the range of 0 to 1 for iterative fitting to remove solutions that do not conform to actual physical conditions, outputting multiple sets of focal length-to-pixel ratios. The physical distance Y1 between the dashed line endpoint closest to the camera and the camera; where the pixel physical mapping model is a line-to-line mapping model for connecting dashed and solid lines based on the similarity between the first triangle formed by the pixel coordinates of each pair of dashed and solid lines on the camera and the second triangle formed by the actual road coordinates corresponding to the pixel coordinates of each pair of dashed and solid lines on the actual road.

[0008] S3: Based on calculations Compared to Y1, the pixel coordinate set of the dashed and solid lines is inverted to the actual physical coordinates for inversion optimization. That is, by using two optimal matching criteria, parallelism and rotation angle, the optimal three intrinsic and extrinsic parameters of the camera are determined, including focal length-to-pixel ratio. The physical distance Y1 between the dashed endpoint closest to the camera and the camera, and the rotation angle θ of the camera's shooting direction relative to the road direction.

[0009] Preferably, the image pixel coordinate system has the image center as the origin, the horizontal axis as the x-axis, and the vertical axis as the y-axis; the actual road coordinate system has the point on the road surface projected by the camera as the origin, the line projected onto the road surface from the camera's shooting direction as the Y-axis, the line perpendicular to the Y-axis as the X-axis, and the line connecting the camera and the projection point as the Z-axis.

[0010] Preferably, in step S2, the values ​​of cosθ in the range of 0 to 1 are substituted together with the pixel coordinate set obtained in step S1 and then used for training and fitting in the pixel physical mapping model.

[0011]

[0012] Results Where N is the number of results obtained, l k The x-axis coordinate difference between points on the dashed and solid lines, given the same y-axis coordinate, is the absolute value of the difference between their x-axis coordinates. k y is the y-coordinate of the endpoint of the dashed line, k is the label of the selected point, and the point closest to the camera is point 1.

[0013] Preferably, in S3, the multiple sets of cosθ obtained from S2 are... Using Y1 and the planar geometric formulas mapping the two coordinate systems, the actual physical coordinates of the pixel coordinate set of the dashed and solid lines are derived:

[0014] and

[0015] Y k =Y1+(k-1)×C×cosθ

[0016] Where (x) k ,y k (x′) represents the pixel coordinates of the endpoint of the dashed road line. k ,y k (X) represents the pixel coordinates of the intersection point between the solid line and the dashed line. k ,Y k ) and (X k ′,Y k ) are respectively (x k ,y k ) and (x′ k ,y k The actual physical coordinates of ).

[0017] Preferably, in step S3, the obtained actual physical coordinates are plotted, and solutions corresponding to lines that are not straight are filtered out according to the optimal matching criterion of parallelism. The remaining solutions are then used to establish two function lines based on the actual physical coordinates, according to the optimal matching criterion of rotation angle:

[0018]

[0019] To obtain the optimal set of solutions Where θ i Let K1(i) be the rotation angle of the camera shooting direction relative to the road direction in the i-th solution, K2(i) be the slope of the function line corresponding to the dashed line established based on the actual physical coordinates calculated from the i-th solution, and ε be the preset threshold.

[0020] This invention provides a method for calculating moving targets on roads when camera intrinsic parameters are unknown, comprising the following steps:

[0021] Based on the aforementioned method for determining road video camera parameters, the optimal camera parameters, including focal length-to-pixel ratio, are determined. The physical distance Y between the dashed endpoint closest to the camera and the camera, and the rotation angle θ of the camera's shooting direction relative to the road direction;

[0022] The system identifies and tracks moving targets in two adjacent frames of a video, obtains the coordinates of the lower left and lower right corners of the target bounding box, draws a straight line parallel to the horizontal axis of the image at the bottom of the target bounding box, and obtains the coordinates of the intersection point with the dashed line and the intersection point with the solid line.

[0023] The obtained camera parameters, the vertical distance D between the dashed and solid lines, the camera installation height H, and the measured pixel coordinates are substituted into the pixel physical mapping model as known quantities to solve the moving distance of the moving target in two adjacent frames of the video. The coordinate set of the recognition box is then inverted to the actual physical coordinates to obtain the horizontal axis coordinates of the target, thus obtaining the distance, coordinates, and speed information of the moving target at different times.

[0024] As a preferred option, the formula is as follows:

[0025]

[0026] Solve for the moving target's distance C′ within two adjacent video frames, and the ordinate Y″ of the target point closest to the camera; where l j The x-axis coordinate difference between points on the dashed and solid lines, given the same y-axis coordinate, is the absolute value of the difference between their x-axis coordinates. j Let j be the y-coordinate of the intersection point on the dashed line, and j be the label of the selected point. The point closest to the camera is point 1, and j = 1, 2.

[0027] The coordinates of the lower left corner of the recognition box (a n ,r n ) and the coordinates of the lower right corner (u) n ,r n Inverted to actual physical coordinates:

[0028] and Obtain the corresponding actual x-coordinate X n and X n If ′, then the X-axis coordinate of the moving target is Therefore, in the actual physical coordinate system XYZ, the coordinates of the moving target are (X″, Y″), and the velocity V of the moving target can be obtained using the velocity calculation formula: Where t is the time interval between two adjacent frames, and V is the speed of the moving target.

[0029] Based on the same inventive concept, the present invention provides a road video camera parameter determination system, comprising:

[0030] The edge detection and coordinate acquisition module is used to perform edge detection on roads in the video, obtain the pixel coordinate set of the endpoints of the dashed lines of the road in the image, and draw a straight line parallel to the horizontal axis of the image with the endpoints as the starting point, and obtain the pixel coordinate set of the intersection point by intersecting the solid line adjacent to the dashed line.

[0031] The round-robin fitting and optimization module is used to input the measured pixel coordinate set of the dashed and solid lines, the vertical distance D between the dashed and solid lines, the distance C between adjacent dashed line endpoints, and the camera installation height H as known quantities into the pixel physical mapping model for camera parameter matching optimization. Specifically, it performs round-robin fitting on the cosine value of the rotation angle (cosθ) of the camera's shooting direction relative to the road direction, taking values ​​between 0 and 1, to remove solutions that do not conform to actual physical conditions, and outputs multiple sets of focal length-to-pixel ratios. And the physical distance Y1 between the dashed endpoint closest to the camera and the camera;

[0032] And an inversion optimization module, used to perform calculations based on... Compared to Y1, the pixel coordinate set of the dashed and solid lines is inverted to the actual physical coordinates for inversion optimization. That is, by using two optimal matching criteria, parallelism and rotation angle, the optimal three intrinsic and extrinsic parameters of the camera are determined, including focal length-to-pixel ratio. The physical distance Y1 between the dashed endpoint closest to the camera and the camera, and the rotation angle θ of the camera's shooting direction relative to the road direction.

[0033] Based on the same inventive concept, this invention provides a road moving target calculation system when camera intrinsic parameters are unknown, comprising:

[0034] The edge detection and coordinate acquisition module is used to perform edge detection on roads in the video, obtain the pixel coordinate set of the endpoints of the dashed lines of the road in the image, and draw a straight line parallel to the horizontal axis of the image with the endpoints as the starting point, and obtain the pixel coordinate set of the intersection point by intersecting the solid line adjacent to the dashed line.

[0035] The round-robin fitting and optimization module is used to input the measured pixel coordinate set of the dashed and solid lines, the vertical distance D between the dashed and solid lines, the distance C between adjacent dashed line endpoints, and the camera installation height H as known quantities into the pixel physical mapping model for camera parameter matching optimization. Specifically, it performs round-robin fitting on the cosine value of the rotation angle (cosθ) of the camera's shooting direction relative to the road direction, taking values ​​between 0 and 1, to remove solutions that do not conform to actual physical conditions, and outputs multiple sets of focal length-to-pixel ratios. And the physical distance Y1 between the dashed endpoint closest to the camera and the camera;

[0036] The inversion optimization module is used to perform calculations based on the results. Compared to Y1, the pixel coordinate set of the dashed and solid lines is inverted to the actual physical coordinates for inversion optimization. That is, by using two optimal matching criteria, parallelism and rotation angle, the optimal three intrinsic and extrinsic parameters of the camera are determined, including focal length-to-pixel ratio. The physical distance Y1 between the dashed endpoint closest to the camera and the camera, and the rotation angle θ of the camera's shooting direction relative to the road direction;

[0037] The target tracking and coordinate acquisition module is used to identify and track moving targets in two adjacent frames of a video, obtain the coordinate sets of the lower left and lower right corners of the recognition box, draw a straight line parallel to the horizontal axis of the image at the bottom of the moving target recognition box, and obtain the coordinates of the intersection point with the dashed line and the intersection point with the solid line.

[0038] The moving target calculation module is used to input the obtained camera parameters, the vertical distance D between the dashed and solid lines, the camera installation height H, and the measured pixel coordinates as known quantities into the pixel physical mapping model to solve the moving distance of the moving target in two adjacent frames of the video. The coordinate set of the recognition box is then inverted to the actual physical coordinates to obtain the horizontal axis coordinate of the target, thus obtaining the distance, coordinates, and speed information of the moving target at different times.

[0039] Based on the same inventive concept, the present invention provides a computer system, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is loaded onto the processor, it implements the steps of the road video camera parameter determination method, or the steps of the road moving target calculation method under unknown camera intrinsic parameters.

[0040] Beneficial effects: Compared with the prior art, the present invention can determine the camera's intrinsic and extrinsic parameters based on road video even when the camera's intrinsic parameters and deflection angle are unknown. This simplifies the necessary conditions for moving target detection and can effectively detect the distance, coordinates, and speed information of moving targets in the video. Attached Figure Description

[0041] Figure 1 This is a schematic diagram of the camera parameter determination process according to an embodiment of the present invention;

[0042] Figure 2 This is a schematic diagram of the road line marking method in an embodiment of the present invention;

[0043] Figure 3 This is a three-dimensional spatial schematic diagram of the pixel physical mapping model in an embodiment of the present invention;

[0044] Figure 4 This is a planar geometric schematic diagram of the pixel physical mapping model in an embodiment of the present invention;

[0045] Figure 5 This is a schematic diagram of the optimal matching result of rotation angle in an embodiment of the present invention;

[0046] Figure 6 This is a schematic diagram of the parallelism matching results in an embodiment of the present invention; wherein (a) is a schematic diagram of the results that do not meet the optimal parallelism matching criteria, and (b) is a schematic diagram of the results that meet the optimal parallelism matching criteria.

[0047] Figure 7This is a schematic diagram of the road moving target calculation process according to an embodiment of the present invention;

[0048] Figure 8 This is a schematic diagram of the detection results of the same moving target in two consecutive frames of road video in an embodiment of the present invention;

[0049] Figure 9 This is a schematic diagram of a camera parameter determination system module according to an embodiment of the present invention;

[0050] Figure 10 This is a schematic diagram of a moving target calculation system module according to an embodiment of the present invention. Detailed Implementation

[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0052] like Figure 1 As shown in the figure, an embodiment of the present invention discloses a method for determining the parameters of a road video camera, which mainly includes the following steps:

[0053] S1: Perform edge detection on the road in the video to obtain the pixel coordinate set of the endpoints of the dashed road in the image. Then, draw a straight line parallel to the horizontal axis of the image with the endpoints as the starting point and intersect the solid line adjacent to the dashed line to obtain the pixel coordinate set of the intersection point.

[0054] In this example, with the image center as the origin, the horizontal axis as the x-axis, and the vertical axis as the y-axis, we obtain a set of pixel coordinates (x, y) for the endpoints of the dashed lines in M ​​groups. k ,y k Let k = 1, 2, ..., M, and draw a straight line parallel to the horizontal axis of the image, starting from the endpoints. The line intersects the solid line adjacent to the dashed line to obtain the set of pixel coordinates (x′) of the intersection point. k ,y k ), k = 1, 2, ..., M. For example... Figure 2 As shown, the pixel coordinate sets of the three dashed line endpoints (63,244), (-40,11), and (-83, -72) are obtained. A straight line parallel to the horizontal axis of the image is drawn with the endpoints as the starting point, and the pixel coordinate sets of the intersection points (269,244), (70,11), and (-7, -72) are obtained by intersecting the solid line adjacent to the dashed line.

[0055] S2: Using the pixel coordinate set of the dashed and solid lines measured in S1, along with the vertical distance D between the dashed and solid lines, the distance C between adjacent dashed line endpoints, and the camera mounting height H, as known quantities, the pixel physical mapping model is matched and optimized. This involves performing a round-robin fitting of the cosine value of the rotation angle between the camera's shooting direction and the road direction (cosθ) within the range of 0 to 1 to remove solutions that do not conform to actual physical conditions, and outputting multiple sets of focal length-to-pixel ratios. The physical distance Y1 between the endpoint of the dashed line closest to the camera and the camera. In this embodiment, the pixel physical mapping model establishes a line-to-line mapping model for the connection between dashed and solid lines based on the similarity between the first triangle formed by the pixel coordinates of each pair of dashed and solid lines on the camera and the second triangle formed by the actual road coordinates corresponding to the pixel coordinates of each pair of dashed and solid lines on the actual road.

[0056] like Figure 3 , 4 As shown, in this example, the actual road coordinate system is established with the point projected onto the road surface by the camera as the origin, the line projected onto the road surface from the camera's shooting direction as the Y-axis, the line perpendicular to the Y-axis as the X-axis, and the line connecting the camera and the projection point as the Z-axis. The cosθ value is taken in the range of 0 to 1 with a step size of 0.01, and together with the pixel coordinate set obtained from S1, they are substituted into the pixel physical mapping model for training.

[0057]

[0058] Using the least squares algorithm:

[0059] Ax = b

[0060] in

[0061]

[0062] After fitting and removing solutions that are complex or negative, which do not conform to actual physical conditions, 39 sets of results were obtained. The camera installation height is H = 6m, the distance between adjacent dashed line endpoints (i.e., the distance between the same endpoints of two dashed lines) is C = 15m, the perpendicular distance between the dashed and solid lines (i.e., the width of one lane) is D = 3.75m, and the absolute values ​​of the x-axis coordinate differences between points on the dashed and solid lines under the same y-axis coordinates are l1 = 206, l2 = 110, and l3 = 76. Those skilled in the art will understand that the line-to-line mapping relationship established in the above pixel physical mapping model is expressed by formulas in a specific coordinate system in this example. If the origin or coordinate axes of the image and the actual road coordinate system are adjusted, offset and rotation angle adjustments can be introduced.

[0063] S3: Based on calculations Compared to Y1, the pixel coordinate set of the dashed and solid lines is inverted to the actual physical coordinates for inversion optimization. That is, by using two optimal matching criteria, parallelism and rotation angle, the optimal three intrinsic and extrinsic parameters of the camera are determined, including focal length-to-pixel ratio. The physical distance Y1 between the dashed endpoint closest to the camera and the camera, and the rotation angle θ of the camera's shooting direction relative to the road direction.

[0064] In this example, the result will be And the plane geometry formula for mapping between the two coordinate systems, which inversely uses the pixel coordinate set of the dashed and solid lines to derive the actual physical coordinates (X, Y, F) of the selected road point. k ,Y k (X′) k ,Y k ):

[0065] and

[0066] Y k =Y1+(k-1)×C×cosθ

[0067] Plot the obtained actual physical coordinates, and filter out solutions where the plotted line is not a straight line based on the optimal matching criterion of parallelism. Figure 6 Figure (a) shows the line corresponding to the actual coordinates retrieved from the 6th solution. Figure 6 (b) is the line corresponding to the actual coordinates derived from the 39th solution. The remaining solutions are then calculated based on the actual coordinates (X... k ,Y′ k ) and (X′ k ,Y′ k Establish two function lines, where the function line corresponding to the dashed line is: Y′ k =K1(i)X k +b, the solid line corresponds to the function line: Y′ k =K2(i)X′ k +b′, secondly, according to the optimal matching criterion for the rotation angle:

[0068]

[0069] like Figure 5 As shown, the optimal solution is the 37th one. ε is a preset minimum threshold that is much smaller than 1.

[0070] like Figure 7 As shown, the present invention discloses a method for calculating a moving target on a road when the camera intrinsic parameters are unknown. After obtaining the optimal intrinsic and extrinsic parameters of the camera using S1-S3 in the above embodiment, the method further includes:

[0071] S4: Use YOLO+DeepSort to identify and locate moving vehicles in the video stream, and create bounding boxes as shown below. Figure 8 As shown, the coordinates of the lower left and lower right corners of the recognition box are obtained. A straight line parallel to the horizontal axis of the image is drawn at the bottom of the moving target recognition box to obtain the coordinates of the intersection point with the dashed line and the intersection point with the solid line.

[0072] S5: Using the obtained camera parameters and the measured pixel coordinates, we input them into the pixel physical calculation model to solve the moving distance of the moving target in two adjacent frames of the video. We then invert the coordinate set of the recognition box into the physical coordinate system to obtain the horizontal axis coordinate of the target, thus obtaining the distance, coordinates and speed information of the moving target at different times.

[0073] Specifically, such as Figure 8 As shown, moving targets in two adjacent frames of the video are identified and tracked, obtaining the coordinates of the lower left corner (317, 285) and the lower right corner (369, 285) of the target recognition box. A straight line parallel to the horizontal axis of the image is drawn at the bottom of the moving target recognition box, obtaining the coordinates of the intersection points with the dashed line (244, 217) and (226, 194), and the coordinates of the intersection points with the solid line (52, 217) and (42, 194). The physical mapping model of the input pixels is then established with the obtained camera intrinsic and extrinsic parameters and other known quantities.

[0074]

[0075] The distance the moving target travels within two adjacent video frames is calculated as C′ = 778.39 mm, and the ordinate of the target point closest to the camera is Y″ = 18087 mm. The camera focal length pixel ratio is [not specified]. The cosine of the camera's deflection angle relative to the road direction is cosθ = 0.98. The absolute values ​​of the x-axis coordinate differences between points on the dashed and solid lines, given the same y-axis coordinates, are l1 = 192 and l2 = 184. The coordinates of the lower left corner (317, 285) and lower right corner (369, 285) of the recognition box are then inverted to the physical coordinate system.

[0076] and

[0077] Obtain the corresponding actual x-coordinate X n =6203mm and X′ n =7220mm, then the X-axis coordinate of the moving target is Therefore, in the actual physical coordinate system XYZ, the coordinates of the moving target are (6711.5, 18087), and the current velocity V of the moving target can be obtained using the velocity calculation formula. It can detect the distance, coordinates and speed information of a moving target at different times.

[0078] Based on the same inventive concept, embodiments of the present invention disclose a road video camera parameter determination system, such as... Figure 9 As shown, it includes: an edge detection and coordinate acquisition module, used to perform edge detection on the road in the video, obtain the pixel coordinate set of the endpoints of the dashed lines in the image, and draw a straight line parallel to the horizontal axis of the image with the endpoints as the starting point, intersecting the solid line adjacent to the dashed line to obtain the pixel coordinate set of the intersection point; and a training, fitting, matching, and optimization module, used to input the measured pixel coordinate set of the dashed and solid lines, the vertical distance D between the dashed and solid lines, the distance C between adjacent dashed line endpoints, and the camera installation height H as known quantities into the pixel physical mapping model for camera parameter matching and optimization, that is, to take the cosine value of the rotation angle of the camera shooting direction relative to the road direction, cosθ, within the range of 0 to 1, and perform training and fitting to remove solutions that do not conform to the actual physical situation, and output multiple sets of focal length pixel ratios. The physical distance Y1 between the dashed endpoint closest to the camera and the camera; and the inversion optimization module, used to calculate... Compared to Y1, the pixel coordinate set of the dashed and solid lines is inverted to the actual physical coordinates for inversion optimization. That is, by using two optimal matching criteria, parallelism and rotation angle, the optimal three intrinsic and extrinsic parameters of the camera are determined, including focal length-to-pixel ratio. The physical distance Y1 between the dashed endpoint closest to the camera and the camera, and the rotation angle θ of the camera's shooting direction relative to the road direction.

[0079] Based on the same inventive concept, embodiments of the present invention disclose a road moving target calculation system when camera intrinsic parameters are unknown, such as... Figure 10 As shown, in addition to the edge detection and coordinate acquisition module, the round-robin fitting and matching optimization module, and the inversion optimization module, it also includes: a target tracking and coordinate acquisition module, used to identify and track moving targets in two adjacent frames of the video, obtain the coordinate sets of the lower left and lower right corners of the recognition box, draw a straight line parallel to the horizontal axis of the image at the bottom of the moving target recognition box, and obtain the coordinates of the intersection point with the dashed line and the intersection point with the solid line; and a moving target calculation module, used to substitute the obtained camera parameters, the vertical distance D between the dashed and solid lines, the camera installation height H, and the measured pixel coordinates as known quantities into the pixel physical mapping model, solve for the moving distance of the moving target in two adjacent frames of the video, and invert the coordinate set of the recognition box to the physical coordinate system to obtain the horizontal axis coordinates of the target, that is, to obtain the distance, coordinates, and speed information of the moving target at different times.

[0080] The specific working processes of each module described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. The division of modules is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple modules may be combined or integrated into another system.

[0081] Based on the same inventive concept, the present invention provides a computer system, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is loaded onto the processor, it implements the steps of the road video camera parameter determination method, or the steps of the road moving target calculation method under unknown camera intrinsic parameters.

[0082] Those skilled in the art will understand that the technical solution of this invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer system (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in the embodiments of this invention. The storage medium includes various media capable of storing computer programs, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

Claims

1. A method for determining parameters of a road video camera, characterized in that, Includes the following steps: S1: Perform edge detection on the road in the video to obtain the pixel coordinate set of the endpoints of the dashed road in the image, and draw a straight line parallel to the horizontal axis of the image with the endpoints as the starting point. The intersection point with the solid line adjacent to the dashed line is obtained as the pixel coordinate set of the intersection point. S2: Using the pixel coordinate set of the dashed and solid lines measured in S1, along with the vertical distance D between the dashed and solid lines, the distance C between adjacent dashed line endpoints, and the camera mounting height H, as known quantities, input the pixel physical mapping model to perform camera parameter matching optimization. This involves optimizing the camera parameter matching by using the cosine of the rotation angle between the camera's shooting direction and the road direction. exist The inner values ​​are used for round-robin fitting to remove solutions that do not conform to the actual physical conditions, and multiple sets of focal length pixel ratios are output. The physical distance between the endpoint of the dashed line closest to the camera and the point on the road surface projected by the camera. The pixel physical mapping model is a line-to-line mapping model for connecting the dashed and solid lines, based on the similarity between the first triangle formed by the pixel coordinates of each pair of dashed and solid lines on the camera and the second triangle formed by the actual road coordinates corresponding to the pixel coordinates of each pair of dashed and solid lines on the camera and the actual road. S3: Based on calculations and The pixel coordinate set of the dashed and solid lines is inverted to the actual physical coordinates for inversion optimization. That is, by using two optimal matching criteria, parallelism and rotation angle, the optimal three intrinsic and extrinsic parameters of the camera are determined, including focal length-to-pixel ratio. The physical distance between the endpoint of the dashed line closest to the camera and the point on the road surface projected by the camera. and the angle of rotation of the camera's shooting direction relative to the road direction .

2. The method for determining road video camera parameters according to claim 1, characterized in that, The image pixel coordinate system has the image center as the origin and the horizontal axis as the coordinate system. The axis, the longitudinal direction is The actual road coordinate system has the point on the road surface projected by the camera as the origin, the line projected onto the road surface in the direction of the camera as the Y-axis, the line perpendicular to the Y-axis as the X-axis, and the line connecting the camera and the projection point as the Z-axis.

3. The method for determining road video camera parameters according to claim 2, characterized in that, In S2, for exist The inner values ​​and the pixel coordinate set obtained by S1 are substituted together into the pixel physical mapping model for round-robin training and fitting: ; Results ;in, To obtain the number of results, Points on the dashed and solid lines are in the same position. In the case of axial coordinates The absolute value of the difference between the axis coordinates. The endpoints of the dashed line Axis coordinates The points are labeled, with the point closest to the camera being point number 1.

4. The method for determining road video camera parameters according to claim 2, characterized in that, In S3, multiple sets are obtained from S2. , and And the planar geometric formulas for mapping between the two coordinate systems, which inversely derive the actual physical coordinates from the pixel coordinate set of the dashed and solid lines: ; in These are the pixel coordinates of the endpoints of the dashed road line. To obtain the pixel coordinates of the intersection point between the solid line and the dashed line, and They are respectively and The actual physical coordinates.

5. The method for determining road video camera parameters according to claim 1, characterized in that, In step S3, the obtained actual physical coordinates are plotted. Solutions where the plotted lines are not straight are filtered out based on the optimal matching criterion for parallelism. The remaining solutions are then used to establish two function lines based on the actual physical coordinates, according to the optimal matching criterion for rotation angle: ; To obtain the optimal set of solutions ,in For the first In the solution, the rotation angle of the camera's shooting direction relative to the road direction, According to the first The slope of the function line corresponding to the dashed line established by the actual physical coordinates calculated from the solution set. According to the first The slope of the function line corresponding to the solid line established by the actual physical coordinates calculated from the solution set. This is the preset threshold.

6. A method for calculating a moving target on a road when camera intrinsic parameters are unknown, characterized in that, Includes the following steps: The method for determining road video camera parameters according to any one of claims 1-5 determines the optimal camera parameters, including focal length-to-pixel ratio. The physical distance between the endpoint of the dashed line closest to the camera and the point on the road surface projected by the camera. And the rotation angle of the camera's shooting direction relative to the road direction. ; The system identifies and tracks moving targets in two adjacent frames of a video, obtains the coordinates of the lower left and lower right corners of the target bounding box, draws a straight line parallel to the horizontal axis of the image at the bottom of the target bounding box, and obtains the coordinates of the intersection point with the dashed line and the intersection point with the solid line. The obtained camera parameters, the vertical distance D between the dashed and solid lines, the camera installation height H, and the measured pixel coordinates are substituted into the pixel physical mapping model as known quantities to solve the moving distance of the moving target in two adjacent frames of the video. The coordinate set of the recognition box is then inverted to the actual physical coordinates to obtain the horizontal axis coordinates of the target, thus obtaining the distance, coordinates, and speed information of the moving target at different times.

7. The method for calculating a moving target on a road when the camera intrinsic parameters are unknown, as described in claim 6, is characterized in that... According to the following formula: ; Solve for the distance the moving target travels in two adjacent frames of the video. And the ordinate of the target point closest to the camera. ;in, Points on the dashed and solid lines are in the same position. In the case of axial coordinates The absolute value of the difference between the axis coordinates. The intersection of the dotted lines Axis coordinates The points are labeled, with the point closest to the camera designated as point 1. ; The coordinates of the bottom left corner of the recognition box and the coordinates of the lower right corner Inverted to actual physical coordinates: ; Obtain the corresponding actual x-coordinate and Then the X-axis coordinate of the moving target is Therefore, in the actual physical coordinate system XYZ, the coordinates of the moving target are: The speed of the currently moving target This can be obtained through the speed calculation formula: Where t is the time interval between two adjacent frames, and V is the speed of the moving target.

8. A road video camera parameter determination system, characterized in that, include: The edge detection and coordinate acquisition module is used to perform edge detection on roads in the video, obtain the pixel coordinate set of the endpoints of the dashed lines of the road in the image, and draw a straight line parallel to the horizontal axis of the image with the endpoints as the starting point, and obtain the pixel coordinate set of the intersection point by intersecting the solid line adjacent to the dashed line. The round-robin fitting and optimization module is used to input the measured pixel coordinate set of the dashed and solid lines, the vertical distance D between the dashed and solid lines, the distance C between adjacent dashed line endpoints, and the camera mounting height H as known quantities into the pixel physical mapping model to optimize camera parameter matching, that is, the cosine value of the rotation angle of the camera shooting direction relative to the road direction. exist The inner values ​​are used for round-robin fitting to remove solutions that do not conform to the actual physical conditions, and multiple sets of focal length pixel ratios are output. The physical distance between the endpoint of the dashed line closest to the camera and the point on the road surface projected by the camera. ; The pixel physical mapping model is a line-to-line mapping model for connecting the dashed and solid lines, based on the similarity between the first triangle formed by the pixel coordinates of each pair of dashed and solid lines on the camera and the second triangle formed by the actual road coordinates corresponding to the pixel coordinates of each pair of dashed and solid lines on the camera and the actual road. And an inversion optimization module, used to perform calculations based on... and The pixel coordinate set of the dashed and solid lines is inverted to the actual physical coordinates for inversion optimization. That is, by using two optimal matching criteria, parallelism and rotation angle, the optimal three intrinsic and extrinsic parameters of the camera are determined, including focal length-to-pixel ratio. The physical distance between the endpoint of the dashed line closest to the camera and the point on the road surface projected by the camera. And the rotation angle of the camera's shooting direction relative to the road direction. .

9. A system for calculating moving targets on a road when camera intrinsic parameters are unknown, characterized in that, include: The edge detection and coordinate acquisition module is used to perform edge detection on roads in the video, obtain the pixel coordinate set of the endpoints of the dashed lines of the road in the image, and draw a straight line parallel to the horizontal axis of the image with the endpoints as the starting point, and obtain the pixel coordinate set of the intersection point by intersecting the solid line adjacent to the dashed line. The round-robin fitting and optimization module is used to input the measured pixel coordinate set of the dashed and solid lines, the vertical distance D between the dashed and solid lines, the distance C between adjacent dashed line endpoints, and the camera mounting height H as known quantities into the pixel physical mapping model to optimize camera parameter matching, that is, the cosine value of the rotation angle of the camera shooting direction relative to the road direction. exist The inner values ​​are used for round-robin fitting to remove solutions that do not conform to the actual physical conditions, and multiple sets of focal length pixel ratios are output. The physical distance between the endpoint of the dashed line closest to the camera and the point on the road surface projected by the camera. ; The pixel physical mapping model is a line-to-line mapping model for connecting the dashed and solid lines, based on the similarity between the first triangle formed by the pixel coordinates of each pair of dashed and solid lines on the camera and the second triangle formed by the actual road coordinates corresponding to the pixel coordinates of each pair of dashed and solid lines on the camera and the actual road. The inversion optimization module is used to perform calculations based on the results. and The pixel coordinate set of the dashed and solid lines is inverted to the actual physical coordinates for inversion optimization. That is, by using two optimal matching criteria, parallelism and rotation angle, the optimal three intrinsic and extrinsic parameters of the camera are determined, including focal length-to-pixel ratio. The physical distance between the endpoint of the dashed line closest to the camera and the point on the road surface projected by the camera. And the rotation angle of the camera's shooting direction relative to the road direction. ; The target tracking and coordinate acquisition module is used to identify and track moving targets in two adjacent frames of a video, obtain the coordinate sets of the lower left and lower right corners of the recognition box, draw a straight line parallel to the horizontal axis of the image at the bottom of the moving target recognition box, and obtain the coordinates of the intersection point with the dashed line and the intersection point with the solid line. The moving target calculation module is used to input the obtained camera parameters, the vertical distance D between the dashed and solid lines, the camera installation height H, and the measured pixel coordinates as known quantities into the pixel physical mapping model to solve the moving distance of the moving target in two adjacent frames of the video. The coordinate set of the recognition box is then inverted to the actual physical coordinates to obtain the horizontal axis coordinate of the target, thus obtaining the distance, coordinates, and speed information of the moving target at different times.

10. A computer system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is loaded into the processor, it implements the steps of the road video camera parameter determination method according to any one of claims 1-5, or the steps of the road moving target calculation method under unknown camera intrinsic parameters according to any one of claims 6 or 7.

Citation Information

Patent Citations

  • A camera calibration optimization method under a road cloud monitoring platform

    CN109685855A

  • Method for angle calibration of the position of a video camera on board an automotive vehicle

    US20150161456A1