A method for predicting highway traffic flow
Patent Information
- Application Number
- CN202611092724.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-09-01
AI Technical Summary
[0004]本发明所要解决的技术问题在于:如何解决交通流量难以精确预测的问题,提供了一种高速公路交通流量预测方法
[0033]本发明相比现有技术具有以下优点:该高速公路交通流量预测方法,在计算机图像处理的理论基础上截取到彩色图像,进行色相、饱和度以及光强度的灰度化转化处理,通过调整“饱和度”和“亮度”两个独立参数,解决图像中车辆与车道线的精切区分。通过将邻域边界上可用的无噪声像素通过加权算子进行加权,然后取加权后像素的中值作为修正后的强度,修复了图像滤波处理中未考虑噪声影响程度的缺陷。实现了交通流量的自动化、智能化预测,节约成本,提高了生产工作效率。
Smart Images

Figure CN122675892A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information modeling technology, and specifically to a method for predicting highway traffic flow. Background Technology
[0002] Traffic flow is a crucial input parameter for signal optimization on highways, and it also impacts the safety of vehicles and pedestrians. Collecting traffic flow data provides essential information for optimizing signal timing. Currently, common data collection methods include induction coils, video surveillance systems, and microwave detectors. These methods can only be installed in fixed locations, providing traffic flow information at their installation points. While this fixed-point observation method can provide detailed temporal information for the vicinity of the installation point, it is difficult to simultaneously obtain detailed and wide-ranging spatial information due to the limited observable area. Furthermore, these devices are costly to install and maintain, and the data is often managed independently by various departments, making it difficult to access. Therefore, there is an urgent need for a method that can automatically predict traffic flow.
[0003] With the rapid development of computer technology and the continuous progress of algorithm research, traffic flow prediction using contactless methods such as digital image processing has become a research hotspot in recent years. However, under the current detection and prediction technology, the acquired color images often contain a large amount of complex data, which can easily lead to confusion between vehicles and lane lines, making extraction impossible. Furthermore, during image noise removal, the impact of different noise factors on the original image pixels cannot be precisely considered, leading to difficulties in accurately identifying vehicle coordinate information after image acquisition, thus affecting the accuracy of the prediction results. Summary of the Invention
[0004] The technical problem to be solved by this invention is: how to solve the problem of difficulty in accurately predicting traffic flow, and to provide a method for predicting highway traffic flow.
[0005] The present invention solves the above-mentioned technical problems through the following technical solution, and the present invention includes the following steps:
[0006] S1: Use drones to collect driving video sequences, extract images of the vehicle's real-time displacement from the video, and perform grayscale conversion on them;
[0007] S2: Based on the transformed image, calculate the maximum neighborhood size used for noise removal;
[0008] S3: When removing noise, if there are noise-free pixels available on the boundary of a k×k pixel neighborhood Np(k) defined by the center pixel p, the noise-free pixels are weighted by a weighting operator, and the corrected light intensity of the center pixel p is calculated by combining the maximum neighborhood size.
[0009] S4: If there are no noise-free pixels available on the boundary of the k×k pixel neighborhood Np(k) defined by the center pixel p, then increase k, that is, let k=k+2. If k≤ the maximum neighborhood size, proceed to step S3; otherwise, do not adjust the light intensity value of the center pixel p.
[0010] S5: After processing all detected noise pixels through steps S3 and S4, replace each unprocessed noise pixel value with the processed and unprocessed pixel values.
[0011] S6: The vehicle displacement image processed in step S5 is detected by the target detection algorithm to obtain the horizontal and vertical coordinates of the center pixel of each vehicle detection box, which are used as the coordinates of the target vehicle pixel, and then the speed of each vehicle in the vehicle displacement image is calculated.
[0012] S7: Predict traffic flow based on the maximum calculated vehicle speed.
[0013] Furthermore, in step S1, the grayscale conversion formula is as follows:
[0014] (R+G+B);
[0015] min(R, G, B)];
[0016] ;
[0017] arccos{ };
[0018] Where R represents the red coordinate of a color in the cropped color image; G represents the green coordinate of a color in the cropped color image; B represents the blue coordinate of a color in the cropped color image; H represents hue; S represents saturation; and I represents light intensity. This indicates the intermediate converted angle value; the color image is the vehicle's displacement image at any given time.
[0019] Furthermore, in step S2, the maximum neighborhood size is calculated as follows:
[0020] The aspect ratio coefficient is obtained by dividing the maximum value of the horizontal pixel count M and the vertical pixel count N of the image by the minimum value. The sum of integer powers of the natural base e is calculated, where i is a consecutive integer starting from 0 up to the logarithm of the total image pixel count MN (base 10). This sum is then divided by the natural base e raised to the power of the logarithm of the total image pixel count (base 10) to obtain the scaling factor. Finally, the aspect ratio coefficient is multiplied by the scaling factor, and the result is rounded down to obtain the maximum neighborhood size. The corresponding calculation formula is as follows:
[0021] ;
[0022] in, The maximum neighborhood size is represented by ; M represents the horizontal number of pixels in the image; N represents the vertical number of pixels in the image; i is an integer. Let e be a logarithmic function with base 10, where e is the natural base.
[0023] Furthermore, in step S3, the corrected light intensity of the center pixel p is the pixel value of the center pixel p. The calculation method is as follows:
[0024] In size and maximum neighborhood size Within a consistent pixel neighborhood, assign weight values to each neighboring pixel, row by row and column by column. and corresponding pixel value Perform a cumulative summation; multiply the sum by 2, then divide by the square of the largest neighborhood size. With three times the maximum neighborhood size Add the values together and then subtract the value of 6. The result is the pixel value of the center pixel p. The corresponding calculation formula is as follows:
[0025] ;
[0026] in, The weight values of the neighboring pixels of the center pixel p; The neighborhood of the center pixel p Line number Column point pixel value.
[0027] Furthermore, in step S6, the formula for calculating vehicle speed is as follows:
[0028] ;
[0029] in, For vehicle speed; The x-coordinate of the vehicle pixel in the first real-time displacement image; This represents the x-coordinate of the vehicle pixel in the second image showing the vehicle's displacement at different times. Let x be the x-coordinate of the vehicle pixel in the (k-1)th time-time displacement image; Let x be the x-coordinate of the vehicle pixel in the k-th time-time displacement image; The vertical coordinate of the vehicle pixel in the first real-time displacement image; The vertical coordinate of the vehicle pixel in the second image showing the vehicle's displacement at different times; Let be the ordinate of the vehicle pixel in the (k-1)th time-time image of vehicle displacement; Let be the ordinate of the vehicle pixel in the k-th time-time displacement image; The frame interval between drone shots; the vehicle pixel in the image is the center pixel of the vehicle detection box in the image.
[0030] Furthermore, in step S7, traffic flow The prediction formula:
[0031] ;
[0032] in, This represents the average traffic density. This refers to the vehicle's maximum speed. The density is when traffic is so dense that vehicles cannot move.
[0033] Compared with existing technologies, this invention has the following advantages: Based on the theory of computer image processing, this highway traffic flow prediction method extracts a color image and performs grayscale conversion processing on hue, saturation, and light intensity. By adjusting two independent parameters, "saturation" and "brightness," it solves the problem of accurately distinguishing vehicles and lane lines in the image. By weighting the available noise-free pixels at the neighborhood boundary using a weighting operator, and then taking the median of the weighted pixels as the corrected intensity, it corrects the defect in image filtering processing that does not consider the degree of noise influence. This achieves automated and intelligent traffic flow prediction, saves costs, and improves production efficiency. Attached Figure Description
[0034] Figure 1 This is a flowchart illustrating the highway traffic flow prediction method of the present invention;
[0035] Figure 2 This is the first vehicle displacement image in this embodiment of the invention;
[0036] Figure 3 This is the second vehicle displacement image in this embodiment of the invention;
[0037] Figure 4 This is a schematic diagram of the weight values of the neighboring points of the center pixel p in an embodiment of the present invention;
[0038] Figure 5 This is an example diagram showing the weight values of the neighboring points of the center pixel p in an embodiment of the present invention. Detailed Implementation
[0039] The embodiments of the present invention are described in detail below. These embodiments are implemented based on the technical solution of the present invention, and provide detailed implementation methods and specific operation processes. However, the scope of protection of the present invention is not limited to the following embodiments.
[0040] like Figure 1 As shown, this embodiment provides a technical solution: a method for predicting highway traffic flow, comprising the following steps:
[0041] Step 1: Use drones to collect driving video sequences and extract images of the vehicle's real-time displacement from the videos.
[0042] Set the lateral overlap rate to 53%, the forward overlap rate to 53%, the flight speed to 9.3 m / s, and the edge distance to automatic. Acquire a sequence of driving video, and extract the vehicle's displacement images at different times from the video, as shown in Figures 2 and 3.
[0043] Step 2: The color image (vehicle displacement image at different times) captured in Step 1 is converted to grayscale as follows:
[0044] (R+G+B)
[0045] min(R, G, B)]
[0046]
[0047] arccos{ }
[0048] Where R represents the red coordinate (brightness of the red component) of a color in the cropped color image; G represents the green coordinate (brightness of the green component) of a color in the cropped color image; B represents the blue coordinate (brightness of the blue component) of a color in the cropped color image; H represents hue; S represents saturation; and I represents light intensity. This indicates the intermediate converted angle value.
[0049] In this embodiment, a color image is extracted based on the theory of computer image processing, and grayscale conversion processing is performed on hue, saturation and light intensity. By adjusting the two independent parameters of "saturation" and "brightness", the precise distinction between vehicles and lane lines in the image can be solved.
[0050] Step 3: Calculate the maximum neighborhood size used for noise removal from the transformed image in Step 2 using the following formula:
[0051]
[0052] in, The maximum neighborhood size is represented by ; M represents the horizontal pixel count of the image; N represents the vertical pixel count of the image; i is an integer. Let e be a logarithmic function with base 10, where e is the natural base.
[0053] For the displacement image of the first vehicle at any given time, M and N are 1920 and 1080 respectively. The maximum neighborhood size can be calculated. The value is 3; for the displacement image of the second vehicle at any given time, M and N are 2260 and 1440 respectively, and the maximum neighborhood size can be calculated. The value is 3.
[0054] Step 4: If there are noise-free pixels available on the boundary of the considered Np(k) (a k×k pixel neighborhood defined for the center pixel p) (initially k=3), the noise-free pixels are weighted using a weighting operator, and the corrected light intensity of the center pixel p is calculated by combining the weighted average of the pixel values and the maximum neighborhood size. The pixel value of the center pixel p (the corrected light intensity) is calculated as follows:
[0055]
[0056] in, The pixel value of the center pixel p; The maximum neighborhood size; The weight values of the neighboring pixels of the center pixel p; The neighborhood of the center pixel p Line number Column point pixel values;
[0057] For the displacement images of the first and second vehicles at different time points, the weights of the neighborhood points of the center point are... The values are as follows: Figure 4 As shown.
[0058] Through computer detection, for the displacement image of the first vehicle at a given time, there are noise-free pixels available on the boundary of Np(3), and the pixel value of each center point pixel p in the image is... The calculation formula is: .
[0059] Step 5: If no noise-free pixels are available on the boundary of the considered Np(k) (initially k=3): then increase k, i.e., let k=k+2. If k≤C, proceed to step 4. Otherwise, do not process p.
[0060] According to computer detection, for the second vehicle displacement image at any time, there are no noise-free pixels available on the boundary of Np(3). Since k=C, each center pixel p is not processed.
[0061] Step Six: After processing all detected noise pixels through Steps Four and Five, replace the value of each unprocessed noise pixel with the values of the previously processed and unprocessed pixels.
[0062] For both the first and second vehicle time-displacement images, each unprocessed noise pixel is replaced with the value of the previously processed pixel.
[0063] Step 7: The formula for calculating the speed of a certain vehicle is:
[0064]
[0065] in, Vehicle speed, in m / s; The x-coordinate of the vehicle pixel in the first driving video screenshot (vehicle displacement image at any time) (i.e., the center pixel of the vehicle detection box, whose x and y coordinates are obtained by the upstream target detection algorithm and used as the coordinates of the target vehicle pixel). The x-coordinate of the vehicle's pixel in the second driving video screenshot; Let x be the x-coordinate of the vehicle pixel in the (k-1)th driving video screenshot; Let x be the x-coordinate of the vehicle pixel in the k-th driving video screenshot; The vertical coordinate of the vehicle's pixel in the first screenshot of the driving video; The vertical coordinate of the vehicle's pixel in the second driving video screenshot; The vertical coordinate of the vehicle pixel in the (k-1)th driving video screenshot; Let be the ordinate of the vehicle pixel in the k-th driving video screenshot; The interval between frames captured by the drone is s.
[0066] For the black car in the first vehicle displacement image (at the first vehicle time moment) , The values are (232, 454);
[0067] For the black car in the second vehicle displacement image (at the second time point) , The values are (232.04, 454.21). = (1 / 30) s. The speed of the black car was calculated. It is 6.4 m / s.
[0068] Similarly, the speeds of other vehicles can be calculated, and the maximum speed of the vehicle is found to be 12.5 m / s, which is equivalent to 45 km / h.
[0069] Step 8: Predict traffic flow based on the vehicle speeds calculated in Step 7. The prediction formula is as follows:
[0070]
[0071] in, To predict traffic flow, vehicles / hour; The average traffic density (obtained from the original data or video surveillance of the road segment, i.e., the total number of vehicles during the observation period divided by the length of the road segment) is 46 vehicles / km. The maximum speed of the vehicle (in step seven, the speed of each vehicle during the observation period is calculated, but here we take the maximum speed) is 45 km / h. The density is 250 vehicles / km, representing the point at which traffic is so dense that vehicles cannot move.
[0072] In this embodiment, the predicted traffic flow is calculated. The rate is 3026 vehicles per hour.
[0073] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for predicting highway traffic flow, characterized in that, Includes the following steps: S1: Use drones to collect driving video sequences, extract images of the vehicle's real-time displacement from the video, and perform grayscale conversion on them; S2: Based on the transformed image, calculate the maximum neighborhood size used for noise removal; S3: When removing noise, if there are noise-free pixels available on the boundary of a k×k pixel neighborhood Np(k) defined by the center pixel p, the noise-free pixels are weighted by a weighting operator, and the corrected light intensity of the center pixel p is calculated by combining the maximum neighborhood size. In step S3, the corrected light intensity of the center pixel p is the pixel value of the center pixel p. The calculation formula is as follows: ; in, The weight values of the neighboring pixels of the center pixel p; The neighborhood of the center pixel p Line number Column point pixel values; S4: If there are no noise-free pixels available on the boundary of the k×k pixel neighborhood Np(k) defined by the center pixel p, then increase k, that is, let k=k+2. If k≤ the maximum neighborhood size, proceed to step S3; otherwise, do not adjust the light intensity value of the center pixel p. S5: After processing all detected noise pixels through steps S3 and S4, replace each unprocessed noise pixel value with the processed and unprocessed pixel values. S6: The vehicle displacement image processed in step S5 is detected by the target detection algorithm to obtain the horizontal and vertical coordinates of the center pixel of each vehicle detection box, which are used as the coordinates of the target vehicle pixel, and then the speed of each vehicle in the vehicle displacement image is calculated. S7: Predict traffic flow based on the maximum calculated vehicle speed; In step S7, traffic flow The prediction formula: ; in, This represents the average traffic density. This refers to the vehicle's maximum speed. The density when traffic is so dense that vehicles cannot move.
2. The method for predicting highway traffic flow according to claim 1, characterized in that, In step S1, the grayscale conversion formula is as follows: (R+G+B); my(R,G,B)]; ; arccos{ }; Where R represents the red coordinate of a color in the cropped color image; G represents the green coordinate of a color in the cropped color image; B represents the blue coordinate of a color in the cropped color image; H represents hue; S represents saturation; and I represents light intensity. This indicates the intermediate converted angle value; the color image is the vehicle's displacement image at any given time.
3. The method for predicting highway traffic flow according to claim 2, characterized in that, In step S2, the formula for calculating the maximum neighborhood size is as follows: ; in, The maximum neighborhood size is represented by ; M represents the horizontal pixel count of the image; N represents the vertical pixel count of the image; i is an integer. Let e be the logarithmic function with base 10, where e is the natural base.
4. The method for predicting highway traffic flow according to claim 1, characterized in that, In step S6, the formula for calculating vehicle speed is as follows: ; in, For vehicle speed; The x-coordinate of the vehicle pixel in the first real-time displacement image; This represents the x-coordinate of the vehicle pixel in the second image showing the vehicle's displacement at different times. Let x be the x-coordinate of the vehicle pixel in the (k-1)th time-time image of the vehicle's displacement. Let x be the x-coordinate of the vehicle pixel in the k-th time-time displacement image; The vertical coordinate of the vehicle pixel in the first real-time displacement image; The vertical coordinate of the vehicle pixel in the second image showing the vehicle's displacement at different times; Let be the ordinate of the vehicle pixel in the (k-1)th time-time image of vehicle displacement; Let be the ordinate of the vehicle pixel in the k-th time-time displacement image; The frame interval between drone shots; the vehicle pixel in the image is the center pixel of the vehicle detection box in the image.