A method and system for calculating night traffic flow based on vehicle headlight detection

Through the method based on car light detection, night vehicle detection and flow calculation are used to perform night vehicle detection and flow calculation, which solves the accuracy and real-time problems of night vehicle traffic statistics, and realizes high-precision traffic statistics under low-light conditions.

CN114663664BActive Publication Date: 2025-07-08ZHAOTONG LIANGFENGTAI INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210236181.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-11
Publication Date
2025-07-08
Estimated Expiration
2042-03-11

AI Technical Summary

Technical Problem

The existing night vehicle detection algorithm has low accuracy and complex processing procedures under conditions of no light or weak external light sources, making it difficult to achieve real-time and simple traffic statistics.

Method used

The method based on car light detection is adopted, and the original photos of driving at night are obtained by taking and binarized. The DBSCAN algorithm is used for clustering, matching paired car lights and tracking vehicles in several frames of photos to update the traffic.

Benefits of technology

It realizes accurate detection of vehicles under low-light conditions, has good robustness and real-time performance, simplifies processing flow, and improves the accuracy and efficiency of vehicle flow statistics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114663664B_ABST
    Figure CN114663664B_ABST
Patent Text Reader

Abstract

The present invention provides a method for calculating the night traffic flow based on headlight detection, which includes the following steps: taking an original photo of a night-time moving vehicle with headlights, performing binarization processing on the original photo to obtain a binarized image containing only headlights; clustering the binarized image through the DBSCAN algorithm to obtain clustering clusters of any shape, and the center point of each clustering cluster is considered as a headlight; matching all the clustering clusters to obtain paired headlights, and each paired headlight is considered as a target vehicle; tracking the target vehicle in several frames of the original photo to update the number of the target vehicles, so as to obtain the latest night traffic flow. It can exclude the abnormally extracted light source points in the image, has good robustness, and the processing flow is simple. Therefore, it can achieve real-time detection with relatively high detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of digital image processing, and in particular to a method and system for calculating night traffic flow based on vehicle headlight detection. Background Art

[0002] Traffic flow statistics is an indispensable part of intelligent transportation and plays a very important role in traffic situation perception. At present, the vehicle detection algorithms for daytime are becoming increasingly mature, greatly improving the acquisition efficiency of traffic flow information and making the traffic management by traffic departments more efficient. However, there are relatively few vehicle detection and traffic flow calculation algorithms for night scenes, and the accuracy of existing night vehicle detection algorithms is not ideal or the processing process is complex, which makes it difficult in practical applications. Therefore, it is necessary to propose a real-time, simple and highly accurate vehicle detection algorithm for night expressways to improve the current situation of night traffic flow statistics methods.

[0003] In the expressway scene with no light or weak external light source, the existing technologies generally use the method of inter-frame difference or background difference to extract the light information of vehicles from the image, so as to achieve the effect of night vehicle detection. Such a method will generate too much light source interference noise when the ground reflection is large, affecting the headlight extraction effect and reducing the overall vehicle detection accuracy. The method based on deep learning has a good effect in daytime vehicle detection, but deep learning depends on the target in the image to contain prominent texture features and the processing process is complex, making it difficult to deploy in practice, which is very difficult to work in the context of no external light source at night. Summary of the Invention

[0004] In order to overcome the above technical defects, the purpose of the present invention is to provide a method and system for calculating night traffic flow based on vehicle headlight detection with higher detection accuracy.

[0005] The present invention discloses a method for calculating night traffic flow based on vehicle headlight detection, including the following steps: taking an original photo of a night driving vehicle with vehicle headlights, performing binarization processing on the original photo to obtain a binarized image containing only vehicle headlights; clustering the binarized image by the DBSCAN algorithm to obtain clustering clusters of any shape, and the center point of each clustering cluster is considered as a vehicle headlight; matching all the clustering clusters to obtain paired vehicle headlights, and each paired vehicle headlight is considered as a target vehicle; tracking the target vehicle in several frames of the original photo to update the number of the target vehicles, so as to obtain the latest night traffic flow.

