Road detection method, device and equipment, medium and vehicle

By using edge gradient operators and multi-channel image processing, the problems of insufficient computational resource dependence and adaptability to complex road conditions in existing road detection methods are solved, achieving high-precision and robust road detection that can adapt to diverse road morphologies.

CN121281027APending Publication Date: 2026-01-06ZHEJIANG LINGAI FUTURE TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511446737.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-10
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

While maintaining high accuracy and robustness, existing road detection methods struggle to reduce their reliance on computing resources and improve their adaptability to curves and complex road conditions.

Method used

The target image is gradient extracted using a preset edge gradient operator. The gradient direction of the edge gradient operator corresponds to the extension direction of the road line in the target image. The gradient features of the left and right edges of the road line are extracted by the first and second operators respectively. Combined with multi-channel image processing, the gradient response of the road edge is enhanced and noise and irrelevant textures are suppressed.

Benefits of technology

It improves the accuracy and robustness of road detection, reduces the dependence on computing resources, adapts to various complex road conditions and unstructured road scenarios, and significantly enhances the system's adaptability to diverse road forms such as curves and widening lanes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121281027A_ABST
    Figure CN121281027A_ABST
Patent Text Reader

Abstract

The invention discloses a road detection method, device and equipment, a medium and a vehicle, and the method comprises the steps: obtaining a target image; performing gradient extraction on the target image by using a preset edge gradient operator to obtain a gradient image; determining a detection result of the road line based on the gradient image; wherein the gradient direction of the edge gradient operator corresponds to the extension direction of the road line in the target image. On the basis of keeping high precision and high robustness of road detection, dependence on a large-scale neural network model and a complex feature extraction algorithm can be avoided, and dependence on computing resources is reduced; and the system can adapt to various complex road conditions and unstructured road scenes, and the adaptability of the system to various road forms such as curves and widened lanes is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to a road detection method, apparatus, equipment, medium, and vehicle. Background Technology

[0002] In autonomous driving systems, road detection refers to the process of using onboard image perception modules to collect and analyze the environment ahead to obtain key information such as road boundaries, lane lines, and driving areas. Accurate and real-time road detection results are fundamental to vehicle path planning, control decisions, and obstacle avoidance, and are of great significance for improving the reliability and driving safety of autonomous driving systems.

[0003] Currently, road detection methods can be divided into two categories: traditional image processing methods and deep model-based methods. Traditional image processing methods typically use edge operators such as Sobel and Canny to extract edges from RGB images, then use Hough line transform to remove non-road straight line interference, and finally reconstruct the road geometry using polynomial curve fitting or spline curve fitting. These methods are simple in algorithm and have low computational cost, enabling real-time operation on resource-constrained embedded platforms. Deep model-based methods, on the other hand, rely on the design and training of convolutional neural networks or semantic segmentation networks. They learn road semantic features through large-scale, diverse labeled datasets, directly outputting pixel-level road segmentation or boundary prediction results. These methods have strong scene generalization ability and robustness, maintaining high detection accuracy in environments with varying lighting, complex road conditions, or multi-lane environments.

[0004] However, traditional methods are sensitive to changes in external environmental factors such as lighting, shadows, and weather, making them prone to missed or false detections. Furthermore, their fitting accuracy is insufficient in curved roads and areas with high curvature, leading to significant detection bias. While deep learning-based methods offer higher accuracy and robustness, they require substantial computational resources; model training and online inference both rely on dedicated hardware, and they may still produce recognition errors in extreme or unseen complex scenarios.

[0005] Therefore, how to reduce the dependence on computing resources while maintaining high accuracy and robustness, and improve the adaptability to curves and complex road conditions, remains a key problem that road detection methods urgently need to solve. Summary of the Invention

[0006] This application provides a road detection method, apparatus, device, medium, and vehicle to reduce reliance on computing resources and improve adaptability to curves and complex road conditions while maintaining high accuracy and robustness.

[0007] Firstly, this application provides a road detection method, the method comprising: Acquire the target image; Gradient extraction is performed on the target image using a preset edge gradient operator to obtain a gradient image; Determining road line detection results based on gradient images; The gradient direction of the edge gradient operator corresponds to the extension direction of the road line in the target image.

[0008] In some examples, the road line includes a first edge and a second edge, the first edge extending in the target image in a first direction, and the second edge extending in the target image in a second direction; the edge gradient operator includes a first operator and a second operator, the gradient direction of the first operator corresponding to the first direction, and the gradient direction of the second operator corresponding to the second direction; After acquiring the target image, the methods include: Separate multiple channels of an image from a target image; Gradient extraction is performed on the target image using a preset edge gradient operator to obtain a gradient image, including: Gradient extraction is performed on images from multiple channels using the first and second operators, resulting in multiple gradient images.

