In-lane vehicle detection method based on machine vision
Through the in-lane vehicle detection method based on machine vision, a cubic polynomial model is used to fit the lane lines and combined with auxiliary markers, which solves the problem of difficulty in lane line identification under special road conditions with existing technology, and achieves accurate vehicle position and in-lane offset. Calculation improves the scope and accuracy of detection methods.
Patent Information
- Application Number
- CN202410515753.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-26
- Publication Date
- 2024-08-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology, under special circumstances such as curves or non-parallel roads on both sides, it is difficult to accurately identify the lane lines and the position of the vehicle in front through lidar or machine vision, resulting in the failure of vehicle detection in the lane.
Adopt an in-lane vehicle detection method based on machine vision, use image processing algorithms to identify lane lines and vehicles ahead, use a cubic polynomial model to fit lane lines, combine exponential smoothing filtering and sliding window technology, update the fitting model in real time, and optimize parameters to improve accuracy , and use auxiliary markers for joint fitting when the unilateral lane line is blurred.
It ensures the accuracy of detection and calculation when the lane lines on one side are blurred, improves the scope and accuracy of the detection method, and is suitable for complex road conditions such as curves and non-parallel roads on both sides.
Smart Images

Figure CN118537824A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent vehicle navigation, and in particular to a method for detecting vehicles in a road based on machine vision. Background Art
[0002] When an autonomous navigation vehicle is driving on the road, it must not only identify the lane lines through machine vision, but also identify whether the vehicle in front is in the lane and the left and right deviation, so as to further determine its driving intention (changing lanes or going straight). Regarding the method of detecting vehicles in the lane, the most common method in engineering is to detect directly through laser radar. This method detects the geometric position of the front vehicle relative to the rear vehicle by installing a laser radar on the rear vehicle, and then combines the known lane width to easily determine whether the front vehicle is in the lane. However, this method has certain limitations. This method is more reliable on straight roads, but it will not work properly in some special cases, such as curves or roads with non-parallel sides.
[0003] A Chinese invention patent with publication number CN115346195B discloses a method for detecting vehicles in a lane based on machine vision to determine whether the front vehicle and the rear vehicle are in the same lane, including: image acquisition: collecting images of the road and the vehicle in front through a binocular camera installed just in front of the front of the rear vehicle; image processing: processing the image through a pattern recognition algorithm to identify the left and right lane lines and the vehicle in front; calculating the lane offset of the front vehicle, including: rotating the vertical line: rotating the vertical line with the centroid of the front vehicle as the center; fitting the slope quadratic curve: during the rotation process, calculating the distance between the centroid of the front vehicle and the quadratic curve and forming a sequence.
[0004] The existing patented technology calculates the lane offset of the front vehicle by identifying the left and right lane lines and the vehicle in front. However, in reality, the lane lines are blurred due to a long time and cannot be accurately identified at the same time, which in turn affects the judgment of the vehicle's position and the calculation of the lane offset. Summary of the invention
[0005] The present invention aims at solving the technical problems existing in the prior art and provides a method for detecting vehicles in a lane based on machine vision.
[0006] The technical solution of the present invention to solve the above technical problem is as follows: a method for detecting vehicles in a lane based on machine vision, the method comprising:
[0007] S100: Acquire image data 1, identify lane line 1 and the vehicle ahead through an image processing algorithm; the lane line 1 is a lane line on a certain side of the lane that can be identified, calculate the image coordinates of the centroid of the lane line 1 and the vehicle ahead; establish three-dimensional space coordinates, and project the space coordinates of the centroid of the lane line 1 and the vehicle ahead onto the xOy plane;
[0008] S200: Lane fitting, data preprocessing is required before fitting; historical data is obtained, and the historical data refers to data information on the distance, speed and direction of the vehicle ahead collected within a time window;
[0009] The time window is set according to the current speed; the historical data and lane-centroid data are preprocessed using an exponential smoothing filter method to remove noise points and outliers; the lane-centroid data are divided into several segments using a segmented fitting method, and each segment is fitted using a cubic polynomial model;
[0010] S300: Fitting quality assessment. After the fitting is completed, the fitting quality is assessed using the fitting residuals. If the fitting quality is poor, the fitting parameters are adjusted or the fitting model is reselected to improve the fitting accuracy.
[0011] Furthermore, the method further comprises:
[0012] S400: Real-time update, iterative optimization; continuously collect new data points and update the fitting model in real time, use the sliding window method to process the data stream, and only use the data within the time window for fitting to adapt to changes in road conditions; use the iterative method to optimize the fitting parameters;
[0013] S500: Determine the vehicle position and calculate the lane offset. Draw a perpendicular line from the centroid of the front vehicle to the x-axis, determine the intersection of the perpendicular line and the fitted lane line 1, and estimate the lateral position of the vehicle in the lane; rotate the line connecting the projection point on the lane line with the centroid of the front vehicle as the center; during the rotation process, calculate the distance between the centroid of the front vehicle and the projection point on the lane line, and record the corresponding rotation angle; find the rotation angle with the minimum distance, and the distance corresponding to this angle is the offset distance of the front vehicle relative to the lane line.
[0014] The beneficial effects of the present invention are as follows: when the lane line on one side is blurred and cannot be identified, the position of the vehicle and the calculation of the lane offset are determined based on the clear lane line on the other side, and only the lane line one on a single side is used. By preprocessing the lane line one and adopting a segmented fitting method, the accuracy of detection and calculation is guaranteed when the lane line on one side cannot be identified, thereby improving the scope of application of the detection method. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 The present invention is a flowchart of a method for detecting vehicles in a lane based on machine vision. DETAILED DESCRIPTION
[0016] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0017] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.
[0018] In the description of the present application, the term "for example" is used to mean "used as an example, illustration or description". Any embodiment described as "for example" in the present application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any technician in the field to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid unnecessary details to obscure the description of the present invention. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.
[0019] Embodiment 1
[0020] like Figure 1 As shown, the method includes:
[0021] S100: Acquire image data 1, identify lane line 1 and the vehicle ahead through an image processing algorithm; the lane line 1 is a lane line on a certain side of the lane that can be identified, calculate the image coordinates of the centroid of the lane line 1 and the vehicle ahead; establish three-dimensional space coordinates, and project the space coordinates of the centroid of the lane line 1 and the vehicle ahead onto the xOy plane;
[0022] S200: Lane fitting, data preprocessing is required before fitting; historical data is obtained, and the historical data refers to data information on the distance, speed and direction of the vehicle ahead collected within a time window;
[0023] Specifically, this method is applicable to the scenario where only one lane line can be identified and detected. If two lane lines are detected at the same time, a machine vision-based in-lane vehicle detection method disclosed in Chinese invention patent publication number CN115346195B can be used for detection.
[0024] The time window is set according to the current speed. The higher the speed, the smaller the time window. Preferably, the time window should be within the range of 10-15 seconds. The historical data and lane-centroid data are preprocessed using an exponential smoothing filter method to remove noise points and outliers. The lane-centroid data are divided into several segments using a segmented fitting method, and each segment is fitted using a cubic polynomial model.
[0025] Specifically, a computer vision algorithm is used to identify and track the vehicle in front, and the distance, speed and direction of the vehicle in front are estimated based on the size, position and movement of the vehicle in the image; the cubic polynomial model can capture the curvature changes of the lane line on the curved road section, identify the lane line through image processing technology, and record the coordinates of the data points on the lane line (x i ,y i ), where (i=1, 2, 3, ..., N) represents the index of the data point, and N represents the total number of data points; a cubic polynomial is selected as the fitting model: y=ax i ^3+bx i ^2+cx i +d; use the sum of squared errors as the cost function, that is At the same time, the least squares method is used to estimate the model parameters a, b, c, and d, and the parameter values that minimize the cost function are found.
[0026] S300: Fitting quality assessment: after the fitting is completed, the fitting quality is assessed using the fitting residuals; if the fitting quality is poor, the fitting parameters are adjusted or the fitting model is reselected to improve the fitting accuracy;
[0027] Specifically, for each data point, calculate the difference between its observed value and the model predicted value. This difference is the fitting residual. Plot the calculated fitting residual into a graph, with the order of data points as the x-axis and the residual value as the y-axis, to intuitively show the fitting of each data point. Observe the residual graph to check whether the residual is randomly distributed and has no obvious systematic deviation. If the residual shows an obvious trend or cyclical change, it means that the model has failed to fully capture certain characteristics of the data and the fitting quality is not ideal. By calculating the mean of the residual, the mean is ideally close to 0, indicating that the average deviation of the predicted value is very small. Then calculate the standard deviation or variance of the residual to measure the degree of dispersion of the residual. A smaller standard deviation or variance means that the model fits the data more stably.
[0028] When the fitting quality is not ideal, it is necessary to adjust the order of the model, introduce or delete certain variables, and modify the model parameters, recalculate the fitting residuals and evaluate the fitting quality to obtain more standard and stable model data. Record the residual graphs, residual statistics, and model adjustment process of each fitting, and show the best fitting results and corresponding residual analysis in the final report.
[0029] S400: Real-time update, iterative optimization; continuously collect new data points and update the fitting model in real time, use the sliding window method to process the data stream, and only use the data within the time window for fitting to adapt to changes in road conditions; use the iterative method to optimize the fitting parameters;
[0030] Specifically, the initial parameters are first used for fitting, and then the parameters are adjusted according to the fitting results, and the fitting process is repeated until a satisfactory fitting accuracy is achieved or the maximum number of iterations is reached;
[0031] S500: Determine the vehicle position and calculate the lane offset. Draw a perpendicular line from the centroid of the front vehicle to the x-axis, determine the intersection of the perpendicular line and the fitted lane line 1, and estimate the lateral position of the vehicle in the lane; rotate the line connecting the projection point on the lane line with the centroid of the front vehicle as the center; during the rotation process, calculate the distance between the centroid of the front vehicle and the projection point on the lane line, and record the corresponding rotation angle; find the rotation angle with the minimum distance, and the distance corresponding to this angle is the offset distance of the front vehicle relative to the lane line.
[0032] The technical solutions in the above embodiments of the present application have at least the following technical effects or advantages:
[0033] When the lane line on one side is blurred and cannot be identified, the present application uses lane line one on a single side. By preprocessing the data of lane line one and adopting a segmented fitting method, the accuracy of detection and calculation is guaranteed when the lane line on one side cannot be identified, thereby improving the scope of application of the detection method.
[0034] Example 2
[0035] In the first embodiment, when the lane line on one side is blurred and cannot be accurately identified, the lane line on one side is used for fitting and calculating the offset. Since only the lane line on one side is used for fitting, the accuracy is low.
[0036] Acquire image data 2, and identify auxiliary marker 1 through image processing algorithm; calculate the centroid image coordinates of auxiliary marker 1, and project the centroid image coordinates of auxiliary marker 1, the centroid of lane line 1, and the spatial coordinates of the centroid of the front vehicle onto the xOy plane; use a cubic polynomial model to jointly fit the centroid projection of lane line 1 and auxiliary marker 1; use auxiliary marker 1 as a reference point to improve the accuracy of lane line fitting.
[0037] The method for selecting the auxiliary marker one is specifically as follows: selecting a time range and a time interval according to the current vehicle speed, acquiring image data two multiple times within the time range according to the time interval, preprocessing all images within the time range, extracting features from the image using computer vision technology, matching the extracted features, counting the frequency of the features appearing in all images, identifying candidate markers according to the frequency of the features appearing, and verifying the identified candidate markers; based on the distance between the two original lane lines on the current road, the distance between the lane line one identified in the image data one and the lane line one is used as one of the conditions for selecting the auxiliary marker one, calculating the distance between the marker and the lane line one, and if the difference between the distance between a certain marker and the lane line one and the distance between the two original lane lines is the smallest, then the marker is preferentially selected as the auxiliary marker one.
[0038] The distance between the two original lane lines of the current road is obtained when both lane lines are recognizable.
[0039] Preferably, when selecting the time range and time interval according to the current vehicle speed, the faster the speed, the smaller the time interval should be, and the distance traveled by the vehicle within the time interval should be within 8 to 12 meters, and the time range should include at least 10 complete time intervals.
[0040] Specifically, the preprocessing steps include grayscale, noise reduction and image enhancement. The color image is converted into a grayscale image to simplify subsequent processing. The noise in the image is removed by Gaussian filtering. The contrast of the image is enhanced by the histogram equalization method to highlight the image features. The edge information in the image is extracted by the Canny edge detection method, and the feature points in the image are extracted by the ORB (Oriented FAST and Rotated BRIEF) algorithm. For the feature points extracted from each image, the FLANN (Fast Library for Approximate Nearest Neighbors) algorithm is used for feature matching to find out the feature points that appear repeatedly in different images. The frequency of each feature point in all images and its position information in the image are counted. According to the frequency of occurrence of the feature points, the feature points that appear frequently are screened out as candidate markers. For the candidate markers, check whether their positions in different images are consistent or close. Generate similarity based on the inspection results. If the similarity is higher than 80%, they are close to exclude the feature points that are mismatched. After screening, the feature points with high frequency and consistent positions are determined as auxiliary markers.
[0041] Among them, the Canny edge detection method identifies the actual edges in the image while minimizing the identified non-edge parts, and requires that the detected edges are as close as possible to the actual edges; ORB (Oriented FAST and Rotated BRIEF) is a fast and efficient feature point detection and descriptor algorithm that combines the FAST corner detector and the BRIEF (Binary Robust Independent Elementary Features) descriptor, and adds direction information and rotation invariance. BRIEF is a binary descriptor generated by comparing pixel pairs around feature points; FLANN is a fast approximate nearest neighbor library. The FLANN library is used to establish an index for the feature point descriptor set of one of the images. For each feature point in the other image, the FLANN library is used to perform a nearest neighbor search in the indexed feature point set. Based on the results of the nearest neighbor search, the matching feature point pairs between the two images can be determined.
[0042] Calculate the centroid image coordinates of auxiliary marker one, and project the centroid image coordinates of auxiliary marker one, the centroid of lane one, and the spatial coordinates of the centroid of the vehicle in front onto the xOy plane. Use a cubic polynomial model to jointly fit the centroid projection of lane one and auxiliary marker one. Use auxiliary marker one as a reference point to improve the accuracy of lane fitting.
[0043] The technical solutions in the above embodiments of the present application have at least the following technical effects or advantages:
[0044] This application adds an auxiliary marker 1 as a reference point on the basis of using the lane line 1 on one side, and further improves the accuracy of detection and calculation by jointly fitting the lane line 1 and the auxiliary marker 1.
[0045] Embodiment 3
[0046] In Example 2, lane line one and auxiliary marker one are combined for joint fitting to improve the accuracy of the calculation. However, in actual applications, the data weight distribution of lane line one and auxiliary marker one needs to be adaptively adjusted to further improve the fitting accuracy and stability.
[0047] During lane fitting, initial weights are set based on the evaluation results of lane line one data and auxiliary marker one data. The weight of lane line one data is set to w-1, and the weight of auxiliary marker one data is set to w-2. The initial weights are used for preliminary fitting, and the fitting effect is evaluated secondary. Based on the secondary evaluation results, the weights are gradually adjusted.
[0048] The lane line data and the auxiliary marker data are evaluated, and the recognition accuracy, stability and credibility of the lane line data and the auxiliary marker data are evaluated respectively. When setting the initial weight, 0.5 is used as the benchmark and the weight is floated according to the evaluation results. Different weight combinations are used to carry out lane line fitting experiments, and the fitting residuals are used to compare the fitting results under different weight combinations to evaluate their accuracy and robustness. The number of iterations is preset, and an optimal weight ratio is found through iteration and verification.
[0049] Among them, the labeled lane line data and auxiliary marker data are used as the benchmark data for evaluation. The lane lines and markers are identified using a standard recognition algorithm, and the recognition results are compared with the labeled benchmark data to obtain the recognition accuracy, false detection rate and missed detection rate. The recognition results of lane lines and markers in multiple consecutive frames of data are analyzed, their fluctuations are observed, and the differences in recognition results between consecutive frames are calculated to measure the stability of the data. Combining the recognition accuracy and data stability, a credibility score is assigned to the data source, and a machine learning model is used to automatically evaluate the credibility of the data source.
[0050] Preferably, to ensure the efficiency of data processing, the number of iterations is set to 6-8 times, and an optimal weight ratio is selected from the middle after the number of iterations is completed.
[0051] For example, in complex urban road conditions, lane lines may often be blocked by pedestrians, vehicles or other obstacles, resulting in unstable recognition. Signs (such as traffic lights, stop signs, etc.) may be more important in such scenarios, and are usually more obvious and easy to identify. In the initial stage, we can set the same weight for lane line data and auxiliary marker data, that is, w-1 = w-2 = 0.5. This setting is based on an assumption that before there is enough data to verify which data source is more reliable, we consider both to be equally important. Evaluate the data of both, obtain recognition accuracy, stability and credibility respectively, and compare them. According to the experimental results, if it is found that auxiliary marker data is more reliable and stable than lane line data in complex urban road conditions, then gradually increase the weight of marker data, that is, w-1 = 0.45, w-2 = 0.55. Under the new weight setting, conduct experiments and evaluations again to observe whether the accuracy and robustness of the fitting results are improved. If the new weight setting brings about a significant performance improvement, then we can continue to optimize in this direction, preset the number of iterations, and find an optimal weight ratio through iteration and verification. To ensure the efficiency of data processing, the number of iterations is set to 8 times. After completing 8 iterations, an optimal weight ratio is selected from the middle, so that the system can maintain a high lane line fitting accuracy and stability under complex urban road conditions.
[0052] The technical solutions in the above embodiments of the present application have at least the following technical effects or advantages:
[0053] When jointly fitting lane line one and auxiliary marker one, the present application dynamically adjusts the weight distribution ratio of lane line one and auxiliary marker one data according to different actual scenarios, makes targeted adjustments for different situations and scenarios, and achieves higher lane line fitting accuracy and stability.
[0054] Embodiment 4
[0055] In the above embodiment, auxiliary marker 1 is added to lane line 1 for joint fitting, and auxiliary marker 1 is used as a reference point. The size and shape of auxiliary marker 1 may vary depending on the scene, which will have different effects on the joint fitting.
[0056] A new marker is identified among the candidate markers that is spatially correlated with auxiliary marker one and is captured in the same road section. After verification, the verified new marker is set as auxiliary marker two. Based on the positional relationship between auxiliary marker one and auxiliary marker two, a curved auxiliary line passing through auxiliary marker one and auxiliary marker two is determined.
[0057] The verification includes three aspects: timestamp synchronization verification, spatial position judgment and field of view overlap check. The timestamp comparison is used to ensure that the acquired auxiliary marker 1 and the new marker are collected at the same time point or within a time interval; the spatial coordinates of the auxiliary marker 1 and the new marker are analyzed to ensure that the relative positions on the road plane are reasonable to ensure that they are in the same road section; and it is checked whether the auxiliary marker 1 and the new marker appear in the same frame image, or appear in continuous frames and the positions are stable.
[0058] Preferably, the spatial coordinate positions of the auxiliary marker 1 and the new marker should be within the range of two time intervals of the current vehicle speed during image data acquisition. For example, if the current vehicle speed is 100 kilometers per hour and the time interval of image acquisition is set to 0.4 seconds, then the spatial coordinate positions of the auxiliary marker 1 and the new marker should be within 22 meters.
[0059] The curve auxiliary line is determined by calculating the line between the auxiliary marker 1 and the auxiliary marker 2, using a spline curve fitting method to fit a curve passing through the two points, and continuously recalculating and updating the position and direction of the auxiliary line as the vehicle moves and the road conditions change;
[0060] A cubic polynomial model is used to jointly fit the centroid projection of lane line one and the curve auxiliary line, and the data weight distribution ratio of lane line one and the curve auxiliary line is dynamically adjusted to finally determine the vehicle position and calculate the in-lane offset.
[0061] Specifically, the method of using a cubic polynomial model to jointly fit the centroid projection of lane line one and the curve auxiliary line is consistent with the fitting methods of the above-mentioned embodiments one and two. The data weight distribution ratio of lane line one and the curve auxiliary line is dynamically adjusted. The weight distribution experimental method in embodiment three is used to evaluate the recognition accuracy, stability and credibility of auxiliary marker one and auxiliary marker two, respectively, and the weights are compared with the data of lane line one to obtain more accurate calculations.
[0062] If an abnormal marker position is detected (such as sudden disappearance or jumping), historical data should be used for prediction or the data of the marker should be ignored to ensure the stability and accuracy of the auxiliary line.
[0063] The technical solutions in the above embodiments of the present application have at least the following technical effects or advantages:
[0064] The present application selects a suitable auxiliary marker 2 from the candidate markers, fits the auxiliary marker 1 and the auxiliary marker 2 to form a curve auxiliary line, and uses the curve auxiliary line and lane line 1 for joint fitting to ensure the continuity of the reference point and further improve the lane line fitting accuracy and stability effect.
[0065] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0066] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0067] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0068] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0069] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0070] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0071] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for detecting vehicles in a lane based on machine vision, characterized in that: The method comprises: S100: Acquire image data 1, identify lane line 1 and the vehicle ahead through an image processing algorithm; the lane line 1 is a lane line on a certain side of the lane that can be identified, calculate the image coordinates of the centroid of the lane line 1 and the vehicle ahead; establish three-dimensional space coordinates, and project the space coordinates of the centroid of the lane line 1 and the vehicle ahead onto the xOy plane; S200: Lane fitting, data preprocessing is required before fitting; historical data is obtained, and the historical data refers to data information on the distance, speed and direction of the vehicle ahead collected within a time window; The time window is set according to the current speed; the historical data and lane-centroid data are preprocessed using an exponential smoothing filter method to remove noise points and outliers; the lane-centroid data are divided into several segments using a segmented fitting method, and each segment is fitted using a cubic polynomial model; S300: Fitting quality assessment. After the fitting is completed, the fitting quality is assessed using the fitting residuals. If the fitting quality is poor, the fitting parameters are adjusted or the fitting model is reselected to improve the fitting accuracy.
2. The method for detecting vehicles in a lane based on machine vision according to claim 1, characterized in that: The method further comprises: S400: Real-time update, iterative optimization; continuously collect new data points and update the fitting model in real time, use the sliding window method to process the data stream, and only use the data within the time window for fitting to adapt to changes in road conditions; use the iterative method to optimize the fitting parameters; S500: Determine the vehicle position and calculate the lane offset. Draw a perpendicular line from the centroid of the front vehicle to the x-axis, determine the intersection of the perpendicular line and the fitted lane line 1, and estimate the lateral position of the vehicle in the lane; rotate the line connecting the projection point on the lane line with the centroid of the front vehicle as the center; during the rotation process, calculate the distance between the centroid of the front vehicle and the projection point on the lane line, and record the corresponding rotation angle; find the rotation angle with the minimum distance, and the distance corresponding to this angle is the offset distance of the front vehicle relative to the lane line.
3. The method for detecting vehicles in a lane based on machine vision according to claim 1, characterized in that: The method further comprises: Acquire image data 2, and identify auxiliary marker 1 through image processing algorithm; calculate the centroid image coordinates of auxiliary marker 1, and project the centroid image coordinates of auxiliary marker 1, the centroid of lane line 1, and the spatial coordinates of the centroid of the front vehicle onto the xOy plane; use a cubic polynomial model to jointly fit the centroid projection of lane line 1 and auxiliary marker 1; use auxiliary marker 1 as a reference point to improve the accuracy of lane line fitting.
4. The method for detecting vehicles in a lane based on machine vision according to claim 3, characterized in that: The method for selecting the auxiliary marker one is specifically as follows: selecting a time range and a time interval according to the current vehicle speed, acquiring image data two multiple times within the time range according to the time interval, preprocessing all images within the time range, extracting features from the image using computer vision technology, matching the extracted features, counting the frequency of the features appearing in all images, identifying candidate markers according to the frequency of the features appearing, and verifying the identified candidate markers; based on the distance between the two original lane lines on the current road, the distance between the lane line one identified in the image data one and the lane line one is used as one of the conditions for selecting the auxiliary marker one, calculating the distance between the marker and the lane line one, and if the difference between the distance between a certain marker and the lane line one and the distance between the two original lane lines is the smallest, then the marker is preferentially selected as the auxiliary marker one.
5. The method for detecting vehicles in a lane based on machine vision according to claim 3, characterized in that: During lane fitting, initial weights are set based on the evaluation results of lane line one data and auxiliary marker one data. The weight of lane line one data is set to w-1, and the weight of auxiliary marker one data is set to w-2. The initial weights are used for preliminary fitting, and the fitting effect is evaluated secondary. Based on the secondary evaluation results, the weights are gradually adjusted.
6. The method for detecting vehicles in a lane based on machine vision according to claim 5, characterized in that: The lane line data and the auxiliary marker data are evaluated, and the recognition accuracy, stability and credibility of the lane line data and the auxiliary marker data are evaluated respectively. When setting the initial weight, 0.5 is used as the benchmark and the weight is floated according to the evaluation results. Different weight combinations are used to carry out lane line fitting experiments, and the fitting residuals are used to compare the fitting results under different weight combinations to evaluate their accuracy and robustness. The number of iterations is preset, and an optimal weight ratio is found through iteration and verification.
7. The method for detecting vehicles in a lane based on machine vision according to claim 4, characterized in that: A new marker is identified among the candidate markers that is spatially correlated with auxiliary marker one and is captured in the same road section. After verification, the verified new marker is set as auxiliary marker two. Based on the positional relationship between auxiliary marker one and auxiliary marker two, a curved auxiliary line passing through auxiliary marker one and auxiliary marker two is determined.
8. The method for detecting vehicles in a lane based on machine vision according to claim 4, characterized in that: The verification includes three aspects: timestamp synchronization verification, spatial position judgment and field of view overlap check. The timestamp comparison is used to ensure that the acquired auxiliary marker 1 and the new marker are collected at the same time point or within a time interval; the spatial coordinates of the auxiliary marker 1 and the new marker are analyzed to ensure that the relative positions on the road plane are reasonable to ensure that they are in the same road section; and it is checked whether the auxiliary marker 1 and the new marker appear in the same frame image, or appear in continuous frames and the positions are stable.
9. The method for detecting vehicles in a lane based on machine vision according to claim 7, characterized in that: The curve auxiliary line is determined by calculating the line between auxiliary marker 1 and auxiliary marker 2, using a spline curve fitting method to fit a curve passing through the two points, and continuously recalculating and updating the position and direction of the auxiliary line as the vehicle moves and road conditions change.
10. The method for detecting vehicles in a lane based on machine vision according to claim 9, characterized in that: A cubic polynomial model is used to jointly fit the centroid projection of lane line one and the curve auxiliary line, and the data weight distribution ratio of lane line one and the curve auxiliary line is dynamically adjusted to finally determine the vehicle position and calculate the in-lane offset.
Citation Information
Patent Citations
Marker detection and identification method based on structural forest and PCANet
CN110263635A
In-lane vehicle detection method based on machine vision
CN115346195A
Lane level positioning method and device, electronic equipment, storage medium and vehicle
CN116067377A
Lane line segmentation fitting method and system
CN116503829A
Method for detecting lane departure and apparatus thereof
US20100002911A1