[0006] Preferably, the original photos of night driving with vehicle lights are captured, and the original photos are binarized to obtain a binarized image containing only vehicle lights, which includes: performing grayscale processing on the original photos, followed by mean filtering, then morphological processing, and using a combination of structural elements of different sizes to perform opening operation and closing operation on the original photos to eliminate the reflection areas in the original photos, so as to retain the information of the light source positions with the highest brightness, and then performing the binarization processing.

[0007] Preferably, clustering the binarized image through the DBSCAN algorithm to obtain clustering clusters of any shape includes: counting the white pixel points in the binarized image to generate point cloud data; clustering the point cloud data through the DBSCAN algorithm to obtain clustering clusters of any shape.

[0008] Preferably, matching all the clustering clusters to obtain paired vehicle lights includes: obtaining the coordinates of the center points of each clustering cluster, where the coordinates include abscissa and ordinate; arranging the clustering clusters in ascending order according to the abscissa; performing a neighborhood search on each clustering cluster to find the clustering cluster with the closest distance to it, and pairing the two as the two light sources of the same vehicle.

[0009] Preferably, performing a neighborhood search on each clustering cluster to find the clustering cluster with the closest distance to it, and pairing the two as the two light sources of the same vehicle includes: setting the attributes of the paired clustering clusters as matched, and the matched clustering clusters will no longer perform distance calculation and matching with other clustering clusters.

[0010] Preferably, performing a neighborhood search on each clustering cluster to find the clustering cluster with the closest distance to it, and pairing the two as the two light sources of the same vehicle includes: calculating the distance between each clustering cluster and other clustering clusters. If the distance between more than one clustering cluster and the same clustering cluster is the closest, then select the clustering clusters whose distance falls within the range of the first preset threshold and match them with the same clustering cluster.

[0011] Preferably, tracking the target vehicle in the original photos of several frames to update the number of target vehicles, so as to obtain the latest night traffic flow includes: regarding the paired vehicle lights as a target vehicle; obtaining the coordinates of the target vehicle according to the coordinates of the paired vehicle lights; in the original photos of several frames, setting the first frame as the initial frame and counting the number of all target vehicles in the initial frame, denoted as the initial traffic flow; starting from the initial frame, successively calculating the Euclidean distances between the coordinates of all target vehicles in two adjacent frames; if the Euclidean distance between the coordinates of two target vehicles is less than or equal to the second preset threshold range and is the minimum distance among the Euclidean distances between the coordinates of all target vehicles, it is considered that the two are the same vehicle in the two frames, and at the same time updating the coordinates of the target vehicle in the current frame to the current coordinates of the target vehicle; if the Euclidean distance between the coordinates of two target vehicles is greater than the second preset threshold range, it is considered that the target vehicle is not matched; if the unmatched target vehicle is in the current frame, it is considered that the target vehicle is a new vehicle, and then adding one to the initial traffic flow count; if the unmatched target vehicle is in the previous frame, it is considered that the target vehicle has left the scene represented by the current frame, and then subtracting one from the initial traffic flow count; continuously updating the initial traffic flow according to the updated original photos to obtain the current traffic flow.

[0012] Preferably, the reference displacement value is obtained by multiplying the actual average vehicle speed of each section by the time difference between two adjacent frames, and the second preset threshold range is set according to the reference displacement value.

[0013] Preferably, tracking the target vehicle in the original photos of several frames to update the number of target vehicles, so as to obtain the latest night traffic flow includes: in the original photos, setting a first area and a second area along the road forward direction, and the first area and the second area cover both sides of the road; if it is detected that the target vehicle first appears in the first area in one of several frames and then appears in the second area in another frame, it is considered that the target vehicle is an upward vehicle; if it is detected that the target vehicle first appears in the second area in one of several frames and then appears in the first area in another frame, it is considered that the target vehicle is a downward vehicle; the shooting time of one of the frames is earlier than the shooting time of the other frame.