[0009] In some examples, both the first operator and the second operator are k×k matrices, which include an enhancement band, a suppression band, and a first shielding band. The enhancement band is located on both sides of the first shielding band, and the suppression band is located on the side of the enhancement band away from the first shielding band. The extension directions of the first shielding band, the enhancement band, and the suppression band in the first operator correspond to the first direction, and the extension directions of the first shielding band, the enhancement band, and the suppression band in the second operator correspond to the second direction. Gradient extraction is performed on images from multiple channels using the first and second operators, resulting in multiple gradient images, including: The central features of road lines in multiple channels of the image are shielded by the first shielding strip; Enhance the bright edge features of the road line by strengthening the enhancement strip; By suppressing the dark edge features of the road line; Gradient images are obtained based on masked features, enhanced features, and suppressed features.

[0010] In some examples, the gradient direction of the first operator is -45° and the gradient direction of the second operator is +45°. Both the first and second operators are 5×5 matrices. The first operator is: ; The second operator is: .

[0011] In some examples, the road line detection results include road trajectories, and the road line detection results are determined based on gradient images, including: Convert multiple gradient images into multiple binary images based on a threshold; Multiple binary images are fused to obtain the final feature extraction map; The starting point of the road line is determined from the feature extraction map, and the road trajectory is obtained by searching in the extension direction of the starting point.

[0012] In some examples, the starting point of a road line is determined from the feature extraction map, and the road trajectory is obtained by searching in the extension direction of the starting point, including: Obtain the set of adjacent points from the last row of feature points in the feature extraction map; If the number of feature points in the adjacent point set does not exceed the point count threshold, calculate the average abscissa of each feature point in the adjacent point set, and determine the starting point based on the average abscissa. By extending from the starting point through spline search, a set of road line points is obtained. The points in the road line point set are then fitted to obtain the road trajectory.

[0013] Secondly, this application also provides a road detection device, the device comprising: The acquisition module is used to acquire the target image; The gradient extraction module is used to extract gradients from the target image using a preset edge gradient operator to obtain a gradient image. The detection module is used to determine the detection results of road lines based on gradient images; The gradient direction of the edge gradient operator corresponds to the extension direction of the road line in the target image.

[0014] Thirdly, this application also provides an electronic device, including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to perform the operations in the road detection method provided in the first aspect.

[0015] Fourthly, this application also provides a storage medium storing a plurality of instructions adapted for loading by a processor to execute the steps in the road detection method provided in the first aspect.

[0016] Fifthly, this application also provides a vehicle including a computer program or instructions that, when executed by a processor, implement the steps in the road detection method provided in the first aspect.

[0017] The road detection method, apparatus, equipment, medium, and vehicle provided in this application include a road detection method that extracts gradients from a target image using a preset edge gradient operator to obtain a gradient image. The gradient direction of the edge gradient operator corresponds to the extension direction of the road lines in the target image, enabling more accurate alignment with the actual road direction in the image. Commonly used edge detection operators primarily extract image edges in horizontal or vertical directions, making it difficult to effectively respond to road features in inclined or curved road sections, especially when the road extends diagonally, resulting in incomplete edge information extraction and decreased subsequent detection accuracy. In contrast, the edge gradient operator in this application is specifically designed with a diagonal gradient direction consistent with the road extension direction, effectively enhancing the gradient response of road edges and significantly improving edge extraction capabilities in curved and high-curvature areas. It can highlight continuous gradient features consistent with the road structure direction in the gradient image while suppressing noise and irrelevant textures, improving the separability between the road area and the background. Therefore, the road detection method provided in this application can maintain high accuracy and robustness in road detection while avoiding reliance on large-scale neural network models and complex feature extraction algorithms, thus reducing the dependence on computing resources. It can also adapt to various complex road conditions and unstructured road scenarios, significantly improving the system's adaptability to diverse road forms such as curves and variable-width lanes. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is one of the flowcharts illustrating the road detection method provided in the embodiments of this application; Figure 2 This is a schematic diagram of the target image provided in the embodiments of this application; Figure 3 This is one of the schematic diagrams of the first operator provided in the embodiments of this application; Figure 4 This is one of the schematic diagrams of the second operator provided in the embodiments of this application; Figure 5 This is the second schematic diagram of the first operator provided in the embodiments of this application; Figure 6 yes Figure 5 A schematic diagram of the calculation result obtained after convolving the target image with the provided first operator; Figure 7 This is the second schematic diagram of the second operator provided in the embodiments of this application; Figure 8 yes Figure 7 A schematic diagram of the calculation result obtained after convolving the target image with the provided second operator; Figure 9 This is a second schematic flowchart of the road detection method provided in the embodiments of this application; Figure 10 This is a schematic diagram of the road detection device provided in the embodiments of this application; Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined as "first" or "second" may explicitly or implicitly include one or more features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0022] "A and / or B" includes the following three combinations: A only, B only, and a combination of A and B.

[0023] The use of "applies to" or "configured to" in this application implies open and inclusive language, which does not preclude applicability to or configuration to devices performing additional tasks or steps. Furthermore, the use of "based on" implies openness and inclusivity, because processes, steps, calculations, or other actions "based on" one or more conditions or values ​​may in practice be based on additional conditions or values ​​beyond those conditions.

[0024] In this application, the term "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes are not described in detail to avoid obscuring the description of this application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.

