Vehicle speed detection line generation method, system and storage medium based on video monitoring
Through the video surveillance system, the edge line of the speed measurement area and the edge line of the vehicle in the video image frame are obtained, the occlusion identifier is determined and curve fitting is performed, which solves the problem of tedious and low accuracy of manually drawing the speed detection line, and realizes the detection of speed detection lines in a two-lane environment. Accurate vehicle speed detection line generation.
Patent Information
- Application Number
- CN202311867504.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2043-12-29
AI Technical Summary
In vehicle speed detection based on video surveillance, manually drawing vehicle speed detection lines is cumbersome and easy to introduce errors. Especially in a two-lane environment, vehicle occlusion and position changes lead to a decrease in detection accuracy, which makes it difficult for existing automatic generation methods to handle accurately.
By obtaining the edge line of the speed measurement area and the edge line of the vehicle in the video image frame, determine the occlusion identifier, form a centroid array, perform curve fitting and fill rectangle generation, automatically identify unoccluded speed measurement markers, and generate accurate vehicle speed detection lines. .
It realizes automatic identification of occlusions in the single-line speed measurement area, accurately generates vehicle speed detection lines, improves detection accuracy and efficiency, and is suitable for complex two-lane environments.
Smart Images

Figure CN117953191B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method, system and storage medium for generating a vehicle speed detection line based on video monitoring. Background Art
[0002] In the speed detection based on video surveillance, the intelligent highway inspection system plays a vital role. When deploying this system, it is usually necessary to extract a frame from the surveillance video and have professionals manually draw the speed detection lines. These speed detection lines will become the basis for speed detection in all subsequent surveillance video frames. However, manually drawing speed detection lines is an extremely tedious and time-consuming task. The drawing personnel need to have rich experience and skills to ensure the accuracy of the detection lines. Due to manual operation, even the most experienced staff can hardly avoid errors and uncertainties, resulting in a decrease in the accuracy of speed detection.
[0003] With the development of digital image processing technology, machine learning, and deep learning, computers can extract image frames from video surveillance and identify feature points, feature lines, and feature surfaces. By processing these points, lines, and surfaces, they can automatically generate speed detection lines. This method of automatically generating speed detection lines improves efficiency, reduces errors, and has great practical application value. There is a lane dividing dotted line in the middle of a standard lane. The length of the lane dividing dotted line is 6m, and the interval between adjacent lane dividing dotted lines is 9m. By calibrating the lane dividing dotted lines in the video image with the actual length, it has become a common method for speed detection using video images. However, in a standard two-lane road, there is only one lane dividing dotted line. Once it is blocked by a vehicle, the distance between the detection lines changes, which will affect the accuracy of speed detection. Since vehicles can change lanes at will by crossing the dotted line, and the movement and position changes of vehicles are unpredictable, there are serious challenges in automatically generating speed detection lines in busy two-lane roads. Summary of the invention
[0004] In view of this, the purpose of the embodiments of the present invention is to provide a method, system and storage medium for generating a vehicle speed detection line based on video surveillance to solve one or more technical problems existing in the prior art and at least provide a beneficial choice or create conditions.
[0005] On the one hand, an embodiment of the present invention provides a method for generating a vehicle speed detection line based on video monitoring, the method comprising the following steps:
[0006] S100, acquiring a video image frame and an edge line of a speed measurement area, an edge line of a speed measurement marker in the speed measurement area, and an edge line of each vehicle in the speed measurement area in the video image frame;
[0007] S200, determining an occlusion identifier based on an edge line of the speed measuring marker and an edge line of the vehicle, and forming a first centroid array with the centroid of the speed measuring marker and the corresponding occlusion identifier;
[0008] S300, determining whether there is a generated detection line, if there is a generated detection line, executing S400; if there is no generated detection line, performing curve fitting on the centroids of all elements in the first centroid array based on the center line of the speed measurement area to obtain a fitting curve, and then executing S500;
[0009] S400, obtaining the most recently saved centroid array, and generating a fitting curve based on the first centroid array and the most recently saved centroid array;
[0010] S500, generating a filled rectangle based on the fitting curve and the edge line of the speed measurement area;
[0011] S600, determining a filled rectangle that is not blocked by the vehicle, and generating a vehicle speed detection line based on the filled rectangle that is not blocked by the vehicle and the fitting curve.
[0012] Optionally, in S200, determining the occlusion identifier based on the edge line of the speed measuring marker and the edge line of the vehicle, and forming a first centroid array with the centroid of the speed measuring marker and the corresponding occlusion identifier include:
[0013] S210, calculating the edge line w of the speed measurement marker i The vehicle edge line c j The number of intersection points;
[0014] S220, if the edge line w of the i-th speed measuring marker i If the total number of intersections with the edge lines of all vehicles is 0, then calculate the centroid Q of this speed marker i , and mark the occlusion identifier as block_Q i , set block_Q i =0; where block_Q i =0 means that the i-th speed marker is not affected by the blocking vehicle and the i-th speed marker can be used to detect the vehicle speed; black_Q i =1 means that the i-th speed marker is affected by the blocking vehicle and cannot be used to detect vehicle speed;
[0015] S230, all the calculated centroids Q i Sort by y coordinate from small to large, with [Q i ,block_Q i ] are elements, forming the first centroid array Q new .
[0016] Optionally, in S300, performing curve fitting on the centroids of all elements in the first centroid array based on the center line of the speed measurement area to obtain a fitting curve includes:
[0017] Take the first centroid array Q new The centroid Q of all elements i The least square method is used to fit the curve of each control point, and the curve obtained by fitting is compared with the center line q of the speed measurement area. k0 Divide the curve into equal parts and compare the fitted curve with the center line q of the speed measurement area. k0 The points with the same serial number in the figure are connected into line segments one by one, and the difference in length between every two line segments is minimized to obtain the fitting curve f(x).
[0018] Optionally, in S400, the acquiring the most recently saved centroid array and generating a fitting curve based on the first centroid array and the most recently saved centroid array includes:
[0019] S410, read the centroid array Q saved when the detection line was generated last time save , as the second centroid array Q save , the second centroid array Q save With the first centroid array Q new Merge into the third centroid array Qk, Qk = Q save ∪Q new ,
[0020] S420, calculating the second centroid array Q save Each centroid to the first centroid array Q new The distance of each centroid of , when the distance is less than the distance threshold, the two centroids involved in the calculation are set to the same centroid, and the block_Q in the third centroid array Qk is i The value of is set to the logical AND operation of the occlusion identifiers of the two elements, and the first and last items in the third centroid array Qk are removed to obtain the fourth centroid array Q;
[0021] S430, when the number of elements in the fourth centroid array Q is greater than 1, the centroids Q of all elements in the fourth centroid array Q are i Perform curve fitting to obtain the fitting curve f(x).
[0022] Optionally, in S430, the centroid Q of all elements in the fourth centroid array Q i Perform curve fitting to obtain the fitting curve f(x), including:
[0023] Take the centroid Q of all elements in the fourth centroid array Q i The least square method is used to fit the curve of each control point, and the curve obtained by fitting is compared with the center line q of the speed measurement area. k0Divide the curve into equal parts and compare the fitted curve with the center line q of the speed measurement area. k0 The points with the same serial number in the figure are connected one by one into line segments, and the length difference between every two line segments is minimized to obtain a fitting curve f(x), wherein the center line of the speed measurement area is determined based on the two edge lines along the lane direction.
[0024] Optionally, in S500, generating a filled rectangle based on the fitting curve and the edge line of the speed measurement area includes:
[0025] S510, respectively calculating the fitting curve f(x) and the edge line q of the speed measurement area k1 The intersection point K1, the fitting curve f(x) and the edge line q of the speed measurement area k2 The intersection point K2 of the third centroid arrays Qk, K1 and K2 are merged and sorted from small to large according to the y coordinate to form the fifth centroid array QK, QK = [[Q0, block_Q0], [Q1, block_Q1], [Q2, block_Q2], ..., [Q K , black_Q K ]], connect two adjacent centroids in array QK into a line segment;
[0026] S520, set line segment Q i-1 Q i The width of the filled rectangle is obtained.
[0027] Optionally, in S520, the setting line segment Q i-1 Q i The width of the filled rectangle is obtained, including:
[0028] For the i-th element in the fifth centroid array QK, i=1, 2, ..., K-1, calculate the edge line w i The point with the smallest x coordinate and the center of mass Q i The distance wd1, calculate the edge line w i The point with the largest x coordinate and the center of mass Q i The distance wd2, the line segment Q i- 1Q i The width is set to wd1+wd2, and the filled rectangle Q is obtained i-1 Q i ;
[0029] For the Kth element in the fifth centroid array QK, calculate the edge line w K-1 The point with the smallest x coordinate and the center of mass Q K-1 The distance wd1, calculate the edge line w K-1 The point with the largest x coordinate and the center of mass Q K-1 The distance wd2, the line segment Q K-1 Q KThe width is set to wd1+wd2, and the filled rectangle Q is obtained K-1 Q K .
[0030] Optionally, in S600, determining a filled rectangle that is not blocked by the vehicle, and generating a vehicle speed detection line based on the filled rectangle that is not blocked by the vehicle and the fitting curve includes:
[0031] S610, fill the edge line c of the vehicle j Constituting vehicle area C j , calculate the line segment Q i-1 Q i The corresponding filled rectangle and each vehicle area C j The overlapping area is divided by the area of the filled rectangle as the overlap ratio η ij , i=1,2,……,K;
[0032] S620, if for any vehicle area C j , overlap rate η ij are all less than the overlap threshold, then segment Q is determined i-1 Q i There is no vehicle occlusion, set block_Q i =0; where the overlapping area is Q i-1 Q i ∩C j , i=1,2,……,K;
[0033] S630, for each element [Q i ,block_Q i ], i = 1, 2, ..., K-1, if block_Q i = 0, then from the center of mass Q i-1 and the center of mass Q i Draw a perpendicular line to the fitting curve f(x) and calculate the distance between the perpendicular line and the edge line q of the speed measurement area k3 The intersection point A i , and the edge line of the speed measurement area q k4 The intersection point B i , connect A i and B i Draw line segment A i B i As a speed detection line.
[0034] On the other hand, an embodiment of the present invention provides a vehicle speed detection line generation system based on video monitoring, comprising:
[0035] at least one processor;
[0036] at least one memory for storing at least one program;
[0037] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0038] On the other hand, an embodiment of the present invention provides a computer-readable storage medium, in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to perform the above method.
[0039] The embodiments of the present invention include the following beneficial effects: the present invention can identify a single-line speed measurement area. For a single-line speed measurement area, if a speed measurement marker in a current video image frame is blocked by a vehicle and cannot be located, the speed measurement marker that may be blocked by the vehicle can be automatically identified. By combining unblocked speed measurement markers in multiple frames of images, all speed measurement markers in the single-line speed measurement area can be obtained, and a vehicle speed detection line can be accurately generated. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0041] Figure 1 It is a schematic flow chart of the steps of a method for generating a vehicle speed detection line based on video monitoring provided by an embodiment of the present invention;
[0042] Figure 2 is a schematic diagram of a lane with a single-line speed measurement zone provided by an embodiment of the present invention;
[0043] Figure 3 yes Figure 2 Schematic diagram of the edge line of the middle speed measurement area and the edge line of the speed measurement marker;
[0044] Figure 4 yes Figure 2 Schematic diagram of the edge line and edge center line of the middle speed measurement area;
[0045] Figure 5 yes Figure 2 Schematic diagram of the centroid of the speed measuring marker in the middle speed measuring area and the centroid fitting curve;
[0046] Figure 6 yes Figure 2 Schematic diagram of the vehicle speed detection line in the medium speed measurement area;
[0047] Figure 7 It is a schematic diagram of a lane including a single-line speed measurement area and partially blocked speed measurement markers provided by another embodiment of the present invention;
[0048] Figure 8 yes Figure 7 Schematic diagram of the edge line of the middle speed measurement area and the edge line of the unobstructed speed measurement marker;
[0049] Fig. 9 yes Figure 7 Schematic diagram of the edge line and edge center line of the middle speed measurement area;
[0050] Fig.10 yes Figure 7 A schematic diagram of the centroid of the unobstructed speed measurement marker in the middle speed measurement area, the intersection of the centroid and the edge line of the speed measurement area, and the centroid fitting curve;
[0051] Fig.11 yes Figure 7 A schematic diagram of the filled rectangle of the adjacent centroid connecting line segments in the middle speed measurement area and the speed detection line generated by the unobstructed speed measurement markers;
[0052] Fig.12 yes Figure 7 A schematic diagram of a lane after a vehicle has traveled for a period of time;
[0053] Fig.13 yes Fig.12 Schematic diagram of the middle speed measurement area and the edge line of the unobstructed speed measurement marker;
[0054] Fig.14 yes Fig.12 Schematic diagram of the edge line and edge center line of the middle speed measurement area;
[0055] Fig.15 yes Fig.12 Schematic diagram of the centroid of unobstructed speed markers in the medium speed measurement area;
[0056] Fig.16 yes Fig.12 Schematic diagram of the centroid of all speed measuring markers in the middle speed measuring area, the intersection of the centroid and the edge line of the speed measuring area, and the centroid fitting curve;
[0057] Fig.17 yes Fig.12 A schematic diagram of the filled rectangles connecting the adjacent centroids in the middle speed measurement area and the speed detection lines generated by all speed measurement markers;
[0058] Fig.18 The present invention provides a structural block diagram of a vehicle speed detection line generation system based on video monitoring. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0060] It should be noted that, although the functional modules are divided in the schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different module division than in the schematic diagram or in the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0062] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that technical solutions of the present invention may be practiced without one or more of the specific details, or other methods, components, steps, etc. may be adopted. In other cases, known methods, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.
[0063] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules, or in different networks and / or processor devices and / or microcontroller devices.
[0064] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0065] like Figure 1 As shown, an embodiment of the present invention provides a method for generating a vehicle speed detection line based on video monitoring, and the method comprises the following steps:
[0066] S100, acquiring a video image frame and an edge line of a speed measurement area, an edge line of a speed measurement marker in the speed measurement area, and an edge line of each vehicle in the speed measurement area in the video image frame;
[0067] S200, determining an occlusion identifier based on an edge line of the speed measuring marker and an edge line of the vehicle, and forming a first centroid array with the centroid of the speed measuring marker and the corresponding occlusion identifier;
[0068] S300, determining whether there is a generated detection line, if there is a generated detection line, executing S400; if there is no generated detection line, performing curve fitting on the centroids of all elements in the first centroid array based on the center line of the speed measurement area to obtain a fitting curve, and then executing S500;
[0069] S400, obtaining the most recently saved centroid array, and generating a fitting curve based on the first centroid array and the most recently saved centroid array;
[0070] S500, generating a filled rectangle based on the fitting curve and the edge line of the speed measurement area;
[0071] S600, determining a filled rectangle that is not blocked by the vehicle, and generating a vehicle speed detection line based on the filled rectangle that is not blocked by the vehicle and the fitting curve.
[0072] The present invention can identify a single-line speed measurement area. For a single-line speed measurement area, if a speed measurement marker in a current video image frame is blocked by a vehicle and cannot be located, the speed measurement marker that may be blocked by the vehicle can be automatically identified. By combining unblocked speed measurement markers in multiple frames of images, all speed measurement markers in the single-line speed measurement area can be obtained, and a vehicle speed detection line can be accurately generated.
[0073] In some embodiments, in S200, determining the occlusion identifier based on the edge line of the speed measuring marker and the edge line of the vehicle, and forming a first centroid array with the centroid of the speed measuring marker and the corresponding occlusion identifier include:
[0074] S210, calculating the edge line w of the speed measurement marker i The vehicle edge line c j The number of intersection points;
[0075] S220, if the edge line w of the i-th speed measuring marker i If the total number of intersections with the edge lines of all vehicles is 0, then calculate the centroid Q of this speed marker i , and mark the occlusion identifier as block_Q i , set block_Q i =0; where block_Q i =0 means that the i-th speed marker is not affected by the blocking vehicle and the i-th speed marker can be used to detect the vehicle speed; black_Q i =1 means that the i-th speed marker is affected by the blocking vehicle and cannot be used to detect vehicle speed;
[0076] S230, all the calculated centroids Q i Sort by y coordinate from small to large, with [Q i ,block_Q i ] are elements, forming the first centroid array Q new .
[0077] In some embodiments, in S300, performing curve fitting on the centroids of all elements in the first centroid array based on the center line of the speed measurement area to obtain a fitting curve includes:
[0078] Take the first centroid array Q new The centroid Q of all elements i The least square method is used to fit the curve of each control point, and the curve obtained by fitting is compared with the center line q of the speed measurement area. k0 Divide the curve into equal parts and compare the fitted curve with the center line q of the speed measurement area. k0 The points with the same serial number in the figure are connected into line segments one by one, and the difference in length between every two line segments is minimized to obtain the fitting curve f(x).
[0079] In some embodiments, in S400, obtaining the most recently saved centroid array and generating a fitting curve based on the first centroid array and the most recently saved centroid array includes:
[0080] S410, read the centroid array Q saved when the detection line was generated last time save , as the second centroid array Q save , the second centroid array Q save With the first centroid array Q new Merge into the third centroid array Qk, Qk = Q save ∪Q new ,
[0081] S420, calculating the second centroid array Q save Each centroid to the first centroid array Q new The distance of each centroid of , when the distance is less than the distance threshold, the two centroids involved in the calculation are set to the same centroid, and the block_Q in the third centroid array Qk is i The value of is set to the logical AND operation of the occlusion identifiers of the two elements, and the first and last items in the third centroid array Qk are removed to obtain the fourth centroid array Q;
[0082] S430, when the number of elements in the fourth centroid array Q is greater than 1, the centroids Q of all elements in the fourth centroid array Q are i Perform curve fitting to obtain the fitting curve f(x).
[0083] In some embodiments, in S430, the centroids Q of all elements in the fourth centroid array Q are i Perform curve fitting to obtain the fitting curve f(x), including:
[0084] Take the centroid Q of all elements in the fourth centroid array Q i The least square method is used to fit the curve of each control point, and the curve obtained by fitting is compared with the center line q of the speed measurement area. k0 Divide the curve into equal parts and compare the fitted curve with the center line q of the speed measurement area. k0 The points with the same serial number in the figure are connected one by one into line segments, and the length difference between every two line segments is minimized to obtain a fitting curve f(x), wherein the center line of the speed measurement area is determined based on the two edge lines along the lane direction.
[0085] In some embodiments, in S500, generating a filled rectangle based on the fitting curve and the edge line of the speed measurement area includes:
[0086] S510, respectively calculating the fitting curve f(x) and the edge line q of the speed measurement area k1 The intersection point K1, the fitting curve f(x) and the edge line q of the speed measurement area k2 The intersection point K2 of the third centroid arrays Qk, K1 and K2 are merged and sorted from small to large according to the y coordinate to form the fifth centroid array QK, QK = [[Q0, block_Q0], [Q1, block_Q1], [Q2, block_Q2], ..., [Q K , black_Q K ]], connect two adjacent centroids in array QK into a line segment;
[0087] S520, set line segment Q i-1 Q i The width of the filled rectangle is obtained.
[0088] In some embodiments, in S520, the setting line segment Q i-1 Q i The width of the filled rectangle is obtained, including:
[0089] For the i-th element in the fifth centroid array QK, i=1, 2, ..., K-1, calculate the edge line w i The point with the smallest x coordinate and the center of mass Q i The distance wd1, calculate the edge line w i The point with the largest x coordinate and the center of mass Q i The distance wd2, the line segment Q i- 1Q i The width is set to wd1+wd2, and the filled rectangle Q is obtained i-1 Qi ;
[0090] For the Kth element in the fifth centroid array QK, calculate the edge line w K-1 The point with the smallest x coordinate and the center of mass Q K-1 The distance wd1, calculate the edge line w K-1 The point with the largest x coordinate and the center of mass Q K-1 The distance wd2, the line segment Q K-1 Q K The width is set to wd1+wd2, and the filled rectangle Q is obtained K-1 Q K .
[0091] In some embodiments, in S600, the determining of the filled rectangle that is not blocked by the vehicle, and generating the vehicle speed detection line based on the filled rectangle that is not blocked by the vehicle and the fitting curve, includes:
[0092] S610, fill the edge line c of the vehicle j Constituting vehicle area C j , calculate the line segment Q i-1 Q i The corresponding filled rectangle and each vehicle area C j The overlapping area is divided by the area of the filled rectangle as the overlap ratio η ij , i=1,2,……,K;
[0093] S620, if for any vehicle area C j , overlap rate η ij are all less than the overlap threshold, then segment Q is determined i-1 Q i There is no vehicle occlusion, set block_Q i =0; where the overlapping area is Q i-1 Q i ∩C j , i=1,2,……,K;
[0094] S630, for each element [Q i ,block_Q i ], i = 1, 2, ..., K-1, if block_Q i = 0, then from the center of mass Q i-1 and the center of mass Q i Draw a perpendicular line to the fitting curve f(x) and calculate the distance between the perpendicular line and the edge line q of the speed measurement area k3 The intersection point A i , and the edge line of the speed measurement area q k4 The intersection point B i , connect A i and Bi Draw line segment A i B i As a speed detection line.
[0095] In some embodiments, when the vehicle speed detection line generation program is started, the identifier flag_temp is initialized and flag_temp is set to 1; the fifth centroid array QK is used as the second centroid array Q save Save and set the speed detection line A i B i Save as [A i B i ] save ; If there is no generated detection line and the fifth centroid array QK is not defined, the fourth centroid array Q is used as the second centroid array Q save Save and set the speed detection line A i B i Save as [A i B i ] save ; For the fifth centroid array QK, if for any element except the first item [Q i ,block_Q i ] have block_Q i =0, then set flag_temp=0.
[0096] See also Figures 2 to 6 The present invention provides a specific embodiment for generating a vehicle speed detection line in a single-line speed measurement area by using a command trigger (manual start):
[0097] 1.1, such as Figure 2 The video image frame containing the test area is shown as Figure 3 As shown, the video image frame is marked with the edge line 1 of the speed measurement area and the edge lines 21, 22, 23, and 24 of the lane division dashed lines inside the speed measurement area. For the speed measurement area, the edge line 1 is divided into four segments according to the sudden change point of the slope of the edge line 1, as shown in FIG. Figure 4 As shown, the two shorter segments are edge lines 11 and 12 in the direction of the lane cross section, and the two longer segments are 13 and 14 along the lane direction, and the center line 10 of the speed measurement area edge lines 13 and 14 is calculated. Initialize flag_temp=1.
[0098] 1.2. Calculate the number of intersections between the edge lines 21, 22, 23, 24 of the lane dividing lines and the edge lines of the vehicles. At this time, the total number of vehicles in the speed measurement area kN = 0, and the total number of intersections between the edge lines of all the lane dividing lines and the edge lines of the vehicles is 0. Then calculate the centroids 31, 32, 33, 34 of the edge lines of the lane dividing lines, such as Figure 5As shown, block_31 = 0, block_32 = 0, block_33 = 0, block_34 = 0. All the calculated centroids are sorted from small to large according to the y coordinate to form the centroid array Q new =[[center of mass 31, block_31 = 0], [center of mass 32, block_32 = 0], [center of mass 33, block_33 = 0], [center of mass 34, block_34 = 0]], where center of mass 31, center of mass 32, center of mass 33, and center of mass 34 represent the coordinates of the center of mass respectively.
[0099] 1.3. Because the command trigger is used, the centroids 31, 32, 33, and 34 are used as control points, and the least square method is used for curve fitting. The fitting curve and the center line 10 of the speed measurement area are divided into a fixed number of segments, and the corresponding points with the same sequence number are connected into line segments. The length difference between every two line segments is minimized, thereby obtaining the fitting curve 4, as shown in FIG. Figure 5 shown.
[0100] 1.4. Because block_31 = 0, draw a perpendicular line from the centroid 31 to the fitting curve 4, and calculate the intersection point A of the perpendicular line and the edge line 13 of the speed measurement area 31 , intersection point B with the edge line 14 of the speed measurement area 31 , connect A 31 and B 31 Draw a line segment as the vehicle speed detection line 51, such as Figure 6 As shown;
[0101] 1.5. Because block_32 = 0, draw a perpendicular line from the centroid 32 to the fitting curve 4, and calculate the intersection point A of the perpendicular line and the edge line 13 of the speed measurement area 32 , intersection point B with the edge line 14 of the speed measurement area 32 , connect A 32 and B 32 Draw a line segment as the vehicle speed detection line 52, such as Figure 6 As shown;
[0102] 1.6. Because block_33 = 0, draw a perpendicular line from the centroid 33 to the fitting curve 4, and calculate the intersection point A of the perpendicular line and the edge line 13 of the speed measurement area 33 , intersection point B with the edge line 14 of the speed measurement area 33 , connect A 33 and B 33 Draw a line segment as the vehicle speed detection line 53, such as Figure 6 As shown;
[0103] 1.7. Because block_34 = 0, draw a perpendicular line from the centroid 34 to the fitting curve 4, and calculate the intersection point A of the perpendicular line and the edge line 13 of the speed measurement area 34 , intersection point B with the edge line 14 of the speed measurement area 34 , connect A34 and B 34 Draw a line segment as the vehicle speed detection line 54, such as Figure 6 shown.
[0104] 1.8. Store the coordinates of the centroids 31, 32, 33, and 34 and the occlusion identifiers [[centroid 31, block_31 = 0], [centroid 32, block_32 = 0], [centroid 33, block_33 = 0], [centroid 34, block_34 = 0]] as an array Q save , the coordinates of the speed detection lines 51, 52, 53, and 54 are [[A 31 B 31 ],[A 32 B 32 ],[A 33 B 33 ],[A 34 B 34 ]]Save as [A i B i ] save .
[0105] 1.9. Since all centroids have block_Q=0, set flag_temp=0 and the process ends.
[0106] See also Figures 7 to 17 The present invention provides a specific embodiment for generating a vehicle speed detection line in a single-line speed measurement area by starting a software program:
[0107] 2.1, such as Figure 7 The video image frame containing the test area is shown as Figure 8 As shown, the video image frame is marked with the edge line 1 of the speed measurement area and the edge lines 21, 22, 23, and 24 of the lane division dashed lines inside the speed measurement area. For the speed measurement area, the edge line 1 is divided into four segments according to the sudden change point of the slope of the edge line 1, as shown in FIG. Fig. 9 As shown, the two shorter segments are edge lines 11 and 12 in the direction of the lane cross section, and the two longer segments are 13 and 14 along the lane direction, and the center line 10 of the speed measurement area edge lines 13 and 14 is calculated. Initialize flag_temp=1.
[0108] 2.2. Calculate the number of intersections between the edge lines 21, 22, and 23 of the lane dividing line and the edge line of the vehicle. The total number of intersections between the edge line 21 of the lane dividing line and the edge line of the vehicle is > 0. The total number of intersections between the edge lines 22 and 23 of the lane dividing line and the edge line of the vehicle is = 0, then calculate the centroids 32 and 33 of the edge lines of the lane dividing line, such as Fig.10 As shown, block_32 = 0, block_33 = 0. All the calculated centroids are sorted from small to large according to the y coordinate to form the centroid array Qnew =[[center of mass 32, block_32 = 0], [center of mass 33, block_33 = 0]], where center of mass 32 and center of mass 33 represent the coordinates of the center of mass respectively.
[0109] 2.3. Because flag_auto=1 (software program started), set all new block_Q i =1, then the centroid array Q new =[[center of mass 32, block_32 = 1], [center of mass 33, block_33 = 1]], and execute step 2.4.
[0110] 2.4. No saved Q when running for the first time save . The centroid array Q = [[centroid 32, block_32 = 1], [centroid 33, block_33 = 1]].
[0111] 2.5. The number of elements in the centroid array Q is greater than 1. The centroids 32 and 33 are used as control points. The least square method is used to fit the curve. The fitting curve and the center line 10 of the speed measurement area are divided into a fixed number of segments. The corresponding points with the same sequence number are connected into line segments. The length difference between every two line segments is minimized, thereby obtaining the fitting curve 4, as shown in FIG. Fig.10 shown.
[0112] 2.6. Calculate the intersection points 30 and 34 of the fitting curve 4 and the edge lines 11 and 12 of the speed measurement area, as shown in Fig.10 As shown. Combine the centroid array, intersection 30 and intersection 34, and sort them by y coordinate from small to large to form an array QK = [[intersection 30, block_30 = 1], [centroid 32, block_32 = 1], [centroid 33, block_33 = 1], [intersection 34, block_34 = 1]]. Connect two adjacent centroids in array QK into a line segment.
[0113] 2.7. For the line segment [intersection point 30-centroid 32], calculate the distance wd between the point with the smallest x coordinate in the edge line 22 and the centroid 32 132 , calculate the distance wd between the point with the largest x coordinate in the edge line 22 and the centroid 32 232 , set the width of the line segment [intersection 30-centroid 32] to wd 132 +wd 232 Thus it becomes a filled rectangle [intersection 30-centroid 32], such as Fig.11 shown.
[0114] For the line segment [centroid 32-centroid 33], calculate the distance wd between the point with the smallest x coordinate in edge line 23 and centroid 33 133 , calculate the distance wd between the point with the largest x coordinate in the edge line 23 and the centroid 33 233, set the width of the line segment [centroid 32-centroid 33] to wd 133 +wd 233 Thus it becomes a filled rectangle [centroid 32-centroid 33], such as Fig.11 shown.
[0115] For the line segment [centroid 33 - intersection 34], calculate the distance wd between the point with the smallest x coordinate in the edge line 23 and the centroid 33 133 , calculate the distance wd between the point with the largest x coordinate in the edge line 23 and the centroid 33 233 , set the width of the line segment [centroid 33-intersection 34] to wd 133 +wd 233 Thus, it becomes a filled rectangle [centroid 33-intersection 34], such as Fig.11 shown.
[0116] 2.8. The edge lines 61 and 62 of the filled vehicle form vehicle areas 611 and 622. The overlapping area between the filled rectangle [intersection 30-center of mass 32] and the vehicle areas 611 and 622 is calculated. The overlapping area divided by the area of the filled rectangle [intersection 30-center of mass 32] is the overlapping rate η=50%. If it is greater than the threshold value of 1%, there is a vehicle blocking between [intersection 30-center of mass 32], and the value of block_32 remains unchanged and is still 1.
[0117] There is no overlapping area between the filled rectangle [centroid 32 - centroid 33] and the vehicle regions 611 and 622 , and there is no vehicle occlusion between [centroid 32 - centroid 33], so block_33=0 is set.
[0118] There is no overlapping area between the filled rectangle [centroid 33 - intersection 34] and the vehicle regions 611 and 622 , and there is no vehicle occlusion between [centroid 33 - intersection 34], so block_34=0 is set.
[0119] 2.9. For the element [[centroid 32, block_32 = 1], [centroid 33, block_33 = 0]] in the centroid array Q, since block_33 = 0, draw a perpendicular line from centroid 33 to fitting curve 4, and calculate the intersection point A of the perpendicular line and the edge line 13 of the speed measurement area. 33 , intersection point B with the edge line 14 of the speed measurement area 33 , connect A 33 and B 33 Draw a line segment as the vehicle speed detection line 53; draw a vertical line from the centroid 32 to the fitting curve 4, and calculate the intersection point A of the vertical line and the edge line 13 of the speed measurement area 32 , intersection point B with the edge line 14 of the speed measurement area 32 , connect A 32 and B 32 Draw a line segment as a vehicle speed detection line 52; Fig.11shown.
[0120] 2.10. Store the array QK = [[intersection 30, block_30 = 1], [centroid 32, block_32 = 1], [centroid 33, block_33 = 0], [intersection 34, block_34 = 0]] as array Q save , the coordinates of the speed detection lines 52 and 53 are [[A 32 B 32 ],[A 33 B 33 ]]Save as [A i B i ] save .
[0121] 2.11. For array QK, because block_32=1, the value of flag_temp does not change and remains 1.
[0122] Because flag_temp = 1, the process is not finished, and the next video image frame will be processed. For the automatic generation process of the detection line:
[0123] 3.1, such as Fig.12 The video image frame containing the test area is shown as Fig.13 The edge line 1 of the speed measurement area and the edge lines 201, 210, 202, and 203 of the lanes in the speed measurement area are shown. For the speed measurement area, the edge line 1 is divided into four sections according to the sudden change points of the slope of the edge line 1, as shown in FIG. Fig.14 As shown, the two shorter segments are edge lines 11 and 12 in the direction of the lane cross section, and the two longer segments are 13 and 14 along the lane direction, and the center line 10 of the speed measurement area edge lines 13 and 14 is calculated.
[0124] 3.2. Calculate the number of intersections between the edge lines 201, 210, 202, 203 of the lane dividing line and the edge line of the vehicle. The total number of intersections between the edge line 203 of the lane dividing line and the edge line of the vehicle>0. The total number of intersections between the edge lines 201, 210 and 202 of the lane dividing line and the edge line of the vehicle = 0, then calculate the centroids 301, 310, 302 of the edge lines of the lane dividing line, such as Fig.15 As shown, block_301 = 0, block_310 = 0, block_302 = 0. All the calculated centroids are sorted from small to large according to the y coordinate to form the centroid array Q new =[[center of mass 301, block_301 = 0], [center of mass 310, block_310 = 0], [center of mass 302, block_302 = 0]], wherein the center of mass 301, the center of mass 310, and the center of mass 302 represent the coordinates of the center of mass respectively.
[0125] 3.3. Because flag_auto=1, set all newly added block_Q i =1, then the centroid array Q new =[[center of mass 301, block k_301=1],[center of mass 310, block_310=1],[center of mass 302, block_302=1]], execute step 3.4.
[0126] 3.4. Read the last saved array Q save =[[intersection 30, block_30 = 1], [centroid 32, block_32 = 0], [centroid 33, block_33 = 0], [intersection 34, block_34 = 0]]. save And the centroid array Q new Merge into a new array QK = [[intersection 30, block_30 = 1], [center of mass 301, block_301 = 1], [center of mass 310, block_310 = 1], [center of mass 32, block_32 = 0], [center of mass 33, block_33 = 0], [intersection 34, block_34 = 0]], where the center of mass 32 and the center of mass 302 are merged into the same center of mass 32, such as Fig.16 As shown. The new centroid array Q = [[centroid 301, block_301 = 1], [centroid 310, block_310 = 1], [centroid 32, block_32 = 0], [centroid 33, block_33 = 0]].
[0127] 3.5. The number of elements in the centroid array Q is greater than 1. The centroids 301, 310, 32 and 33 are used as control points. The least square method is used to perform curve fitting. The fitting curve and the center line 10 of the speed measurement area are divided into a fixed number of segments. The corresponding points with the same sequence number are connected into line segments. The length difference between every two line segments is minimized, thereby obtaining the fitting curve 4, as shown in FIG. Fig.16 shown.
[0128] 3.6. Calculate the intersection points 30 and 34 of the fitting curve 4 and the edge lines 11 and 12 of the speed measurement area, as shown in Fig.16 As shown. Combine the array QK, intersection 30 and intersection 34, and sort them from small to large according to the y coordinate to form the array QK = [[intersection 30, block_30 = 1], [centroid 301, block_301 = 1], [centroid 310, block_310 = 1], [centroid 32, block_32 = 0], [centroid 33, block_33 = 0], [intersection 34, block_34 = 0]]. Connect two adjacent centroids in the array QK into a line segment.
[0129] 3.7. For the line segment [intersection point 30-centroid 301], calculate the distance wd between the point with the smallest x coordinate in the edge line 201 and the centroid 301 1301 , calculate the distance wd between the point with the largest x coordinate in the edge line 201 and the centroid 301 2301 , set the width of the line segment [intersection 30-centroid 301] to wd 1301 +wd 2301 Thus it becomes a filled rectangle [intersection 30-centroid 301], such as Fig.17 shown.
[0130] For the line segment [centroid 301 - centroid 310], calculate the distance wd between the point with the smallest x coordinate in the edge line 210 and the centroid 310 1310 , calculate the distance wd between the point with the largest x coordinate in the edge line 201 and the centroid 310 2310 , set the width of the line segment [centroid 301-centroid 310] to wd 1310 +wd 2310 Thus, it becomes a filled rectangle [centroid 301-centroid 310], such as Fig.17 shown.
[0131] For the line segment [centroid 310 - centroid 32], calculate the distance wd between the point with the smallest x coordinate in edge line 22 and centroid 32 132 , calculate the distance wd between the point with the largest x coordinate in the edge line 22 and the centroid 32 232 , set the width of the line segment [centroid 310-centroid 32] to wd 132 +wd 232 Thus it becomes a filled rectangle [centroid 310-centroid 32], such as Fig.17 shown.
[0132] For the line segment [centroid 32-centroid 33], calculate the distance wd between the point with the smallest x coordinate in edge line 23 and centroid 33 133 , calculate the distance wd between the point with the largest x coordinate in the edge line 23 and the centroid 33 233 , set the width of the line segment [centroid 32-centroid 33] to wd 133 +wd 233 Thus it becomes a filled rectangle [centroid 32-centroid 33], such as Fig.17 shown.
[0133] For the line segment [centroid 33 - intersection 34], calculate the distance wd between the point with the smallest x coordinate in the edge line 23 and the centroid 33 133 , calculate the distance wd between the point with the largest x coordinate in the edge line 23 and the centroid 33 233 , set the width of the line segment [centroid 33-intersection 34] to wd 133 +wd 233Thus, it becomes a filled rectangle [centroid 33-intersection 34], such as Fig.17 shown.
[0134] 3.8. The edge lines 61 and 62 of the filled vehicle constitute the vehicle areas 611 and 622. The overlapping area between the filled rectangle [centroid 32-centroid 33] and the vehicle areas 611 and 622 is calculated. The overlapping area divided by the area of the filled rectangle [centroid 32-centroid 33] is the overlapping rate η=70%. If it is greater than the threshold value 1%, there is a vehicle blocking between [centroid 32-centroid 33], and the value of block_33 remains unchanged and is still 0.
[0135] The overlapping area between the filled rectangle [centroid 33 - intersection 34] and the vehicle areas 611 and 622 is calculated. The overlapping area divided by the area of the filled rectangle [centroid 33 - intersection 34] is the overlapping rate η = 10%. If it is greater than the threshold value 1%, there is a vehicle blocking between [centroid 33 - intersection 34], and the value of block_34 remains unchanged and is still 0.
[0136] There is no overlapping area between the filled rectangle [intersection 30 - centroid 301] and the vehicle regions 611 and 622, and there is no vehicle occlusion between [intersection 30 - centroid 301], so block_301=0 is set.
[0137] There is no overlapping area between the filled rectangle [centroid 301 - centroid 310] and the vehicle regions 611 and 622 , and there is no vehicle occlusion between [centroid 301 - centroid 310 ], so block_310=0 is set.
[0138] There is no overlapping area between the filled rectangle [centroid 310 - centroid 32] and the vehicle regions 611 and 622 , and there is no vehicle occlusion between [centroid 310 - centroid 32 ], so block_32=0 is set.
[0139] 3.9. For the elements [[center of mass 301, block_301 = 0], [center of mass 310, block_310 = 0], [center of mass 32, block_32 = 0], [center of mass 33, block_33 = 0]] in the center of mass array Q,
[0140] Because block_301 = 0, draw a perpendicular line from the centroid 301 to the fitting curve 4, and calculate the intersection point A of the perpendicular line and the edge line 13 of the speed measurement area 301 , intersection point B with the edge line 14 of the speed measurement area 301 , connect A 301 and B 301 Draw a line segment as the vehicle speed detection line 501, such as Fig.17 As shown;
[0141] Because block_310 = 0, draw a perpendicular line from the centroid 310 to the fitting curve 4, and calculate the intersection point A of the perpendicular line and the edge line 13 of the speed measurement area 310 , intersection point B with the edge line 14 of the speed measurement area 310 , connect A 310 and B 310 Draw a line segment as a vehicle speed detection line 510, such as Fig.17 shown.
[0142] Because block_32 = 0, draw a perpendicular line from the centroid 32 to the fitting curve 4, and calculate the intersection point A of the perpendicular line and the edge line 13 of the speed measurement area 32 , intersection point B with the edge line 14 of the speed measurement area 32 , connect A 32 and B 32 Draw a line segment as the vehicle speed detection line 52, such as Fig.17 shown.
[0143] Because block_33 = 0, draw a perpendicular line from the centroid 33 to the fitting curve 4, and calculate the intersection point A of the perpendicular line and the edge line 13 of the speed measurement area 33 , intersection point B with the edge line 14 of the speed measurement area 33 , connect A 33 and B 33 Draw a line segment as the vehicle speed detection line 53, such as Fig.17 shown.
[0144] 3.10. Store the array QK = [[center of mass 30, block_30 = 1], [center of mass 301, block_301 = 0], [center of mass 310, block_310 = 0] [center of mass 32, block_32 = 0], [center of mass 33, block_33 = 0], [center of mass 34, block_34 = 0]] as array Q save , the coordinates of the speed detection lines 501, 510, 52, and 53 are [[A 301 B 301 ],[A 310 B 310 ],[A 32 B 32 ],[A 33 B 33 ]]Save as [A i B i ] save For array QK, except for the first item, block_Q of all elements i =0, set flag_temp=0, and the process ends.
[0145] See also Fig.18 , an embodiment of the present invention provides a vehicle speed detection line generation system based on video monitoring, comprising:
[0146] at least one processor;
[0147] at least one memory for storing at least one program;
[0148] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0149] It can be seen that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0150] In addition, an embodiment of the present invention further discloses a computer program product or a computer program, which is stored in a computer-readable storage medium. A processor of a computer device can read the computer program from a computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above method. Similarly, the contents of the above method embodiment are all applicable to the storage medium embodiment, and the functions specifically implemented by the storage medium embodiment are the same as those of the above method embodiment, and the beneficial effects achieved are also the same as those achieved by the above method embodiment.
[0151] The above described embodiments are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0152] Those skilled in the art will appreciate that the functional modules / units in all or some of the steps in the method disclosed above may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0153] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0154] It should be understood that in the present invention, "at least one (item)" refers to one or more, and "plurality" refers to two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can represent: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0155] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0156] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0157] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0158] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0159] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the embodiments of the present invention is not limited thereby. Any modification, equivalent substitution and improvement made by those skilled in the art without departing from the scope and essence of the embodiments of the present invention shall be within the scope of the rights of the embodiments of the present invention.
Claims
1. A method for generating vehicle speed detection lines based on video monitoring, It is characterized in that The method comprises the following steps: S100, acquiring a video image frame and an edge line of a speed measurement area, an edge line of a speed measurement marker in the speed measurement area, and an edge line of each vehicle in the speed measurement area in the video image frame; S200, determining an occlusion identifier based on an edge line of the speed measuring marker and an edge line of the vehicle, and forming a first centroid array with the centroid of the speed measuring marker and the corresponding occlusion identifier; S300, determining whether there is a generated detection line, if there is a generated detection line, executing S400; if there is no generated detection line, performing curve fitting on the centroids of all elements in the first centroid array based on the center line of the speed measurement area to obtain a fitting curve, and then executing S500; S400, obtaining the most recently saved centroid array, and generating a fitting curve based on the first centroid array and the most recently saved centroid array; S500, generating a filled rectangle based on the fitting curve and the edge line of the speed measurement area; S600, determining a filled rectangle that is not blocked by the vehicle, and generating a vehicle speed detection line based on the filled rectangle that is not blocked by the vehicle and the fitting curve; In S600, the determining of the filled rectangle that is not blocked by the vehicle, and generating the vehicle speed detection line based on the filled rectangle that is not blocked by the vehicle and the fitting curve, includes: S610, fill the edge lines cj of the vehicle to form a vehicle region Cj, calculate the overlapping area between the filled rectangle corresponding to the line segment Qi-1Qi and each vehicle region Cj, and divide the overlapping area by the area of the filled rectangle as the overlapping rate ηij, i=1, 2, ..., K; S620, if for any vehicle area Cj, the overlap rate ηij is less than the overlap threshold, it is determined that the line segment Qi-1Qi is not blocked by a vehicle, and block_Qi=0 is set; wherein the overlap area is Qi-1Qi∩Cj, i=1, 2, ..., K; S630, for each element [Qi, block_Qi] in the fourth centroid array Q, i=1, 2, ..., K-1, if block_Qi=0, draw perpendicular lines from the centroid Qi-1 and the centroid Qi to the fitting curve f(x), calculate the intersection point Ai of the perpendicular line with the edge line qk3 of the speed measurement area, and the intersection point Bi with the edge line qk4 of the speed measurement area, connect Ai and Bi to draw the line segment AiBi as the vehicle speed detection line.
2. The method according to claim 1, It is characterized in that In S200, the determining of the occlusion identifier based on the edge line of the speed measuring marker and the edge line of the vehicle, and forming a first centroid array with the centroid of the speed measuring marker and the corresponding occlusion identifier include: S210, calculating the edge line w of the speed measurement marker i The vehicle edge line c j The number of intersection points; S220, if the edge line w of the i-th speed measuring marker i If the total number of intersections with the edge lines of all vehicles is 0, then calculate the centroid Q of this speed marker i , and mark the occlusion identifier as block_Q i , set block_Q i =0; where block_Q i =0 means that the i-th speed marker is not affected by the blocking vehicle and the i-th speed marker can be used to detect the vehicle speed; block_Q i =1 means that the i-th speed marker is affected by the blocking vehicle and cannot be used to detect vehicle speed; S230, all the calculated centroids Q i Sort by y coordinate from small to large, with [Q i , block_Q i ] are elements, forming the first centroid array Q new .
3. The method according to claim 2, It is characterized in that In S300, the curve fitting is performed on the centroids of all elements in the first centroid array based on the center line of the speed measurement area to obtain a fitting curve, including: Take the first centroid array Q new The centroid Q of all elements i The least square method is used to fit the curve of each control point, and the curve obtained by fitting is compared with the center line q of the speed measurement area. k0 Divide the curve into equal parts and compare the fitted curve with the center line q of the speed measurement area. k0 The points with the same serial number in the figure are connected into line segments one by one, and the difference in length between every two line segments is minimized to obtain the fitting curve f(x).
4. The method according to claim 3, It is characterized in that In S400, the step of obtaining the most recently saved centroid array and generating a fitting curve based on the first centroid array and the most recently saved centroid array includes: S410, read the centroid array Q saved when the detection line was generated last time save , as the second centroid array Q save , the second centroid array Q save With the first centroid array Q new Merge into the third centroid array Qk, Qk=Q save ∪Q new , S420, calculating the second centroid array Q save Each centroid to the first centroid array Q new The distance of each centroid of , when the distance is less than the distance threshold, the two centroids involved in the calculation are set to the same centroid, and the block_Q in the third centroid array Qk is i The value of is set to the logical AND operation of the occlusion identifiers of the two elements, and the first and last items in the third centroid array Qk are removed to obtain the fourth centroid array Q; S430, when the number of elements in the fourth centroid array Q is greater than 1, the centroids Q of all elements in the fourth centroid array Q are i Perform curve fitting to obtain the fitting curve f(x).
5. The method according to claim 4, It is characterized in that In S430, the centroid Q of all elements in the fourth centroid array Q is i Perform curve fitting to obtain the fitting curve f(x), including: Take the centroid Q of all elements in the fourth centroid array Q i The least square method is used to fit the curve of each control point, and the curve obtained by fitting is compared with the center line q of the speed measurement area. k0 Divide the curve into equal parts and compare the fitted curve with the center line q of the speed measurement area. k0 The points with the same serial number in the figure are connected one by one into line segments, and the length difference between every two line segments is minimized to obtain a fitting curve f(x), wherein the center line of the speed measurement area is determined based on the two edge lines along the lane direction.
6. The method according to claim 5, It is characterized in that In S500, generating a filled rectangle based on the fitting curve and the edge line of the speed measurement area includes: S510, respectively calculating the fitting curve f(x) and the edge line q of the speed measurement area k1 The intersection point K 1 , fitting curve f(x) and edge line q of speed measurement area k2 The intersection point K 2 , the third centroid array Qk, K 1 and K 2 Merge and sort by y coordinate from small to large to form the fifth centroid array QK, QK=[[Q 0 , block_Q 0 ], [Q 1 , block_Q 1 ], [Q 2 , block_Q 2 ], ..., [Q K , block_Q K ]], connect two adjacent centroids in array QK into a line segment; S520, set line segment Q i-1 Q i The width of the filled rectangle is obtained.
7. The method according to claim 6, It is characterized in that In S520, the setting line segment Q i-1 Q i The width of the filled rectangle is obtained, including: For the i-th element in the fifth centroid array QK, i=1, 2, ..., K-1, calculate the edge line w i The point with the smallest x coordinate and the center of mass Q i The distance wd 1 , calculate the edge line w i The point with the largest x coordinate and the center of mass Q i The distance wd 2 , the line segment Q i-1 Q i The width is set to wd 1 +wd 2 , get the filled rectangle Q i-1 Q i ; For the Kth element in the fifth centroid array QK, calculate the edge line w K-1 The point with the smallest x coordinate and the center of mass Q K-1 The distance wd 1 , calculate the edge line w K-1 The point with the largest x coordinate and the center of mass Q K-1 The distance wd 2 , the line segment Q K-1 Q K The width is set to wd 1 +wd 2 , get the filled rectangle Q K-1 Q K .
8. A vehicle speed detection line generation system based on video monitoring, It is characterized in that include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a program executable by a processor stored therein, It is characterized in that The processor-executable program is used to perform the method according to any one of claims 1 to 7 when executed by the processor.