[0014] The present invention also discloses a nighttime traffic flow calculation system based on headlight detection, including an image acquisition module, a headlight extraction module, a clustering module, a headlight matching module, a vehicle tracking module, and a counting module connected to each other; the image acquisition module takes and acquires an original photo of a nighttime vehicle with headlights, and the headlight extraction module performs binarization processing on the original photo to obtain a binarized image containing only headlights; the clustering module uses the DBSCAN algorithm to cluster the binarized image to obtain clustering clusters of any shape, and the center point of each clustering cluster is considered as a headlight; the headlight matching module matches all the clustering clusters to obtain paired headlights, and each paired headlight is considered as a target vehicle; the vehicle tracking module tracks the target vehicle in several frames of the original photo, and the counting module updates the number of the target vehicles, so as to obtain the latest nighttime traffic flow.

[0015] After adopting the above technical solution, compared with the prior art, it has the following beneficial effects:

[0016] 1. It can exclude the abnormally extracted light source points in the image, has good robustness, and the processing flow is simple, so it can achieve real-time detection and has relatively high detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flowchart of the nighttime traffic flow calculation method based on headlight detection provided by the present invention;

[0018] Figure 2 It is a flowchart of the processing method of the binarized image in step S200 of the nighttime traffic flow calculation method based on headlight detection provided by the present invention;

[0019] Figure 3 It is a schematic diagram of the image after grayscale processing in step S200 provided by the present invention;

[0020] Figure 4 It is a schematic diagram of the binarized image after step S200 provided by the present invention;

[0021] Figure 5 It is a schematic flowchart of the method for tracking a target vehicle provided by the present invention;

[0022] Figure 6 It is a schematic diagram of the image of the additional domain in step S400 provided by the present invention;

[0023] Figure 7 It is a schematic diagram of the structure of the nighttime traffic flow calculation system based on headlight detection provided by the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0024] The advantages of the present invention will be further elaborated below in conjunction with the accompanying drawings and specific embodiments.

[0025] Exemplary embodiments will be described in detail herein, which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0026] The terms used in the present disclosure are for the purpose of describing particular embodiments only and are not intended to limit the present disclosure. The singular forms "a", "the", and "said" used in the present disclosure and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0027] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".

[0028] In the description of the present invention, it should be understood that the orientation or positional relationships indicated by the terms "longitudinal", "transverse", "up", "down", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. are based on the orientation or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation of the present invention.

[0029] In the description of the present invention, unless otherwise specified and defined, it should be noted that the terms "mounted", "connected", and "coupled" should be understood in a broad sense. For example, it may be a mechanical connection or an electrical connection, or it may be the communication inside two elements. It may be directly connected, or indirectly connected through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms may be understood according to specific circumstances.

[0030] In the following description, suffixes such as "module", "component", or "unit" used to represent elements are only for the convenience of explaining the present invention, and they do not have specific meanings themselves. Therefore, "module" and "component" can be used interchangeably.

[0031] See the appendix Figure 1 , the present invention discloses a method for calculating night traffic flow based on headlight detection, including the following steps:

[0032] S100. Take an original photo of a night-time moving vehicle with headlights, perform binarization processing on the original photo to obtain a binarized image containing only headlights;

[0033] S200. Cluster the binarized image through the DBSCAN algorithm to obtain clustering clusters of any shape, and the center point of each clustering cluster is considered as a headlight;

[0034] S300. Match all the clustering clusters to obtain paired headlights, and each pair of headlights is considered as a target vehicle;

[0035] S400. Track the target vehicle in several frames of original photos to update the number of target vehicles, so as to obtain the latest night traffic flow.