[0025] The following description, in conjunction with the accompanying drawings, introduces the road detection method, apparatus, equipment, medium, and vehicle provided in the embodiments of this application.

[0026] like Figure 1 As shown in the figure, this application provides a road detection method, which includes the following steps: S101, acquire the target image.

[0027] The target image is a road scene image captured in real time by an onboard infrared camera. It can be a single-channel grayscale infrared image or a three-channel image (R, G, B).

[0028] S102, use a preset edge gradient operator to extract gradients from the target image to obtain a gradient image.

[0029] Specifically, the gradient direction of the edge gradient operator corresponds to the extension direction of the road line in the target image. That is, the edge gradient operator is pre-designed based on the extension direction of the road line in the target image. When the gradient direction of the edge gradient operator matches the road direction, the edge gradient information extracted from the target image is more concentrated and easier to distinguish. It also weakens the response on non-road directions (such as vertical power lines, horizontal drainage ditches, etc.), reducing subsequent false detections. Furthermore, in areas with uneven lighting or local shadows, the gradient operator based on direction matching can still stably extract road edges.

[0030] In some examples, if the road line extends at 45° in the target image (where 45° refers to the angle of rotation of the road line relative to the positive horizontal direction of the image), then the gradient direction of the edge gradient operator is also 45°. If the road line extends at 30° in the target image, then the gradient direction of the edge gradient operator is 30°. The direction of the road line in the target image can be determined based on the driving scenario. For example, in a straight-ahead scenario, the default direction of the road line in the target image is 45°; in a curved scenario, the direction of the road line in the target image may be 30°, 150°, etc. After obtaining the direction of the road line in the target image, the corresponding pre-stored edge gradient operator can be called for gradient extraction. Illustratively, the target image is as follows: Figure 2 As shown in the schematic target image, the white lines on both sides of the road are the road lines. Figure 2 The extension direction is 45°.

[0031] S103, Determine the detection results of road lines based on gradient images.

[0032] In some examples, non-maximum suppression and double threshold comparison can be used to suppress weak responses and retain local maxima in the gradient image, thus highlighting the gradient peaks at the road edges. Morphological opening and closing operations and connected component analysis can also be used to refine and filter edge pixels. After the above preprocessing, curve fitting is performed on the resulting processed gradient image. Spline fitting or polynomial curve fitting methods can be used to generate smooth and continuous road lines.

[0033] The road detection method provided in this application extracts gradients from a target image using a preset edge gradient operator to obtain a gradient image. The gradient direction of the edge gradient operator corresponds to the extension direction of the road lines in the target image, enabling more accurate alignment with the actual road direction in the image. Commonly used edge detection operators primarily extract image edges in horizontal or vertical directions (i.e., fixed 90° or 0° directions), which are insufficient to effectively respond to road features in inclined or curved road sections, especially when the road extends diagonally, resulting in incomplete edge information extraction and decreased detection accuracy. In contrast, the edge gradient operator in this application is specifically designed with a diagonal gradient direction (e.g., ±45°, ±30°, etc.) consistent with the road extension direction, effectively enhancing the gradient response of road edges and significantly improving edge extraction capabilities in curved and high-curvature areas. It highlights continuous gradient features consistent with the road structure direction in the gradient image while suppressing noise and irrelevant textures, improving the separability between the road area and the background. Therefore, the road detection method provided in this application can maintain high accuracy and robustness in road detection while avoiding reliance on large-scale neural network models and complex feature extraction algorithms, thus reducing the dependence on computing resources. It can also adapt to various complex road conditions and unstructured road scenarios, significantly improving the system's adaptability to diverse road forms such as curves and variable-width lanes.

[0034] In some embodiments of this application, the road line includes a first edge and a second edge, which correspond to the left and right edges of the road, respectively, and are typically distributed with the road centerline as the axis of symmetry. The extension direction of the first edge in the target image is the first direction, and the extension direction of the second edge in the target image is the second direction. The two directions are mirror-symmetrical with respect to the vertical axis of the image; specifically, the included angles of the two directions are equal and their directions are opposite.

[0035] The edge gradient operator includes a first operator and a second operator. The gradient direction of the first operator corresponds to a first direction and is used to extract the gradient information of the first edge. The gradient direction of the second operator corresponds to a second direction and is used to extract the gradient information of the second edge. In other words, the first operator can enhance the gradient changes distributed along the first direction in the image, while the second operator is used to enhance the gradient response distributed along the second direction, thereby effectively extracting the features of the road edges on both sides.

[0036] Schematic: when the first direction is +30° relative to the vertical axis of the image, the second direction is -30°. Here, "positive" and "negative" can be the sign of the angle between the edge extension direction and the vertical direction of the target image. Specifically, the vertical direction of the image (i.e. the direction of vehicle movement) can be defined as the positive direction, the angle between the edge and the vertical direction is positive counterclockwise and negative clockwise.

[0037] After acquiring the target image, the methods include: Multiple channels of images are obtained by separating them from the target image.

