Lane line detection method and device, computer device and storage medium
By extracting edge lines and filtering targets from multiple frames of images, and combining multi-threaded parallel processing and the Hough algorithm, the error problem of traditional lane line detection in complex environments is solved, and efficient and accurate lane line detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FAW JIEFANG AUTOMOTIVE CO
- Filing Date
- 2023-01-13
- Publication Date
- 2026-05-29
AI Technical Summary
Traditional lane line detection methods are prone to errors in complex environments, resulting in inaccurate lane line detection.
By acquiring multiple initial images, edge line extraction and detection are performed on the lane line images respectively. Combined with target screening and lane line tracking, multi-threaded parallel processing and the Hough line detection algorithm are used to select accurate lane line results.
It improves the accuracy and efficiency of lane line detection, enabling accurate lane line detection in complex environments, especially in curved conditions.
Smart Images

Figure CN116092035B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of lane line detection technology, and in particular to a lane line detection method, apparatus, computer equipment, and storage medium. Background Technology
[0002] Lane detection is a prerequisite for vehicle positioning and road planning. To ensure the safety of vehicles during driving, autonomous driving systems need to keep the vehicle moving along the lane lines on the road, which requires accurate perception of the lane lines.
[0003] Traditional techniques typically involve acquiring large amounts of image data and performing lane line detection based on that data. For example, deep learning-based methods divide each pixel in the image data into lane line regions or background, and then perform lane line detection on the lane line regions.
[0004] However, due to the complexity of real-world environments and the many factors that affect lane line detection, the detection results based on lane line areas may contain errors, making it impossible to accurately detect lane lines. Summary of the Invention
[0005] Therefore, it is necessary to provide a lane line detection method, apparatus, computer equipment, and storage medium that can accurately detect lane lines, addressing the aforementioned technical problems.
[0006] Firstly, this application provides a lane line detection method, the method comprising:
[0007] Acquire multiple initial images; these initial images include lane line images and other images that do not contain lane lines.
[0008] Edge lines are extracted from each lane image to obtain extraction results, and lane lines are detected based on the extraction results to obtain initial detection results;
[0009] The initial detection results are used to filter targets, resulting in target detection results.
[0010] Lane line tracking was performed on each of the other images to obtain the tracking results;
[0011] Lane detection results are obtained based on target detection and tracking results.
[0012] In one embodiment, the extraction result corresponding to the lane line image is a binarized image containing multiple pixels, each pixel corresponding to one thread, and the initial detection result includes candidate lane lines; the step of performing lane line detection on the extracted lane edge lines to obtain the initial detection result includes:
[0013] Determine the target thread corresponding to the edge pixels that meet the edge pixel requirements; edge pixels are used to form edge lines;
[0014] By performing spatial coordinate system transformation on the coordinates of their respective edge pixels by each target thread, the sine curve equations corresponding to each edge pixel are obtained.
[0015] Solve the system of equations for every two sine curves simultaneously, and obtain the coordinates of their intersection points.
[0016] Intersection coordinates within a preset range are used as target intersection coordinates, and edge pixels corresponding to the sine curve equation at the target intersection coordinates are used as lane pixels; lane pixels are used to form candidate lane lines.
[0017] In one embodiment, the step of performing target screening on the initial detection results to obtain target detection results includes:
[0018] Combine the threads containing the lane pixels corresponding to each candidate lane line into a thread block, and pass the corresponding polar coordinates to the thread block;
[0019] By inputting multiple thread blocks containing the polar coordinates of lane pixels, the initial detection results are filtered in parallel, and the target detection results are obtained based on the results of the parallel filtering of multiple thread blocks.
[0020] In one embodiment, the initial detection results include candidate lane lines, and the step of filtering the initial detection results to obtain target detection results includes:
[0021] The first selection result is obtained by filtering the candidate lane lines by angle;
[0022] Based on the first filtering result, a second filtering result is obtained by length filtering.
[0023] Based on the second screening result, the line spacing is filtered to obtain the third screening result;
[0024] Vanishing point filtering is performed based on the third screening results to obtain the target detection results.
[0025] In one embodiment, the first screening result includes a left candidate lane line and a right candidate lane line; the step of performing angle screening on the candidate lane lines to obtain the first screening result includes:
[0026] Obtain the start and end coordinates of the candidate lane lines, and calculate the slope of the candidate lane lines based on the start and end coordinates;
[0027] The left and right candidate lane lines are determined from the candidate lane lines based on the slope.
[0028] In one embodiment, the left candidate lane line includes a left candidate inner lane line and a left candidate outer lane line, and the right candidate lane line includes a right candidate inner lane line and a right candidate outer lane line; the second screening result includes left candidate inner lane lines and left candidate outer lane lines that meet the length condition, and right candidate inner lane lines and right candidate outer lane lines that meet the length condition; the step of performing line spacing screening based on the second screening result to obtain the third screening result includes:
[0029] Perform inverse perspective transformation on the lane line image to obtain an inverse perspective image;
[0030] Calculate the first distance based on the positions of the left candidate inner lane line and the left candidate outer lane line that meet the length condition in the inverse perspective image;
[0031] If the first distance is within the preset lane line distance range, then the left candidate inner lane line and the left candidate outer lane line that meet the length condition are retained.
[0032] The second distance is calculated based on the positions of the right candidate inner lane line and the right candidate outer lane line that meet the length condition in the inverse perspective image.
[0033] If the second distance is within the preset lane line distance range, then the right candidate inner lane line and the right candidate outer lane line that meet the length condition are retained.
[0034] Based on the retained left and right candidate lane lines, the third screening result is obtained.
[0035] In one embodiment, if the lane edge line in the lane line image is a curve edge line; the step of obtaining the lane line detection result based on the target detection result and the tracking result includes:
[0036] Obtain feature points along the edge of the curve;
[0037] Determine the key points of the straight lane edge line corresponding to the edge line of the curve;
[0038] By fitting feature points and key points, the curve detection results are obtained;
[0039] Lane detection results are obtained based on target detection results, tracking results, and curve detection results.
[0040] Secondly, this application also provides a lane line detection device, which includes:
[0041] The acquisition module is used to acquire multiple initial images; the multiple initial images include lane line images and other images that do not contain lane lines.
[0042] The extraction module is used to extract the edge lines of each lane line image, obtain the extraction results, and perform lane line detection on the extraction results to obtain the initial detection results;
[0043] The filtering module is used to filter the initial detection results to obtain the target detection results;
[0044] The tracking module is used to track lane lines in each of the other images and obtain the tracking results.
[0045] The detection module is used to obtain lane line detection results based on target detection results and tracking results.
[0046] Thirdly, this application also provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method steps of any one of the first aspects.
[0047] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method steps of any one of the first aspects.
[0048] Fifthly, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the method steps of any one of the first aspects.
[0049] The aforementioned lane line detection method, apparatus, computer equipment, and storage medium acquire multiple initial images, extract edge lines from each lane line image to obtain extraction results, and then perform lane line detection on the extraction results to obtain initial detection results. Subsequently, multiple threads are used in parallel to filter targets from the initial detection results to obtain target detection results. Lane line tracking is then performed on other images to obtain tracking results. Based on the target detection results and tracking results, the lane line detection results are obtained. This allows for appropriate image processing for different images within the initial image set. The detected initial detection results are filtered to ensure the accuracy of the lane line detection results. Furthermore, lane lines can be accurately detected even in images that do not contain lane lines using the lane line tracking method. Attached Figure Description
[0050] Figure 1 This is an application environment diagram of the lane line detection method in one embodiment;
[0051] Figure 2 This is a flowchart illustrating a lane line detection method in one embodiment;
[0052] Figure 3This is a flowchart illustrating the steps for obtaining the initial detection result in one embodiment;
[0053] Figure 4 This is a flowchart illustrating a lane line detection method in one embodiment;
[0054] Figure 5 This is a flowchart illustrating the Hough transform algorithm in one embodiment;
[0055] Figure 6 This is a flowchart illustrating the parallel execution of the lane line filtering algorithm in one embodiment.
[0056] Figure 7 This is a structural block diagram of a lane line detection device in one embodiment;
[0057] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0059] The lane line detection method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, computer device 102 communicates with image acquisition device 104 via a network. Image acquisition device 104 pre-acquires road image videos to be detected, including multiple initial frames. Computer device 102 acquires these initial frames from image acquisition device 104, including lane line images and other images without lane lines. For lane line images, computer device 102 performs edge line extraction on each lane line image, obtaining extraction results, and then performs lane line detection on the extraction results to obtain initial detection results. Subsequently, target filtering is performed on the initial detection results to obtain target detection results. For other images without lane lines, computer device 102 performs lane line tracking on each other image, obtaining tracking results. Based on the target detection results and tracking results, the final lane line detection result is obtained. Computer device 102 can be a terminal or a server. The terminal can be, but is not limited to, an intelligent terminal such as an unmanned vehicle or robot deployed with an embedded artificial intelligence supercomputing platform (e.g., the Jeston TX2 development board). The server can be a standalone server or a server cluster composed of multiple servers. The image acquisition device 104 can be a vehicle-mounted camera.
[0060] In one embodiment, such as Figure 2As shown, a lane line detection method is provided, which is applied to... Figure 1 Taking computer device 102 as an example, the following steps are included:
[0061] S202: Acquire the acquired initial images of multiple frames; the initial images of multiple frames include lane line images and other images that do not contain lane lines.
[0062] In this context, the multiple initial images refer to each frame of a road image video. These road image videos can be captured by image acquisition devices such as vehicle-mounted cameras. For the acquired multiple initial images, image preprocessing is first performed. Specifically, the computer device performs grayscale processing on each initial image frame. After grayscale processing, each pixel has only one sampled color, typically displayed as a grayscale ranging from the darkest black to the brightest white. Then, the computer device performs noise removal on the grayscale image, eliminating unnecessary or redundant interference information. The resulting image has high accuracy, and the distribution of objects in the image can be represented by different grayscale levels, facilitating the selection of the main regions containing lane lines. The preprocessed images include lane line images and other images without lane lines. For each lane line image frame, the computer device selects the main region containing lane lines as the region of interest (ROI). This allows for lane line detection only on the ROI during subsequent detection. For other frames, lane line detection cannot be directly performed; therefore, the computer device performs lane line tracking based on the lane line features in the preceding lane line image to obtain the detection results in the other images.
[0063] S204: Extract edge lines from each lane line image to obtain extraction results, and then perform lane line detection on the extraction results to obtain initial detection results.
[0064] The computer equipment extracts edge lines from each lane image. The extracted result includes the edge lines of all objects in the lane image, such as tree edges, lane-side steps, and lane edges. These edge lines may contain curves. Since lane lines are straight lines, to detect them, only straight line detection is needed. This eliminates obvious interference lines in the lane image, yielding an initial detection result. Specifically, edge line extraction can be achieved using edge detection operators (such as the Canny operator). The Canny operator uses a template as a kernel to perform convolution with each pixel of the image, then selects an appropriate threshold to extract the image edges. The extracted results are then used for straight line detection using the Hough algorithm. The Hough algorithm works by calculating the local maximum value of the accumulated results in a parameter space, obtaining a set of shapes that conform to that specific shape as the Hough transform result. It can detect shapes such as circles, straight lines, and ellipses. For lane lines, the Hough algorithm requires straight line detection. The computer equipment uses the Hough algorithm to detect the straight lines in the extracted results, obtaining the initial detection result.
[0065] S206: Perform target screening on the initial detection results to obtain the target detection results.
[0066] The initial detection results include multiple candidate lane lines. Target filtering refers to angle filtering, length filtering, line spacing filtering, vanishing point filtering, etc. In the initial detection results obtained after lane line detection, there may still be some interference lines, such as the outline of road surface obstructions, the shadow of adjacent buildings, etc. The extracted edge lines are also straight lines, but they are not lane lines. Therefore, it is necessary to filter the initial detection results to obtain more accurate lane line results, i.e., target detection results.
[0067] Among these, angle filtering involves dividing candidate lane lines in the initial detection results into left and right lane lines. The left lane lines include the inner and outer left lane lines, and similarly, the right lane lines include the inner and outer right lane lines. Depending on the application requirements, only the left and / or right lane lines can be detected. Length filtering selects candidate lane lines with lengths within a certain range, thus eliminating excessively long or short interference lines. Line spacing filtering refers to the distance between the inner and outer lane lines on one side, which should be within a certain range, thus eliminating some interference lines where the distance between the inner and outer lines is too large and they are clearly not parallel. Vanishing point filtering refers to the fact that lane lines in the lane image intersect at infinity on the projection plane; this intersection point is the vanishing point. By calculating the vanishing points of candidate lane lines, interference lines that do not meet the lane line intersection characteristics are eliminated.
[0068] S208: Perform lane line tracking on each of the other images to obtain the tracking results.
[0069] In some images, lane lines are not included, so line detection cannot be performed directly on the region of interest in the images. Instead, lane line tracking is performed on the other images based on the lane lines in the lane line images. For example, the Kalman filter method is used. Kalman filter is an algorithm that uses the state equation of a linear system to make the optimal estimate of the system state through the system input and output observation data. Based on the target detection results, Kalman filter estimates the state of the dynamic lane line system from a series of image data from other images and tracks the lane lines.
[0070] S210: Obtain lane line detection results based on target detection and tracking results.
[0071] In this process, the computer equipment combines the target detection results and tracking results into the lane line detection result. If the lane line image contains lane lines that are curved, the computer equipment fits the key points of the straight lane lines obtained from the target detection and tracking results with the feature points of the curved section to obtain the target points of the curved lane line. These target points constitute the curved lane line. The computer equipment then combines the target detection results, tracking results, and curved lane lines to obtain the final lane line detection result.
[0072] In the above lane line detection method, multiple initial images are acquired, and edge lines are extracted from each lane line image to obtain extraction results. Lane line detection is then performed on the extraction results to obtain initial detection results. Subsequently, multiple threads are used in parallel to filter targets from the initial detection results to obtain target detection results. Lane line tracking is then performed on other images to obtain tracking results. Based on the target detection results and tracking results, the lane line detection results are obtained. This method can perform corresponding image processing on different images in the initial images. The detected initial detection results are filtered to ensure the accuracy of the lane line detection results. Furthermore, lane lines can be accurately detected in other images that do not contain lane lines by using the lane line tracking method.
[0073] In one embodiment, such as Figure 3 As shown, the extraction result corresponding to the lane line image is a binary image containing multiple pixels, with each pixel corresponding to one thread. The initial detection result includes candidate lane lines. The steps of performing lane line detection on the extracted lane edge lines to obtain the initial detection result include:
[0074] S302: Determine the target thread corresponding to the edge pixel that meets the edge pixel requirements; edge pixels are used to form edge lines.
[0075] The Canny operator extracts edge lines, resulting in a binary image where pixels have grayscale values of 0 or 255, exhibiting a clear black-and-white effect. A grayscale value of 255 represents the edge pixel in the extracted image. The computer allocates a thread to each pixel in the lane line image. Each thread determines if its corresponding pixel has a grayscale value of 255; if so, it is considered an edge pixel on the edge line. The computer then selects the pixels on the edge lines and their corresponding threads as the target threads.
[0076] S304: By performing spatial coordinate system transformation on the coordinates of their respective edge pixels by each target thread, the sine curve equations corresponding to each edge pixel are obtained.
[0077] In this process, the computer device performs a spatial coordinate system transformation on the coordinates of the corresponding edge pixels through the target thread, converting the coordinates in the Cartesian coordinate system to the coordinates in the polar coordinate system, thereby obtaining the sine curve equation corresponding to each edge pixel.
[0078] S306: Solve the system of equations for every two sine curves simultaneously and obtain the coordinates of their intersection points.
[0079] Since the straight-line feature is determined by the number of intersection points in the polar coordinate system, if two sine curve equations intersect in the polar coordinate system, it means that the edge pixels corresponding to these two sine curve equations lie on the same straight line in the rectangular coordinate system. The computer device solves the simultaneous equations of every two sine curve equations, ensuring that the two simultaneous equations are not repeated, and obtains the coordinates of the corresponding intersection points.
[0080] S308: Use the intersection coordinates within the preset range as the target intersection coordinates, and use the edge pixel corresponding to the sine curve equation where the target intersection coordinates are located as the lane pixel; the lane pixel is used to form the candidate lane line.
[0081] In the Cartesian coordinate system, pixels on the same straight line theoretically intersect at the same polar coordinate point. However, considering the impact of image capture and data processing, multiple intersection coordinates within a preset range are taken as target intersection coordinates. Multiple edge pixels are derived from the target intersection coordinates. These edge pixels are lane pixels, which together constitute candidate lane lines.
[0082] In this embodiment, by determining the target thread corresponding to the edge pixel that meets the edge pixel requirements, each target thread performs spatial coordinate system transformation on the coordinates of its corresponding edge pixel to obtain the sine curve equation corresponding to each edge pixel. Then, every two sine curve equations are solved simultaneously to obtain the corresponding intersection coordinates. The intersection coordinates within a preset range are taken as the target intersection coordinates, and the edge pixel corresponding to the sine curve equation at the target intersection coordinates is taken as the lane pixel. This can accurately obtain lane candidate lines, and by performing spatial coordinate system transformation in parallel by multiple threads, data processing efficiency can be improved.
[0083] In one embodiment, the step of performing target filtering on the initial detection results to obtain target detection results includes: combining the threads of the lane pixels corresponding to each candidate lane line into a thread block, and passing the corresponding polar coordinates to the thread block; performing target filtering on the initial detection results in parallel by passing multiple thread blocks with the polar coordinates of the lane pixels, and obtaining the target detection results based on the results of the parallel filtering of multiple thread blocks.
[0084] The initial detection results obtained after lane line detection may still contain some interference lines, such as the outlines of road obstructions and the shadows of adjacent buildings. The extracted edge lines are also straight lines, but they are not lane lines. Therefore, the initial detection results need to be filtered. The computer device combines multiple threads corresponding to the lane pixels of each candidate lane line into a thread block, and passes the polar coordinates of the corresponding lane pixels into this thread block. In this way, each candidate lane line corresponds to a thread block, and multiple thread blocks perform target filtering on their respective candidate lane lines in parallel to obtain the target detection results.
[0085] In CUDA, threads are the grid architecture of the Compute Unified Device Architecture (CUDA). CUDA leverages the processing power of the Graphics Processing Unit (GPU) to significantly improve computational performance. Therefore, when performing line detection based on the Hough algorithm, utilizing CUDA's grid architecture for parallel processing can improve processing efficiency. Specifically, CUDA's grid architecture consists of grids, thread blocks, and threads. It essentially divides the computing units on the GPU into several grids, each grid containing several thread blocks, and each thread block containing several threads. CUDA's parallel programs are executed using many threads. As mentioned above, spatial coordinate system transformations are performed using threads. Multiple threads are combined into a thread block, and threads within the same thread block can synchronize. Multiple thread blocks then form a grid.
[0086] In this embodiment, by combining the threads containing the lane pixels corresponding to each candidate lane line into a thread block and passing the corresponding polar coordinates to the thread block, multiple thread blocks with the polar coordinates of the lane pixels are passed in to perform target filtering on the initial detection results in parallel. The target detection results are obtained based on the results of the parallel filtering of multiple thread blocks, which can improve the target filtering efficiency and thus improve the efficiency of lane line detection.
[0087] In one embodiment, the initial detection result includes candidate lane lines. The step of filtering the initial detection result to obtain the target detection result includes: filtering the candidate lane lines by angle to obtain a first filtering result; filtering by length based on the first filtering result to obtain a second filtering result; filtering by line spacing based on the second filtering result to obtain a third filtering result; and filtering by vanishing point based on the third filtering result to obtain the target detection result.
[0088] The first filtering result includes left and right lane lines. The computer device filters the candidate lane lines by angle, dividing them into left and right lane lines. For each lane line, the computer device filters by length, resulting in the second filtering result. The second filtering result includes inner and outer lane lines. The computer device filters by line spacing based on the distance between the inner and outer lane lines, resulting in the third filtering result. The third filtering result includes multiple inner and outer lane line groups, each consisting of one inner and one outer lane line. For each inner and outer lane line group, the computer device filters by vanishing point, resulting in the target detection result.
[0089] In this embodiment, the first screening result is obtained by filtering the candidate lane lines by angle, and the second screening result is obtained by filtering by length based on the first screening result. Then, the third screening result is obtained by filtering by line spacing based on the second screening result, and the target detection result is obtained by filtering by vanishing point based on the third screening result. The target detection result can be obtained accurately.
[0090] In one embodiment, the first screening result includes a left candidate lane line and a right candidate lane line; the step of performing angle screening on the candidate lane lines to obtain the first screening result includes: obtaining the start and end point coordinates of the candidate lane lines, and calculating the slope of the candidate lane lines based on the start and end point coordinates; and determining the left candidate lane line and the right candidate lane line from the candidate lane lines based on the slope.
[0091] Specifically, for each candidate lane line (left or right), the computer acquires the coordinates of its start and end points to calculate the slope and equation of each line. Due to the perspective effect of the camera, the left and right lane lines are not parallel on the road surface; the slope of the left lane line is negative, and the slope of the right lane line is positive. Based on the different slopes, the computer categorizes the candidate lane lines into left and right candidate lane lines.
[0092] In this embodiment, by obtaining the start and end coordinates of the candidate lane lines and calculating the slope of the candidate lane lines based on the start and end coordinates, the left and right candidate lane lines are determined from the candidate lane lines based on the slope, which can initially filter out some interfering lines.
[0093] In one embodiment, the left candidate lane lines include the left candidate inner lane line and the left candidate outer lane line, and the right candidate lane lines include the right candidate inner lane line and the right candidate outer lane line; the second filtering result includes the left candidate inner lane line and the left candidate outer lane line that meet the length condition, and the right candidate inner lane line and the right candidate outer lane line that meet the length condition; the step of performing line distance filtering based on the second filtering result to obtain the third filtering result includes: performing inverse perspective transformation on the lane line image to obtain an inverse perspective image; calculating a first distance based on the position of the left candidate inner lane line and the left candidate outer lane line that meet the length condition in the inverse perspective image; if the first distance is within a preset lane line distance range, then retaining the left candidate inner lane line and the left candidate outer lane line that meet the length condition; calculating a second distance based on the position of the right candidate inner lane line and the right candidate outer lane line that meet the length condition in the inverse perspective image; if the second distance is within a preset lane line distance range, then retaining the right candidate inner lane line and the right candidate outer lane line that meet the length condition; and obtaining the third filtering result based on the retained left candidate lane lines and right candidate lane lines.
[0094] Inverse perspective transformation refers to the reverse process of perspective transformation. It mainly involves combining the camera's intrinsic and extrinsic parameters to map the image from the image coordinate system to the world coordinate system. The world coordinate system consists of three mutually perpendicular and intersecting coordinate axes: X, Y, and Z. Typically, the positive X-axis points horizontally to the right of the screen, the positive Y-axis points vertically upwards, and the positive Z-axis points perpendicular to the screen plane towards the user. Computer equipment performs inverse perspective transformation on lane line images, mapping them to the world coordinate system to obtain an inverse perspective image. This eliminates the influence of the camera's perspective on the lane lines, making a set of inner and outer lane lines parallel lines in the inverse perspective image.
[0095] For the left candidate lane lines, meeting the length condition means that the lengths of the left candidate inner and outer lane lines, whether continuous or discontinuous, fall within a certain range after length filtering. By setting a length threshold, excessively long or short interference lines can be eliminated. The computer device calculates the distance between the left candidate inner and outer lane lines in the inverse perspective image, obtaining a first distance. For parallel lane lines, the distance between the inner and outer lane lines is within a certain range. If the first distance is within a preset lane line distance range, the computer device retains the left candidate inner and outer lane lines that meet the length condition. For the right candidate lane lines, the filtering steps are the same as for the left candidate lane lines. The computer device calculates a second distance based on the positions of the right candidate inner and outer lane lines that meet the length condition in the inverse perspective image. If the second distance is within a preset lane line distance range, the computer device retains the right candidate inner and outer lane lines that meet the length condition, obtaining a third filtering result.
[0096] In this embodiment, by performing inverse perspective transformation on the lane line image, an inverse perspective image is obtained. For the left candidate lane line / right lane line, the distance between the lane lines is calculated based on the positions of the candidate inner lane line and candidate outer lane line that meet the length condition in the inverse perspective image. If they are within the preset lane line distance range, the candidate inner lane line and candidate outer lane line that meet the length condition are retained, and a third filtering result is obtained. This can eliminate some interference lines based on the distance between two parallel lane lines.
[0097] In one embodiment, if the lane edge line in the lane line image is a curve edge line, the step of obtaining the lane line detection result based on the target detection result and the tracking result includes: acquiring feature points in the curve edge line; determining key points of the straight lane edge line corresponding to the curve edge line; fitting the feature points and key points to obtain the curve detection result; and obtaining the lane line detection result based on the target detection result, the tracking result, and the curve detection result.
[0098] If the lane edge line in the lane line image is a curve edge, the computer device acquires the feature points in the curve edge line and the key points of the straight lane edge line related to the curve edge line. The feature points and key points are fitted based on the least squares method to obtain the curve detection result. The final lane line detection result is obtained based on the target detection result, tracking result and curve detection result.
[0099] In this embodiment, if the lane edge line in the lane line image is a curve edge line, the feature points in the curve edge line and the key points of the corresponding straight lane edge line are fitted to obtain the curve detection result. Based on the target detection result, tracking result and curve detection result, the lane line detection result is obtained, which can ensure the accuracy of the lane line detection result.
[0100] In one embodiment, such as Figure 4 As shown, a lane detection method accelerated by CUDA is provided, which includes the following steps:
[0101] (1) The computer equipment acquires multiple initial images captured by the vehicle-mounted camera and preprocesses the initial images to eliminate noise information in the images.
[0102] (2) The computer equipment extracts edge lines using the Canny operator and employs the Hough line detection method to detect candidate lines within the region of interest, obtaining initial detection results. The flowchart of the Hough line detection method is shown below. Figure 5 As shown, the computer device divides each pixel in the lane line image into a thread. Based on each thread, edge points are determined for their respective pixels. For the coordinates of pixels identified as edge pixels, the computer device performs a spatial coordinate system transformation to obtain the sine curve equation corresponding to each edge pixel. Then, the computer device solves the sine curve equations pairwise to calculate the coordinates of the intersection points and saves the intersection point coordinates. In this way, the computer device can determine whether the corresponding edge pixels are pixels on a straight line based on the number of intersection point coordinates, thus completing the line detection.
[0103] (3) The computer device combines the threads corresponding to the edge pixels of each candidate lane line into a thread block, and inputs the intersection coordinates of the corresponding edge pixels into the thread block. The computer device first performs angle filtering on the candidate lane lines in the initial detection result through the thread block. The candidate lane lines with negative angles are left candidate lane lines, and the candidate lane lines with positive angles are right candidate lane lines. The left candidate lane lines and the right candidate lane lines are distinguished by angle, and the first filtering result is obtained. The computer device performs length filtering on the lane lines on one side, and obtains the left candidate inner lane line and the left candidate outer lane line that meet the length conditions, as well as the right candidate inner lane line and the right candidate outer lane line that meet the length conditions, and obtains the second filtering result. The computer device calculates the second distance based on the position of the right candidate inner lane line and the right candidate outer lane line that meet the length conditions in the inverse perspective image. If the second distance is within the preset lane line distance range, the right candidate inner lane line and the right candidate outer lane line that meet the length conditions are retained, and the third filtering result is obtained. The computer device filters the third filtering result through vanishing point detection to eliminate redundant interference lines and obtain the target detection result.
[0104] The flowchart of the parallel execution of lane line filtering by thread blocks during the filtering process is as follows: Figure 6 As shown, the computer device inputs a set of intersection coordinates for each thread block, such as (ρ0,θ0), (ρ1,θ1), (ρ2,θ2)...(ρ n ,θ n Multiple thread blocks can filter candidate lane lines in parallel.
[0105] (4) For other images that do not contain lane lines, the computer device performs lane line tracking on each other image to obtain the lane line tracking result. If the lane edge line in the lane line image is a curve edge, the computer device obtains the feature points in the curve edge line and the key points of the straight lane edge line related to the curve edge line. The feature points and key points are fitted based on the least squares method to obtain the curve detection result. The final lane line detection result is obtained based on the target detection result, the tracking result and the curve detection result.
[0106] In this embodiment, the CUDA-based mesh structure utilizes multi-threaded parallel execution of the Hough transform algorithm and filters the initial results, which can ensure the accuracy of lane line detection results and improve lane line detection efficiency.
[0107] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0108] Based on the same inventive concept, this application also provides a lane line detection device for implementing the lane line detection method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations of one or more lane line detection device embodiments provided below can be found in the limitations of the lane line detection method described above, and will not be repeated here.
[0109] In one embodiment, such as Figure 7As shown, a lane line detection device is provided, including: an acquisition module 10, an extraction module 20, a filtering module 30, a tracking module 40, and a detection module 50, wherein:
[0110] The acquisition module 10 is used to acquire multiple initial images; the multiple initial images include lane line images and other images without lane lines.
[0111] The extraction module 20 is used to extract the edge lines of each lane line image, obtain the extraction results, and perform lane line detection on the extraction results to obtain the initial detection results.
[0112] The filtering module 30 is used to filter the initial detection results to obtain the target detection results.
[0113] The tracking module 40 is used to track lane lines in each of the other images to obtain tracking results.
[0114] The detection module 50 is used to obtain lane line detection results based on the target detection results and tracking results.
[0115] In one embodiment, the extraction result corresponding to the lane line image is a binary image containing multiple pixels, each pixel corresponding to a thread, and the initial detection result includes candidate lane lines; the extraction module 20 includes: a thread determination unit, a coordinate system transformation unit, a simultaneous solution unit, and a candidate determination unit, wherein:
[0116] The thread determination unit is used to determine the target thread corresponding to the edge pixel that meets the edge pixel requirements; the edge pixels are used to form the edge line.
[0117] The coordinate system transformation unit is used to perform spatial coordinate system transformation on the coordinates of the corresponding edge pixels by each target thread, so as to obtain the sine curve equation corresponding to each edge pixel.
[0118] The simultaneous solution unit is used to solve every two sine curve equations simultaneously and obtain the coordinates of the corresponding intersection points.
[0119] The candidate determination unit is used to take the intersection coordinates within a preset range as the target intersection coordinates, and the edge pixel corresponding to the sine curve equation where the target intersection coordinates are located as the lane pixel; the lane pixel is used to form the candidate lane line.
[0120] In one embodiment, the filtering module 30 includes: a coordinate input unit and a parallel filtering unit, wherein:
[0121] The coordinate input unit combines the threads of the lane pixels corresponding to each candidate lane line into a thread block, and inputs the corresponding polar coordinates into the thread block.
[0122] The parallel filtering unit is used to filter targets in parallel from the initial detection results by passing in multiple thread blocks containing the polar coordinates of lane pixels, and obtain the target detection result based on the results of the parallel filtering of multiple thread blocks.
[0123] In one embodiment, the initial detection result includes candidate lane lines, and the filtering module 30 is further used to perform angle filtering on the candidate lane lines to obtain a first filtering result; perform length filtering based on the first filtering result to obtain a second filtering result; perform line spacing filtering based on the second filtering result to obtain a third filtering result; and perform vanishing point filtering based on the third filtering result to obtain a target detection result.
[0124] In one embodiment, the first filtering result includes a left candidate lane line and a right candidate lane line. The filtering module 30 is further used to obtain the start and end coordinates of the candidate lane lines and calculate the slope of the candidate lane lines based on the start and end coordinates; and determine the left candidate lane line and the right candidate lane line from the candidate lane lines based on the slope.
[0125] In one embodiment, the left candidate lane lines include the left candidate inner lane line and the left candidate outer lane line, and the right candidate lane lines include the right candidate inner lane line and the right candidate outer lane line; the second filtering result includes the left candidate inner lane line and the left candidate outer lane line that meet the length condition, and the right candidate inner lane line and the right candidate outer lane line that meet the length condition; the filtering module 30 is further configured to perform inverse perspective transformation on the lane line image to obtain an inverse perspective image; calculate a first distance based on the position of the left candidate inner lane line and the left candidate outer lane line that meet the length condition in the inverse perspective image; if the first distance is within a preset lane line distance range, then retain the left candidate inner lane line and the left candidate outer lane line that meet the length condition; calculate a second distance based on the position of the right candidate inner lane line and the right candidate outer lane line that meet the length condition in the inverse perspective image; if the second distance is within a preset lane line distance range, then retain the right candidate inner lane line and the right candidate outer lane line that meet the length condition; based on the retained left candidate lane lines and right candidate lane lines, obtain a third filtering result.
[0126] In one embodiment, if the lane edge line in the lane line image is a curve edge line, the detection module 50 includes: a feature point acquisition unit, a key point determination unit, a feature fitting unit, and a result acquisition unit.
[0127] in:
[0128] The feature point acquisition unit is used to acquire feature points in the edge line of the curve.
[0129] The key point determination unit is used to determine the key points of the straight lane edge line corresponding to the edge line of the curve.
[0130] The feature fitting unit is used to fit feature points and key points to obtain curve detection results.
[0131] The result acquisition unit is used to obtain lane line detection results based on target detection results, tracking results, and curve detection results.
[0132] Each module in the aforementioned lane line detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0133] In one embodiment, a computer device is provided, which may be a terminal or a server. Taking a terminal as an example, its internal structure diagram can be as follows: Figure 8 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a lane detection method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0134] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0135] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: acquiring multiple initial frames of images; the multiple initial frames include lane line images and other images without lane lines; extracting edge lines from each lane line image to obtain extraction results, and performing lane line detection on the extraction results to obtain initial detection results; filtering targets on the initial detection results to obtain target detection results; tracking lane lines in each of the other images to obtain tracking results; and obtaining lane line detection results based on the target detection results and the tracking results.
[0136] In one embodiment, the extraction result corresponding to the lane line image is a binary image containing multiple pixels, each pixel corresponding to a thread, and the initial detection result includes candidate lane lines. When the processor executes the computer program, it performs lane line detection on the extracted lane edge lines to obtain the initial detection result, including: determining the target thread corresponding to the edge pixel that meets the edge pixel requirements; the edge pixels are used to form the edge line; each target thread performs a spatial coordinate system transformation on the coordinates of its corresponding edge pixel to obtain the sine curve equation corresponding to each edge pixel; solving the simultaneous equations of every two sine curves to obtain the corresponding intersection coordinates; taking the intersection coordinates within a preset range as the target intersection coordinates, and taking the edge pixel corresponding to the sine curve equation where the target intersection coordinates are located as the lane pixel; the lane pixels are used to form candidate lane lines.
[0137] In one embodiment, the process of the processor executing a computer program to filter the initial detection results and obtain the target detection results includes: combining the threads containing the lane pixels corresponding to each candidate lane line into a thread block, and passing the corresponding polar coordinates to the thread block; filtering the initial detection results in parallel by passing multiple thread blocks containing the polar coordinates of the lane pixels, and obtaining the target detection results based on the results of the parallel filtering by multiple thread blocks.
[0138] In one embodiment, the initial detection result includes candidate lane lines. When the processor executes the computer program, it performs target filtering on the initial detection result to obtain target detection result, which includes: performing angle filtering on the candidate lane lines to obtain a first filtering result; performing length filtering based on the first filtering result to obtain a second filtering result; performing line spacing filtering based on the second filtering result to obtain a third filtering result; and performing vanishing point filtering based on the third filtering result to obtain the target detection result.
[0139] In one embodiment, the first filtering result includes a left candidate lane line and a right candidate lane line; the first filtering result obtained by the processor executing the computer program by performing angle filtering on the candidate lane lines includes: obtaining the start and end coordinates of the candidate lane lines and calculating the slope of the candidate lane lines based on the start and end coordinates; and determining the left candidate lane line and the right candidate lane line from the candidate lane lines based on the slope.
[0140] In one embodiment, the left candidate lane lines include the left candidate inner lane line and the left candidate outer lane line, and the right candidate lane lines include the right candidate inner lane line and the right candidate outer lane line; the second filtering result includes the left candidate inner lane line and the left candidate outer lane line that meet the length condition, and the right candidate inner lane line and the right candidate outer lane line that meet the length condition; the process of the processor executing the computer program to perform line spacing filtering based on the second filtering result to obtain the third filtering result includes: performing an inverse perspective transformation on the lane line image to obtain an inverse perspective image; calculating a first distance based on the position of the left candidate inner lane line and the left candidate outer lane line that meet the length condition in the inverse perspective image; if the first distance is within a preset lane line distance range, then retaining the left candidate inner lane line and the left candidate outer lane line that meet the length condition; calculating a second distance based on the position of the right candidate inner lane line and the right candidate outer lane line that meet the length condition in the inverse perspective image; if the second distance is within a preset lane line distance range, then retaining the right candidate inner lane line and the right candidate outer lane line that meet the length condition; and obtaining the third filtering result based on the retained left candidate lane line and right candidate lane line.
[0141] In one embodiment, if the lane edge line in the lane line image is a curve edge line, the process of obtaining lane line detection results based on target detection results and tracking results when the processor executes the computer program includes: acquiring feature points in the curve edge line; determining key points of the straight lane edge line corresponding to the curve edge line; fitting the feature points and key points to obtain the curve detection result; and obtaining the lane line detection result based on the target detection result, tracking result, and curve detection result.
[0142] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon. When executed by a processor, the computer program performs the following steps: acquiring multiple initial frames of images; the multiple initial frames include lane line images and other images without lane lines; extracting edge lines from each lane line image to obtain extraction results, and performing lane line detection on the extraction results to obtain initial detection results; filtering targets from the initial detection results to obtain target detection results; tracking lane lines in each of the other images to obtain tracking results; and obtaining lane line detection results based on the target detection results and the tracking results.
[0143] In one embodiment, the extraction result corresponding to the lane line image is a binary image containing multiple pixels, each pixel corresponding to a thread, and the initial detection result includes candidate lane lines. When the computer program is executed by the processor, it involves performing lane line detection on the extracted lane edge lines to obtain the initial detection result, including: determining the target thread corresponding to the edge pixel that meets the edge pixel requirements; the edge pixels are used to form the edge line; each target thread performs a spatial coordinate system transformation on the coordinates of its corresponding edge pixel to obtain the sine curve equation corresponding to each edge pixel; solving the simultaneous equations of every two sine curves to obtain the corresponding intersection coordinates; taking the intersection coordinates within a preset range as the target intersection coordinates, and taking the edge pixel corresponding to the sine curve equation where the target intersection coordinates are located as the lane pixel; the lane pixels are used to form candidate lane lines.
[0144] In one embodiment, when the computer program is executed by the processor, the target filtering of the initial detection results to obtain the target detection results includes: combining the threads of the lane pixels corresponding to each candidate lane line into a thread block, and passing the corresponding polar coordinates to the thread block; performing target filtering on the initial detection results in parallel by passing multiple thread blocks with the polar coordinates of the lane pixels, and obtaining the target detection results based on the results of the parallel filtering of multiple thread blocks.
[0145] In one embodiment, the initial detection results include candidate lane lines. When the computer program is executed by the processor, it involves target filtering of the initial detection results to obtain target detection results, including: filtering the candidate lane lines by angle to obtain a first filtering result; filtering by length based on the first filtering result to obtain a second filtering result; filtering by line spacing based on the second filtering result to obtain a third filtering result; and filtering by vanishing point based on the third filtering result to obtain the target detection result.
[0146] In one embodiment, the first filtering result includes a left candidate lane line and a right candidate lane line; when the computer program is executed by the processor, the angle filtering of the candidate lane lines to obtain the first filtering result includes: obtaining the start and end coordinates of the candidate lane lines and calculating the slope of the candidate lane lines based on the start and end coordinates; and determining the left candidate lane line and the right candidate lane line from the candidate lane lines based on the slope.
[0147] In one embodiment, the left candidate lane lines include the left candidate inner lane line and the left candidate outer lane line, and the right candidate lane lines include the right candidate inner lane line and the right candidate outer lane line; the second filtering result includes the left candidate inner lane line and the left candidate outer lane line that meet the length condition, and the right candidate inner lane line and the right candidate outer lane line that meet the length condition; when the computer program is executed by the processor, the line spacing filtering based on the second filtering result to obtain the third filtering result includes: performing an inverse perspective transformation on the lane line image to obtain an inverse perspective image; calculating a first distance based on the position of the left candidate inner lane line and the left candidate outer lane line that meet the length condition in the inverse perspective image; if the first distance is within a preset lane line distance range, then retaining the left candidate inner lane line and the left candidate outer lane line that meet the length condition; calculating a second distance based on the position of the right candidate inner lane line and the right candidate outer lane line that meet the length condition in the inverse perspective image; if the second distance is within a preset lane line distance range, then retaining the right candidate inner lane line and the right candidate outer lane line that meet the length condition; and obtaining the third filtering result based on the retained left candidate lane line and right candidate lane line.
[0148] In one embodiment, if the lane edge line in the lane line image is a curve edge line, the process of obtaining lane line detection results based on target detection results and tracking results when the computer program is executed by the processor includes: acquiring feature points in the curve edge line; determining key points of the straight lane edge line corresponding to the curve edge line; fitting the feature points and key points to obtain the curve detection result; and obtaining the lane line detection result based on the target detection result, tracking result, and curve detection result.
[0149] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps: acquiring multiple initial frames of images; the multiple initial frames of images include lane line images and other images without lane lines; extracting edge lines from each lane line image to obtain extraction results, and performing lane line detection on the extraction results to obtain initial detection results; filtering targets on the initial detection results to obtain target detection results; tracking lane lines in each of the other images to obtain tracking results; and obtaining lane line detection results based on the target detection results and the tracking results.
[0150] In one embodiment, the extraction result corresponding to the lane line image is a binary image containing multiple pixels, each pixel corresponding to a thread, and the initial detection result includes candidate lane lines. When the computer program is executed by the processor, it involves performing lane line detection on the extracted lane edge lines to obtain the initial detection result, including: determining the target thread corresponding to the edge pixel that meets the edge pixel requirements; the edge pixels are used to form the edge line; each target thread performs a spatial coordinate system transformation on the coordinates of its corresponding edge pixel to obtain the sine curve equation corresponding to each edge pixel; solving the simultaneous equations of every two sine curves to obtain the corresponding intersection coordinates; taking the intersection coordinates within a preset range as the target intersection coordinates, and taking the edge pixel corresponding to the sine curve equation where the target intersection coordinates are located as the lane pixel; the lane pixels are used to form candidate lane lines.
[0151] In one embodiment, when the computer program is executed by the processor, the target filtering of the initial detection results to obtain the target detection results includes: combining the threads of the lane pixels corresponding to each candidate lane line into a thread block, and passing the corresponding polar coordinates to the thread block; performing target filtering on the initial detection results in parallel by passing multiple thread blocks with the polar coordinates of the lane pixels, and obtaining the target detection results based on the results of the parallel filtering of multiple thread blocks.
[0152] In one embodiment, the initial detection results include candidate lane lines. When the computer program is executed by the processor, it involves target filtering of the initial detection results to obtain target detection results, including: filtering the candidate lane lines by angle to obtain a first filtering result; filtering by length based on the first filtering result to obtain a second filtering result; filtering by line spacing based on the second filtering result to obtain a third filtering result; and filtering by vanishing point based on the third filtering result to obtain the target detection result.
[0153] In one embodiment, the first filtering result includes a left candidate lane line and a right candidate lane line; when the computer program is executed by the processor, the angle filtering of the candidate lane lines to obtain the first filtering result includes: obtaining the start and end coordinates of the candidate lane lines and calculating the slope of the candidate lane lines based on the start and end coordinates; and determining the left candidate lane line and the right candidate lane line from the candidate lane lines based on the slope.
[0154] In one embodiment, the left candidate lane lines include the left candidate inner lane line and the left candidate outer lane line, and the right candidate lane lines include the right candidate inner lane line and the right candidate outer lane line; the second filtering result includes the left candidate inner lane line and the left candidate outer lane line that meet the length condition, and the right candidate inner lane line and the right candidate outer lane line that meet the length condition; when the computer program is executed by the processor, the line spacing filtering based on the second filtering result to obtain the third filtering result includes: performing an inverse perspective transformation on the lane line image to obtain an inverse perspective image; calculating a first distance based on the position of the left candidate inner lane line and the left candidate outer lane line that meet the length condition in the inverse perspective image; if the first distance is within a preset lane line distance range, then retaining the left candidate inner lane line and the left candidate outer lane line that meet the length condition; calculating a second distance based on the position of the right candidate inner lane line and the right candidate outer lane line that meet the length condition in the inverse perspective image; if the second distance is within a preset lane line distance range, then retaining the right candidate inner lane line and the right candidate outer lane line that meet the length condition; and obtaining the third filtering result based on the retained left candidate lane line and right candidate lane line.
[0155] In one embodiment, if the lane edge line in the lane line image is a curve edge line, the process of obtaining lane line detection results based on target detection results and tracking results when the computer program is executed by the processor includes: acquiring feature points in the curve edge line; determining key points of the straight lane edge line corresponding to the curve edge line; fitting the feature points and key points to obtain the curve detection result; and obtaining the lane line detection result based on the target detection result, tracking result, and curve detection result.
[0156] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0157] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0158] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A lane line detection method, characterized in that, The method includes: Acquire multiple initial images; the multiple initial images include lane line images and other images that do not contain lane lines; Edge lines are extracted from each lane line image to obtain extraction results, and lane line detection is performed on the extraction results to obtain initial detection results. The extraction result corresponding to the lane line image is a binary image containing multiple pixels, with each pixel corresponding to a thread. The initial detection result includes candidate lane lines. The process of performing lane line detection on the extraction results to obtain the initial detection results specifically includes: determining the target thread corresponding to the edge pixels that meet the edge pixel requirements; the edge pixels are used to form edge lines; each target thread performs a spatial coordinate system transformation on the coordinates of its corresponding edge pixels to obtain the sine curve equation corresponding to each edge pixel; solving the simultaneous equations of every two sine curves to obtain the corresponding intersection coordinates; the intersection coordinates within a preset range are taken as target intersection coordinates, and the edge pixels corresponding to the sine curve equation at the target intersection coordinates are taken as lane pixels; the lane pixels are used to form candidate lane lines. The initial detection results are subjected to target filtering to obtain target detection results. Target filtering includes angle filtering, length filtering, line spacing filtering, and vanishing point filtering. Angle filtering divides candidate lane lines in the initial detection results into left and right lane lines. Length filtering filters candidate lane lines whose length falls within a certain range. Line spacing filtering filters candidate lane lines whose distance between the inner and outer lane lines falls within a certain range. Vanishing point filtering filters candidate lane lines that intersect on the projection plane. Specifically, the target filtering of the initial detection results to obtain target detection results includes: combining the threads containing the lane pixels corresponding to each candidate lane line into a thread block, and passing the corresponding polar coordinates to the thread block; performing target filtering on the initial detection results in parallel using multiple thread blocks with the polar coordinates of the lane pixels, and obtaining the target detection results based on the results of the parallel filtering by multiple thread blocks. Lane line tracking is performed on each of the other images to obtain tracking results; The lane line detection result is obtained based on the target detection result and the tracking result.
2. The method according to claim 1, characterized in that, The initial detection results include candidate lane lines. The process of filtering the initial detection results to obtain target detection results includes: The candidate lane lines are filtered by angle to obtain the first filtering result; Based on the first filtering result, a second filtering result is obtained by length filtering. Based on the second filtering result, line spacing is filtered to obtain the third filtering result; Based on the third screening result, vanishing point screening is performed to obtain the target detection result.
3. The method according to claim 2, wherein the first screening result includes left candidate lane lines and right candidate lane lines; the step of performing angle screening on the candidate lane lines to obtain the first screening result includes: Obtain the start and end coordinates of the candidate lane line, and calculate the slope of the candidate lane line based on the start and end coordinates; The left and right candidate lane lines are determined from the candidate lane lines based on the slope.
4. The method according to claim 3, wherein the left candidate lane line includes a left candidate inner lane line and a left candidate outer lane line, and the right candidate lane line includes a right candidate inner lane line and a right candidate outer lane line; The second screening results include left candidate inner lane lines and left candidate outer lane lines that meet the length condition, and right candidate inner lane lines and right candidate outer lane lines that meet the length condition. The process of filtering by line spacing based on the second filtering result to obtain the third filtering result includes: Perform inverse perspective transformation on the lane line image to obtain an inverse perspective image; The first distance is calculated based on the positions of the left candidate inner lane line and the left candidate outer lane line that meet the length condition in the reverse perspective image; If the first distance is within the preset lane line distance range, then the left candidate inner lane line and the left candidate outer lane line that meet the length condition are retained; The second distance is calculated based on the positions of the right candidate inner lane line and the right candidate outer lane line that meet the length condition in the inverse perspective image; If the second distance is within the preset lane line distance range, then the right candidate inner lane line and the right candidate outer lane line that meet the length condition are retained; Based on the retained left and right candidate lane lines, the third screening result is obtained.
5. The method according to claim 1, characterized in that, If the lane edge line in the lane line image is a curve edge line; The process of obtaining lane line detection results based on the target detection results and the tracking results includes: Obtain the feature points in the edge line of the curve; Determine the key points of the straight lane edge line corresponding to the edge line of the curve; The feature points and key points are fitted to obtain the curve detection results; The lane line detection result is obtained based on the target detection result, the tracking result, and the curve detection result.
6. A lane line detection device, characterized in that, The device includes: The acquisition module is used to acquire multiple initial images; the multiple initial images include lane line images and other images that do not contain lane lines. An extraction module is used to extract edge lines from each of the lane line images to obtain extraction results, and to perform lane line detection on the extraction results to obtain initial detection results. The extraction result corresponding to the lane line image is a binary image containing multiple pixels, with each pixel corresponding to a thread. The initial detection result includes candidate lane lines. The process of performing lane line detection on the extraction result to obtain the initial detection result specifically includes: determining the target thread corresponding to the edge pixels that meet the edge pixel requirements; the edge pixels are used to form edge lines; transforming the coordinates of their respective edge pixels using spatial coordinate systems through each target thread to obtain the sine curve equations corresponding to each edge pixel; solving the simultaneous equations of every two sine curves to obtain the corresponding intersection coordinates; using the intersection coordinates within a preset range as the target intersection coordinates, and using the edge pixels corresponding to the sine curve equations at the target intersection coordinates as lane pixels; the lane pixels are used to form candidate lane lines. A filtering module is used to perform target filtering on the initial detection results to obtain target detection results. The target filtering includes angle filtering, length filtering, line spacing filtering, and vanishing point filtering. The angle filtering is used to divide the candidate lane lines in the initial detection results into left lane lines and right lane lines. The length filtering is used to filter out candidate lane lines whose length is within a certain range. The line spacing filtering is used to filter out candidate lane lines whose distance between the inner lane line and the outer lane line is within a certain range. The vanishing point filtering is used to filter out candidate lane lines that have an intersection point on the projection plane. The process of performing target filtering on the initial detection results to obtain target detection results specifically includes: combining the threads containing the lane pixels corresponding to each candidate lane line into a thread block, and passing the corresponding polar coordinates to the thread block; performing target filtering on the initial detection results in parallel by passing multiple thread blocks with the polar coordinates of the lane pixels, and obtaining the target detection results based on the results of the parallel filtering of multiple thread blocks. The tracking module is used to perform lane line tracking on each of the other images to obtain tracking results; The detection module is used to obtain lane line detection results based on the target detection results and the tracking results.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.