[0036] Based on a camera set beside the road, the present invention takes real-time photos of the moving vehicles on the road, performs binarization processing on the obtained original images to obtain a binarized image containing only light sources, then uses the DBSCAN clustering algorithm to cluster several light source clusters from the binarized image, performs light source matching analysis based on the obtained light source clusters to obtain a pair of headlights, and a pair of headlights is considered as a target vehicle, thereby obtaining the representative coordinates of the target vehicle, so as to realize the positioning of the vehicle, and then perform target tracking on the target vehicle in several original images to confirm the passage of the target vehicle. Specifically, it is determined whether the target vehicle has passed according to whether the target vehicle continuously exists in multiple images, and the number of vehicles recognized in the original images is updated according to this data. The present invention can exclude abnormally extracted light source points in the image, has good robustness, and the processing flow is simple, so it can achieve real-time detection and has relatively high detection accuracy.

[0037] Preferably, see the appendix Figure 2, in step S100, first perform grayscale processing on the original photo, then perform mean filtering, and then perform morphological processing on the image. Since the influence of light reflection in the actual scene is considered, during the morphological processing of the original image, it is necessary to use a combination of structural elements of different sizes to perform opening and closing operations on the image to eliminate the reflection area in the image as much as possible, so that the position information of the light source with the highest brightness is retained, and then perform binarization processing to obtain the final processing result, so that the vehicle light source can be extracted even when the reflected light is strong. See Appendix Figure 3 The original image after grayscale processing, and see Appendix Figure 4 The final binarized image, where the white part is the vehicle light, including the light source part and the halo part.

[0038] Preferably, in step S200, the binarized image of the extracted vehicle light has been obtained. The next step is to obtain the vehicle position information from the light source points in the figure. When there is only one vehicle in the picture, it is relatively easy to count. However, when there are more vehicles, it is more difficult to count the light source position information. In the clustering algorithm, the DBSCAN clustering algorithm does not need to know the number of clusters in advance and can find clusters of any shape in the point cloud data. At the same time, by setting the minimum number of cluster points, noise data can be well filtered out, increasing the robustness of the entire method. Therefore, after obtaining the binarized image in the present invention, the white pixel points and their position information therein are counted to generate data similar to two-dimensional point cloud, and then the DBSCAN clustering algorithm is used to cluster this data to obtain an even number of cluster centers. This clustering method makes up for the disadvantage that the DBSCAN algorithm does not work well when the gap between classes is large.

[0039] Preferably, the purpose of vehicle light extraction is to locate the vehicle. Specifically, it is necessary to analyze and match the clustered light sources. Considering the difficulty of light source pairing when vehicles are parallel, in order to simplify light source pairing, the present invention first obtains the coordinates of the center point of each cluster, and the coordinates include the abscissa and the ordinate. The coordinates of this center point are used as the unique feature point of each light source, and then they are sorted in ascending order according to their horizontal coordinates. Starting from the first point, a neighborhood search is performed to find the point with the closest distance, and the two are confirmed as the two light sources of the same vehicle. At this time, the coordinates of the two successfully matched light sources can be used to represent the coordinates of the target vehicle, so as to realize the positioning of the target vehicle. In a preferred embodiment of the present invention, the representative coordinates of the target vehicle are a point.

[0040] In the preferred embodiment provided by the present invention, the paired center points are set to the paired state, and when the next point is paired, the distance and matching are no longer calculated with this point.

[0041] In other embodiments, another more rigorous but computationally more intensive matching method can also be adopted, that is, the distance is calculated between each clustering cluster and other clustering clusters. If the distances between more than one clustering cluster and the same clustering cluster are all the closest, then select the clustering clusters whose distances fall within the first preset threshold range and match them with the same clustering cluster.

[0042] For example, after point A is matched with all points, the matching result shows that the distance to point C is the closest, and the distance is S1; after point B is matched with all points, the matching result also shows that the distance to point C is the closest, and the distance is S2. Then select one of S1 and S2 that falls within the first preset threshold range and match it with point C, and select the point with the second closest matching distance for the other point to match with.