[0038] Schematic, the target image is a color infrared image captured by an onboard infrared camera, or a pseudo-color image constructed through specific band mapping. This target image contains multiple color channels, such as a red (R) channel, a green (G) channel, and a blue (B) channel. Through channel separation, the corresponding R, G, and B channel images can be extracted from the target image separately, allowing for independent analysis and processing of the local gradient features of each channel.

[0039] Gradient extraction is performed on the target image using a preset edge gradient operator to obtain a gradient image, including: Gradient extraction is performed on images from multiple channels using the first and second operators, resulting in multiple gradient images.

[0040] In some examples, the first operator is used to extract gradients from the images of the R, G, and B channels respectively, resulting in a first set of gradient images, denoted as R1, G1, and B1. The second operator is then used to extract gradients from the images of the R, G, and B channels respectively, resulting in a second set of gradient images, denoted as R2, G2, and B2.

[0041] It is understandable that when the target image is a single-channel image, the first operator and the second operator are used to extract the gradient of the single-channel image to obtain two gradient images.

[0042] The road detection method provided in this application extracts gradients from the RGB images using a first operator and a second operator. The gradient direction of the first operator corresponds to the extension direction of the left edge of the road in the target image (e.g., +45°), and is used to extract the gradient features of the left road edge. The gradient direction of the second operator corresponds to the extension direction of the right edge of the road (e.g., -45°), and is used to extract the gradient features of the right edge. By using the first and second operators, comprehensive edge information from different directions and color channels in the target image is captured. Based on this effective and comprehensive edge information, the accuracy and continuity of road edge response can be improved. Furthermore, by applying edge gradient operators with different directions to the RGB channels respectively, subtle image change features can be obtained from different spectral dimensions, because different color channels may have different response intensities to object edges, shadows, reflections, etc., in infrared images.

[0043] In some embodiments of this application, both the first operator and the second operator are k×k (e.g., 3×3, 5×5) two-dimensional matrix structures used to perform weighted convolution on the pixel values ​​of the target image in image gradient calculation. Both the first and second operators include an enhancement band, a suppression band, and a first shielding band. The spatial distribution of these three types of regions in the matrix corresponds to a preset gradient direction, forming a directional response template. Specifically, the enhancement band is located on both sides of the first shielding band, and the suppression band is located on the side of the enhancement band away from the first shielding band. The extension directions of the first shielding band, enhancement band, and suppression band in the first operator correspond to a first direction, and the extension directions of the first shielding band, enhancement band, and suppression band in the second operator correspond to a second direction.

[0044] In some examples, the first shielding band is the center diagonal or near-diagonal region of the matrix, with convolution coefficients of 0, used to shield the interference of the convolution center and avoid the center pixel value from misleading the gradient direction response.

[0045] The enhancement band is located on both sides of the first shielding band, and its convolution coefficient is a positive number greater than 0. It is used to enhance pixel changes that are consistent with the gradient direction.

[0046] The suppression band is located on the side of the enhancement band away from the first shielding band, and its convolution coefficient is a negative number less than 0. It is used to weaken the pixel response that is unrelated to or opposite to the target direction.

[0047] Schematic illustration: Both the first and second operators are 3×3 matrices, taking an example where the first direction is -45° and the second direction is +45°. The first operator is as follows: Figure 3 As shown, its main diagonal (from the top left to the bottom right) is the first shielding band, with a convolution coefficient of 0; the enhancement bands are distributed on both sides of the diagonal, with positive convolution coefficients (e.g., 2), used to enhance bright edges extending along this direction; the suppression band is located on the side of the enhancement band further away from the diagonal, with a negative convolution coefficient (e.g., -2), used to suppress dark edges and interference response. The second operator is as follows: Figure 4 As shown, its secondary diagonal (from the upper right to the lower left) is the first shielding band, and the convolution coefficient is also set to 0; the enhancement band is located on both sides of the secondary diagonal, and the convolution coefficient is positive (such as 2); the suppression band is arranged outside the enhancement band, and the corresponding convolution coefficient is negative (such as -2), which is used to weaken the noise influence in non-target directions.

[0048] In other examples, the convolution coefficients in the enhancement band can be flexibly set according to the actual application, for example, they can include 1 and 2 to adjust the weights of the gradient response; the convolution coefficients in the suppression band are negative, usually set to -2, but in other examples they can also include -1 or stronger suppression values ​​such as -3, to adapt to different image contrasts and interference intensities. In addition to the values ​​mentioned above, other combinations of coefficients can also be used in the convolution kernel, such as ±3, ±4, etc., to achieve edge sensitivity control in different directions and intensities.

[0049] Gradient extraction is performed on images from multiple channels using the first and second operators, resulting in multiple gradient images, including: The central features of road lines in multiple channels of an image are masked by the first shielding strip.

[0050] Enhance the bright edge features of the road line by strengthening the enhancement strip.

[0051] By suppressing the dark edge features of the road lines.

[0052] Gradient images are obtained based on masked features, enhanced features, and suppressed features.

[0053] In some examples, since the center of the road line is typically a bright area with a relatively flat grayscale distribution, directly participating in gradient calculation may lead to a shift in the mean response or obscuring edge information. By setting the masking band to zero, the interference of the center pixel on the gradient of the surrounding edges can be effectively eliminated, highlighting the changing characteristics of the edge structure itself.

[0054] When there is a sudden change in brightness between road lines and the background (e.g., from a dark road surface to a bright road marking), the enhancement band can increase the convolutional contribution of these edge pixels, making them appear as high-intensity responses in the gradient image, which facilitates subsequent edge recognition and extraction.

[0055] In certain complex road conditions, such as lane edges with shadows, dirt, or color reversal, interference may be introduced. The negative weight of the suppression band can suppress these abnormal areas and reduce their impact on the overall gradient results.

[0056] Through the combined effect of the enhancement band, suppression band, and first shielding band, directional weighted convolution is performed on each channel of the target image to obtain multiple gradient images (such as R1, G1, B1, R2, G2, B2) in the first and second directions. Each gradient image contains a shielded central region (to prevent self-interference), enhanced high-contrast bright edges (to accurately locate road line edges), and suppressed noisy dark edges (to improve anti-interference capability).

[0057] In some embodiments of this application, if the convolution coefficients in the matrix are not completely filled by the enhancement band, the suppression band, and the first shielding band, the matrix also includes a second shielding band that fills the remaining positions in the matrix.

[0058] The gradient direction of the first operator is -45°, and the gradient direction of the second operator is +45°. Both the first and second operators are 5×5 matrices. The first operator V1 is:

[0059] The positions of the enhancement band, suppression band, first shielding band, and second shielding band in the first operator V1 are shown in the diagram below. Figure 5 As shown, the first shielding band is arranged from the upper right to the lower left, corresponding to the -45° direction of the road line in the target image. This direction is consistent with the target gradient direction of the first operator and is used to shield the interference features in the center region of the road line.

[0060] Symmetrically distributed on both sides of the first shielding band are reinforcement bands, whose orientation also aligns with -45°, presenting a diagonal structure parallel to the first shielding band. Further extending outwards are suppression bands, also distributed along the -45° direction, parallel to the shielding and reinforcement bands, used to suppress interference responses from dark edges or non-target directions. Furthermore, to ensure the integrity and symmetry of the matrix structure, the remaining areas not covered by the reinforcement bands, suppression bands, or the first shielding band are defined as the second shielding band, with its convolution coefficient uniformly set to 0, used to fill matrix gaps and avoid introducing invalid gradient responses.

[0061] More specifically, such as Figure 6 As shown, the convolution calculation result between the first operator V1 and the pixels in the target image is obtained from... Figure 6 It can be seen that different results are obtained after convolution of pixels at different locations with the V1 operator. Since the convolution weights on the first shielding band are 0, the calculation result on the first shielding band is always 0, meaning that pixels in this region do not affect the final gradient map, thus effectively shielding the interference features in the center region of the road line. Pixels on the enhancement band are multiplied by the convolution kernel coefficients with a weight of +2, producing a large positive response when pixel values ​​change significantly (e.g., from dark to light or light to dark), reflecting a significant enhancement of bright edge features in that direction in the image. The convolution coefficients corresponding to pixels on the suppression band are -2. In regions with dark edges or noise perturbations, the response values ​​at these locations will be effectively suppressed, thereby reducing the influence of erroneous gradients. Furthermore, Figure 6 The arrows indicate the direction of gradient extraction, representing the gradient change trend of the current pixel in that direction, such as f. 12 Pointing to -2f 13 That is, f 12 The gradient change trend is pointing towards -2f 13 .

[0062] The second operator V2 is: .

[0063] Similarly, the positions of the enhancement band, suppression band, first shielding band, and second shielding band in the second operator V2 are shown in the diagram below. Figure 7As shown, the first shielding band is arranged along the +45° direction of the image, i.e., from the upper left to the lower right, corresponding to the extension direction of the right edge of the road line. The enhancement bands are also distributed on both sides of the first shielding band, forming a parallel and symmetrical structure. The suppression band is located outside the enhancement band, also aligned with the first shielding band, constituting the outer region in the broad gradient direction. In addition, the second shielding band is used to fill in the positions not covered by the aforementioned three types of bands, and its convolution coefficient is uniformly set to 0.

[0064] More specifically, the convolution result of the second operator V2 with the pixels in the target image is as follows: Figure 8 As shown. By Figure 8 As can be seen, multiplying and summing the weights at different positions of pixels with the corresponding positions of the second operator V2 convolution kernel yields different calculation results. Similarly, Figure 8 The arrows in the diagram indicate the gradient extraction direction in the convolution operation. The arrows start at the current pixel position and point to the neighborhood where the corresponding weights are applied, reflecting the spatial propagation path of the local gradient.

[0065] It is understood that in other embodiments, the first operator V1 and the second operator V2 can also be convolution operators of other sizes such as 3×3 and 7×7. Among them, the 5×5 operator has a larger receptive field than the 3×3 operator, meaning it can cover a wider pixel area in a single convolution operation. Specifically, the 3×3 operator operates on only 9 pixels in the target image each time, while the 5×5 operator can cover 25 pixels simultaneously, allowing more contextual information to be utilized in each calculation. This larger receptive field helps capture the local change trends and spatial structural features of road edge areas.