[0043] After iterative pairing according to the above method, the representative coordinates of the positions of all target vehicles can be obtained finally.

[0044] Preferably, in step S300, the target vehicle is tracked in several frames of original photos to update the number of target vehicles.

[0045] See Appendix Figure 5 , which specifically includes the following steps:

[0046] S301: Consider a pair of vehicle lights as a target vehicle and obtain the representative coordinates of this target vehicle;

[0047] S302: In several frames of original photos, set the first frame as the initial frame, and count and obtain the number of all target vehicles in the initial frame, which is recorded as the initial traffic flow;

[0048] S303: Starting from the initial frame, calculate the Euclidean distances between the coordinates of all target vehicles in adjacent two frames in turn;

[0049] S304: If the Euclidean distance between the coordinates of two target vehicles is less than or equal to the second preset threshold range and is the minimum distance among the Euclidean distances between the coordinates of all target vehicles, then consider the two as the same vehicle in two frames, and at the same time update the coordinate of this target vehicle in the current frame to its current coordinate;

[0050] S305: If the Euclidean distance between the coordinates of two target vehicles is greater than the second preset threshold range, then consider this target vehicle as not being matched; if the unmatched target vehicle is in the current frame, then consider this target vehicle as a new vehicle, and increment the initial traffic flow count by one; if the unmatched target vehicle is in the previous frame, then consider this target vehicle as having left the picture represented by the current frame, and decrement the initial traffic flow count by one;

[0051] S306: Continuously update the initial traffic flow according to the updated original photos to obtain the current traffic flow.

[0052] The reference displacement value is obtained by multiplying the actual average vehicle speed of each road section by the time difference between two adjacent frames, and the second preset threshold range is set according to the reference displacement value. The calculation speed of the above tracking method is fast and the accuracy is high.

[0053] Preferably, in order to realize the function of distinguishing the traffic flow in the up and down directions and further improve the accuracy of the traffic flow statistical method, the present invention also discloses a traffic flow statistical method based on an additional domain.

[0054] Specifically, in the original photo, a first area and a second area are set along the forward direction of the road, and the first area and the second area cover both sides of the road; if it is detected that a target vehicle appears in the first area in one of several frames and then appears in the second area in another frame, then the target vehicle is considered an upstream vehicle; if it is detected that a target vehicle appears in the second area in one of several frames and then appears in the first area in another frame, then the target vehicle is considered a downstream vehicle. The shooting time of one frame is earlier than that of another frame.

[0055] A preferred embodiment, see attached Figure 6 , in the picture of the captured image, two areas are selected, and these two areas span the road in the up and down directions in the picture. In the calculation program, when it is detected that a target enters area A, the ID of the target vehicle is added to the array represented by area A. If the ID of the target vehicle also appears in the array represented by area B, it means that the target is upstream, and the upstream count is incremented by 1, and the ID is deleted from the A and B arrays. When it is detected that a target vehicle enters area B, the ID of the target is added to the array represented by area B. If the ID of the target vehicle also appears in the array represented by area A, it means that the target is downstream, and the downstream count is incremented by 1, and the ID is deleted from the A and B arrays. By such a method, as long as it is ensured that the target ID remains unchanged during the time of entering and leaving areas A and B, an accurate traffic flow statistical value can be obtained.

[0056] See attached Figure 7 , the present invention also discloses a night traffic flow calculation system based on headlight detection, including:

[0057] - An image acquisition module, usually a camera, is set on both sides of the road or at the position where the traffic signal is set, and the image acquisition module captures and obtains the original photo of the night driving with headlights;

[0058] - A headlight extraction module, which performs binarization processing on the original photo to obtain a binarized image containing only headlights;

[0059] - A clustering module, which uses the DBSCAN algorithm to cluster the binarized image to obtain a clustering cluster of any shape, and the center point of each clustering cluster is considered as a headlight;