[0066] Compared to smaller convolutional kernels, the 5×5 operator can extract more continuous and stable edge responses from gradient images, thereby improving the recognition of the integrity of road lines. This has significant advantages for achieving robust road detection under complex conditions (such as curves, unstructured roads, and strong light and shadow interference).

[0067] Furthermore, as the operator size increases, its computational complexity also increases accordingly. For example, while a 7×7 convolution operator can cover 49 pixels and extract richer contextual information, it also brings a higher computational burden. To balance computational efficiency and gradient calculation effectiveness, a 5×5 operator is preferred.

[0068] In addition, in the first operator V1 and the second operator V2, the convolution coefficients at each position represent the contribution intensity of the corresponding image pixel to the overall gradient response. Positive coefficients indicate enhancement of the response contribution of the pixel at that position, while negative coefficients indicate suppression. Based on this principle, positive values ​​such as 1 and 2 are used for the enhancement band in the operators, and a negative value of -2 is used for the suppression band. The specific numerical design of the coefficients takes into account edge response intensity, directional prominence, and the gray-level distribution characteristics of the image itself.

[0069] The suppression band is set to -2 because road backgrounds or non-target areas often exhibit low contrast, low brightness, or structural blur. Without suppression, pixels in these areas may produce invalid or even interfering responses during convolution. Therefore, setting the suppression band to -2 effectively suppresses response values ​​in non-edge areas or edges with opposite directions, reducing background noise interference with edge extraction and improving the saliency of road edges.

[0070] The convolution coefficient 2 in the enhancement band is typically located in the enhancement band immediately adjacent to the first shielding band, i.e., the pixel closest to the edge of the road line. Pixel changes at these locations best reflect the true gradient information of the edge, and therefore are given higher weight to highlight the edge response. The convolution coefficient 1 in the enhancement band is typically located in the outer enhancement band or the second neighborhood, playing a supporting role in edge enhancement while avoiding over-response to noise or non-ideal regions. By setting the convolution coefficients of the enhancement band, it is possible to enhance the pixel response near the edge in the main edge direction and moderately enhance the peripheral response, thereby forming a continuous and smooth gradient transition effect. In other embodiments, the convolution coefficients of the enhancement band are uniformly 2 or other values, and the suppression band can be uniformly -1, or a combination of -1 and -2, etc.

[0071] Furthermore, the choice of a positive coefficient, such as 1 or 2, is a result of striking a balance between gradient sensitivity and noise resistance. If the coefficient is too large (e.g., 4 or 5), the response to areas with weak gradient changes will be overwhelmed, only affecting extremely strong edge changes, thus reducing detail recognition capability. If a fraction (e.g., 0.5) is chosen, the response will be too weak to distinguish effective edges from background texture, especially in infrared images where pixel gradients are inherently low, and the convolution coefficients will further weaken edge sensitivity. Therefore, the design of enhancement and suppression bands ensures the directional prominence and continuity enhancement of road edges, while avoiding excessive amplification or suppression of edge responses, achieving high-precision, low-noise, and computationally efficient infrared image road detection.

[0072] In some embodiments of this application, the road line detection result includes the road trajectory, and determining the road line detection result based on the gradient image includes: Multiple gradient images are converted into multiple binary images based on a threshold.

[0073] Multiple binary images are fused to obtain the final feature extraction map.

[0074] The starting point of the road line is determined from the feature extraction map, and the road trajectory is obtained by searching in the extension direction of the starting point.

[0075] In some examples, thresholding is performed on the gradient images R1, G1, B1, R2, G2, and B2 obtained from the aforementioned calculations to convert the grayscale gradient images into binary images while preserving significant edge features. The threshold can be determined as follows: The OTSU adaptive thresholding method automatically finds the segmentation point with the largest inter-class variance as the optimal threshold based on the gradient image histogram distribution. The fixed threshold method pre-sets a fixed value as the binarization threshold, which can be manually adjusted based on empirical values ​​or image characteristics in actual application scenarios. The mean or median method uses the mean / median of the overall grayscale value of the gradient image as a threshold benchmark for fast binary segmentation. The local adaptive thresholding method divides the image into several sub-blocks and calculates the local mean, variance, or other feature values ​​within each sub-block as the local threshold for that region.

[0076] Image-level fusion is performed on the above six binary images. The fusion methods may include: pixel-level OR operation, which is used to retain edge responses detected in all directions and channels; pixel-level AND operation, which is used to emphasize strong edge regions with common responses from multiple channels; and weighted fusion, which is used to assign different weights according to channel reliability or gradient strength and then superimpose them to balance features from different sources.

[0077] The final fusion result is the feature extraction map, which contains the road edge region obtained by multi-directional and multi-channel comprehensive judgment. It has strong edge connectivity and good noise resistance, providing a stable foundation for subsequent trajectory extraction.

[0078] After obtaining the feature extraction map, the set of adjacent points is obtained from the feature points in the last row of the feature extraction map.

[0079] If the number of feature points in the adjacent point set does not exceed the point count threshold, calculate the average abscissa of each feature point in the adjacent point set, and determine the starting point based on the average abscissa.

[0080] By extending from the starting point through spline search, a set of road line points is obtained. The points in the road line point set are then fitted to obtain the road trajectory.

[0081] Schematic illustration: Starting point determination: All edge feature points are extracted from the last row of the feature extraction map and clustered according to their horizontal coordinate positions to form multiple neighboring point sets. In each point set, if the number of feature points does not exceed a preset point count threshold (e.g., 6), it is considered a potential candidate region for the starting point of the road line.

[0082] Subsequently, the average abscissa of all feature points within each point set is calculated and used as the representative position of that point set. When a point set that meets the conditions is found in both the left and right regions, and the difference between the average abscissas of the two sets falls within the preset road lane spacing range (set according to the image calibration results, allowing a certain fluctuation tolerance), then the pair of average values ​​are confirmed as the starting points of the left and right road lines in the image, respectively, and are used as the initial anchor points for subsequent trajectory extraction.

[0083] Directional search: Starting from the beginning of the left and right road lines, the search proceeds vertically along the image (from bottom to top, i.e., the direction of vehicle travel), line by line, to construct a complete set of trajectory points. Specifically, a fixed-size rectangular spline frame is created at each starting point and slides upwards with a set step size. Within each spline frame, a search is performed to determine if feature points satisfying edge conditions exist. If a valid edge point is detected, it is added to the current trajectory point set, and the search continues upwards based on that point. If edge points are detected in multiple consecutive spline frames, a continuous candidate trajectory path is formed.

[0084] Trajectory Fitting: The trajectory point sets obtained on the left and right sides are fitted. Cubic spline functions are preferred for curve fitting, but polynomial fitting or other methods can also be selected depending on the actual needs. Cubic spline fitting can accurately fit the local curvature features presented in the point set, generating a continuous, smooth, and naturally shaped road trajectory curve. In other embodiments, trajectory fitting can also be implemented using polynomial fitting algorithms, B-spline fitting algorithms, Bézier curve fitting algorithms, etc., without limitation.

[0085] like Figure 9 As shown in the embodiments of this application, a road detection method is also provided, which includes the following steps: S901 acquires the target image and extracts the RGB three-channel image from it, wherein the target image is an infrared image.

[0086] S902, gradient images are obtained by extracting gradients from the images of the RGB three channels using the first operator V1 and the second operator V2 respectively. The gradient directions of the first operator V1 and the second operator V2 are consistent with the extension direction of the road lines in the target image. Specifically, the first operator V1 and the second operator V2 are the aforementioned 5×5 ±45° matrices.

[0087] S903 converts six gradient images into binary images based on a threshold.

[0088] S904 performs intersection-union-mixing on six binary images to obtain a feature extraction map.

[0089] S905, obtain the set of neighboring points of the last row in the feature extraction map.

[0090] S906, determine if the number of adjacent point clusters is less than a preset value (e.g., 6, 7, etc.). If it is less than the preset value, proceed to step S907; if it exceeds the preset value, proceed to S901 to obtain a new target image for processing.

[0091] S907, calculate the average of the x-coordinates of all points in the adjacent point set, and use it as the x-coordinate of the starting point of the road line.

[0092] S908, determine whether the difference in the average value of the horizontal coordinate is within the preset spacing range between the two roads in the image. If it is within the spacing range, proceed to step S909; if it is not within the spacing range, proceed to S901 to obtain a new target image for processing.

[0093] S909 determines the starting positions of the left and right tracks, which serve as the starting points of the road line.

[0094] S910 starts from a defined starting point and extends upwards step by step through spline search to obtain the set of orbital points.

[0095] S911 uses a cubic spline fitting method to fit the orbital point set to obtain the final orbital curve.

[0096] The road detection method provided in this application can efficiently acquire the reflection features of roads under different lighting conditions by acquiring infrared images and extracting their RGB channels. Gradient changes in the image are extracted using a first operator V1 and a second operator V2. Based on the extension direction (±45°) of the road lines in the image, this design can accurately extract road edge features. By using the first and second operators whose gradient direction is consistent with the extension direction of the road lines in the infrared image, not only can road edges be accurately captured, but the influence of background noise and interference factors can also be avoided, thereby improving the accuracy and robustness of road edge extraction. This allows for stable extraction of road features even in complex environments (such as curved roads, weak edges, etc.). Compared with traditional neural network methods, the road detection method provided in this application does not require large-scale training datasets and complex network models, nor does it require powerful computing resources. The calculation process mainly relies on gradient image processing and simple mathematical operations (such as threshold segmentation, spline fitting, etc.), resulting in higher computational efficiency.

[0097] like Figure 10As shown in the figure, this application embodiment also provides a road detection device, which includes an acquisition module 1001, a gradient extraction module 1002 and a detection module 1003.