[0060] - A headlight matching module that matches all clustering clusters to obtain paired headlights, and each pair of headlights is considered a target vehicle;

[0061] - A vehicle tracking module that tracks the target vehicle in several frames of original photos;

[0062] - A counting module that records in real time the number of target vehicles obtained by statistics and updates the number of target vehicles in real time, so as to obtain the latest night traffic flow.

[0063] It should be noted that the embodiments of the present invention have better implementability and do not impose any form of limitation on the present invention. Any person skilled in the art may use the technical content disclosed above to change or modify it into an equivalent effective embodiment. However, as long as it does not depart from the content of the technical solution of the present invention, any modification, equivalent change or modification made to the above embodiments according to the technical essence of the present invention still falls within the scope of the technical solution of the present invention.

Claims

1. A method for calculating night traffic volume based on headlight detection, characterized in that It includes the following steps: Take an original photo of a night-time vehicle with vehicle lights, and perform binarization processing on the original photo to obtain a binarized image containing only vehicle lights; Cluster the binarized image by the DBSCAN algorithm to obtain clustering clusters of any shape, and the center point of each clustering cluster is considered to be a vehicle light; Match all the clustering clusters to obtain paired vehicle lights, and each paired vehicle light is considered to be a target vehicle; Track the target vehicle in several frames of the original photo to update the number of target vehicles, so as to obtain the latest night traffic flow; The tracking of the target vehicle in several frames of the original photo to update the number of target vehicles, so as to obtain the latest night traffic flow includes: Consider the paired vehicle lights as a target vehicle; obtain the coordinates of the target vehicle according to the coordinates of the paired vehicle lights; In several frames of the original photo, set the first frame as the initial frame, and count and obtain the number of all the target vehicles in the initial frame, which is recorded as the initial traffic flow; Starting from the initial frame, calculate the Euclidean distance between the coordinates of all the target vehicles in adjacent two frames in turn; If the Euclidean distance between the coordinates of the two target vehicles is less than or equal to the second preset threshold range and is the minimum distance among the Euclidean distances between the coordinates of all the target vehicles, it is considered that the two are the same vehicle in the two frames, and at the same time, update the coordinates of the target vehicle in the current frame to the current coordinates of the target vehicle; If the Euclidean distance between the coordinates of the two target vehicles is greater than the second preset threshold range, it is considered that the target vehicle is not matched; if the unmatched target vehicle is in the current frame, it is considered that the target vehicle is a new vehicle, and then add one to the initial traffic flow count; if the unmatched target vehicle is in the previous frame, it is considered that the target vehicle has left the picture represented by the current frame, and then subtract one from the initial traffic flow count; Continuously update the initial traffic flow according to the updated original photo to obtain the current traffic flow.

2. The method for calculating night traffic flow according to claim 1, characterized in that, The taking of the original photo of a night-time vehicle with vehicle lights and the performing of binarization processing on the original photo to obtain a binarized image containing only vehicle lights includes: Perform grayscale processing on the original photo, then perform mean filtering, and then perform morphological processing, and use a combination of structural elements of different sizes to perform opening operation and closing operation on the original photo to eliminate the reflection area in the original photo, so as to retain the information of the position of the light source with the highest brightness, and then perform the binarization processing.

3. The method for calculating night traffic flow according to claim 1, characterized in that The clustering of the binarized image by the DBSCAN algorithm to obtain clustering clusters of any shape includes: Count the white pixel points in the binarized image to generate point cloud data; Cluster the point cloud data by the DBSCAN algorithm to obtain clustering clusters of any shape.

4. The method for calculating the night traffic flow according to claim 1, characterized in that The matching of all the clustering clusters to obtain paired vehicle lights includes: Obtain the coordinates of the center point of each clustering cluster, and the coordinates include the abscissa and the ordinate; Arrange the clustering clusters in ascending order according to the abscissa; Perform a neighborhood search for each cluster to find the cluster closest to it, and pair the two as the two light sources of the same vehicle.

5. The method for calculating the night traffic flow according to claim 4, characterized in that The performing a neighborhood search for each cluster to find the cluster closest to it and pairing the two as the two light sources of the same vehicle includes: Set the attributes of the paired clusters as matched, and the matched clusters will no longer be used for distance calculation and matching with other clusters.

6. The method for calculating the night traffic flow according to claim 4, wherein The performing a neighborhood search for each cluster to find the cluster closest to it and pairing the two as the two light sources of the same vehicle includes: Calculate the distance between each cluster and other clusters. If the distances between more than one cluster and the same cluster are the closest, select the clusters whose distances fall within the first preset threshold range to match with the same cluster.

7. The method for calculating night traffic flow according to claim 1, characterized in that Obtain the reference displacement value by multiplying the actual average vehicle speed of each road section by the time difference between two adjacent frames, and set the second preset threshold range according to the reference displacement value.

8. The method for calculating night traffic flow according to claim 1, wherein, The tracking the target vehicle in several frames of the original photos to update the number of the target vehicles, so as to obtain the latest night traffic flow includes: In the original photo, set a first area and a second area along the road forward direction, and the first area and the second area cover both sides of the road; If the target vehicle is detected to appear in the first area in one frame and then appear in the second area in another frame in several frames, it is considered that the target vehicle is an upward vehicle; If the target vehicle is detected to appear in the second area in one frame and then appear in the first area in another frame in several frames, it is considered that the target vehicle is a downward vehicle; The shooting time of one of the frames is earlier than that of the other frame.

9. A night traffic flow calculation system based on headlight detection, characterized in that, It includes an image acquisition module, a headlight extraction module, a clustering module, a headlight matching module, a vehicle tracking module and a counting module connected to each other; The image acquisition module takes and acquires the original photo of a night-time driving vehicle with headlights, and the headlight extraction module performs binarization processing on the original photo to obtain a binarized image containing only headlights; The clustering module uses the DBSCAN algorithm to cluster the binarized image to obtain clusters of any shape, and the center point of each cluster is considered as a headlight; The headlight matching module matches all the clusters to obtain paired headlights, and each paired headlight is considered as a target vehicle; The vehicle tracking module tracks the target vehicle in several frames of the original photos, and the counting module updates the number of the target vehicles, so as to obtain the latest night traffic flow; The tracking the target vehicle in several frames of the original photos and updating the number of the target vehicles by the counting module, so as to obtain the latest night traffic flow includes: Consider the paired headlights as a target vehicle; obtain the coordinates of the target vehicle according to the coordinates of the paired headlights; In the original photos of several frames, set the first frame as the initial frame, and count and obtain the number of all the target vehicles in the initial frame, which is recorded as the initial traffic flow; Starting from the initial frame, calculate the Euclidean distance between the coordinates of all the target vehicles in two adjacent frames in sequence; If the Euclidean distance between the coordinates of the two target vehicles is less than or equal to the second preset threshold range and is the minimum distance among the Euclidean distances between the coordinates of all the target vehicles, then consider the two as the same vehicle in the two frames, and at the same time update the coordinate of the target vehicle in the current frame to its current coordinate; If the Euclidean distance between the coordinates of the two target vehicles is greater than the second preset threshold range, then consider that the target vehicle is not matched; if the unmatched target vehicle is in the current frame, then consider that the target vehicle is a new vehicle, and increment the initial traffic flow count by one; if the unmatched target vehicle is in the previous frame, then consider that the target vehicle has left the scene represented by the current frame, and decrement the initial traffic flow count by one; Continuously update the initial traffic flow according to the updated original photos to obtain the current traffic flow.

Citation Information

Patent Citations

  • Method for detecting and tracking night running vehicle

    CN102567705A

  • Method and system for nighttime vehicle detection on basis of vehicle light identification

    CN103208185A

  • Traffic light positioning method based on multiple clustering

    CN110287244A