[0098] Acquisition module 1001 is used to acquire the target image; Gradient extraction module 1002 is used to extract gradients from the target image using a preset edge gradient operator to obtain a gradient image; Detection module 1003 is used to determine the detection result of road lines based on gradient images; The gradient direction of the edge gradient operator corresponds to the extension direction of the road line in the target image.

[0099] The road detection device provided in this application corresponds to the road detection method described above, and will not be repeated here.

[0100] Based on any of the above embodiments, another embodiment of this application also provides an electronic device, such as... Figure 11 As shown, the electronic device may include a processor 1110, a communication interface 1120, a memory 1130, and a communication bus 1140, wherein the processor 1110, the communication interface 1120, and the memory 1130 communicate with each other through the communication bus 1140. The processor 1110 can call logical instructions in the memory 1130 to execute the aforementioned road detection method.

[0101] Furthermore, the logical instructions in the aforementioned memory 1130 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0102] Furthermore, when the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0103] On the other hand, embodiments of this application also provide a storage medium storing a plurality of instructions adapted for loading by a processor to execute the road detection method provided in the above embodiments.

[0104] On the other hand, embodiments of this application also provide a vehicle, including a computer program, which, when executed by a processor, implements the above-described road detection method.

[0105] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0106] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.

[0107] The road detection method, apparatus, equipment, medium, and vehicle provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A road detection method characterized by, The method comprises: acquiring a target image; extracting gradients of the target image by using a preset edge gradient operator to obtain a gradient image; determining a detection result of a road line based on the gradient image; wherein a gradient direction of the edge gradient operator corresponds to an extension direction of the road line in the target image.

2. The road detection method according to claim 1, characterized by, The road line comprises a first edge and a second edge, the extension direction of the first edge in the target image is a first direction, and the extension direction of the second edge in the target image is a second direction; the edge gradient operator comprises a first operator and a second operator, the gradient direction of the first operator corresponds to the first direction, and the gradient direction of the second operator corresponds to the second direction; after the target image is acquired, the method comprises: separating a plurality of channel images from the target image; the step of extracting gradients of the target image by using a preset edge gradient operator to obtain a gradient image comprises: extracting gradients of the plurality of channel images by using the first operator and the second operator to correspondingly obtain a plurality of gradient images.

3. The road detection method according to claim 2, characterized by, The first operator and the second operator are both k×k matrices, the matrix comprises an enhancement band, an inhibition band and a first shielding band, the enhancement band is located on both sides of the first shielding band, the inhibition band is located on a side of the enhancement band away from the first shielding band, the extension direction of the first shielding band, the enhancement band and the inhibition band in the first operator corresponds to the first direction, and the extension direction of the first shielding band, the enhancement band and the inhibition band in the second operator corresponds to the second direction; the step of extracting gradients of the plurality of channel images by using the first operator and the second operator to correspondingly obtain a plurality of gradient images comprises: shielding the central feature of the road line in the plurality of channel images through the first shielding band; enhancing the bright edge feature of the road line through the enhancement band; suppressing the dark edge feature of the road line through the inhibition band; obtaining the gradient image based on the shielded feature, the enhanced feature and the suppressed feature.

4. The road detection method according to claim 3, characterized by, The gradient direction of the first operator is -45°, the gradient direction of the second operator is +45°, the first operator and the second operator are both 5×5 matrices, and the first operator is: ; The second operator is: 。 5. The road detection method according to any one of claims 2 to 4, characterized by, The detection result of the road line comprises a road track, and the step of determining the detection result of the road line based on the gradient image comprises: converting a plurality of gradient images into a plurality of binary images according to a threshold value; fusing the plurality of binary images to obtain a final feature extraction image; determining a starting point of the road line from the feature extraction image, and searching for the road track in the extension direction of the starting point.

6. The road detection method according to claim 5, characterized by, The step of determining the starting point of the road line from the feature extraction image, and searching for the road track in the extension direction of the starting point comprises: acquiring a set of adjacent points from the last row of feature points of the feature extraction image; In a case where the number of feature points in the adjacent point set does not exceed a point threshold, an average value of abscissas of each feature point in the adjacent point set is calculated, and the starting point is determined according to the average value of the abscissas; The starting point is extended by a spline search, a road line point set is searched and obtained, and the road trajectory is obtained by fitting the points in the road line point set.

7. A road detection device characterized by comprising: The device comprises: An acquisition module is configured to acquire a target image; A gradient extraction module is configured to perform gradient extraction on the target image by using a preset edge gradient operator to obtain a gradient image; A detection module is configured to determine a detection result of a road line based on the gradient image. The gradient direction of the edge gradient operator corresponds to the extension direction of the road line in the target image.

8. An electronic device, comprising: The device comprises a memory and a processor; the memory stores a computer program; and the processor is configured to run the computer program in the memory to perform the operations in the road detection method of any one of claims 1 to 6.

9. A storage medium, characterized by The storage medium stores a plurality of instructions, and the instructions are adapted to be loaded by the processor to perform the steps in the road detection method of any one of claims 1 to 6.

10. A vehicle characterized by comprising: The device comprises a computer program or instructions, and the computer program or instructions are executed by the processor to implement the steps in the road detection method of any one of claims 1 to 6.