Strong light interference lane line detection method based on image restoration algorithm
Technical Field
The invention belongs to the technical field of image processing and road safety driving, and particularly relates to a strong light interference lane line detection method based on an image restoration algorithm.
Background
The lane line detection technology is one of important components of the current high-order automatic auxiliary driving of the vehicle, under the complex urban road environment or the blocked driving environment, strong sunlight passes through gaps of the blocking objects to form illumination projections with different shapes on the road surface to interfere with the lane line detection, particularly, the sunlight passes through the gaps to form strip-shaped strong light on the road surface, the lane line detection method based on camera observation is challenged, the vehicle passes through a scene of strong light interference, the strong light can interfere with the detection of the lane line to a certain extent to reduce the detection precision, and the safety of automatic driving and the driving safety of the road are affected.
The existing lane line detection method is under the environment with sufficient and soft illumination, the road is wide and free from shielding, and the lane line is obviously compared with the lane. However, in a complex road environment or a blocked driving environment, light forms a complex illumination projection on a lane through a gap of a blocking object above, and particularly a vehicle running under a viaduct is easily affected by strong light passing through the gap, and a linear strong light almost flush with a lane line is formed, which is a difficult challenge for lane line detection depending on a camera image detection technology. The existing lane line detection method is affected by the strong light interference, the situation that straight line strong light is mistakenly regarded as a lane line and the detected lane line deviates from reality occurs, the lane line detection accuracy is not high under the strong light interference environment, the existing lane line detection method ignores the illumination discrete coefficient of an image as a distinguishing image distinguishing standard when identifying whether the current image is the strong light environment or not, and in addition, the existing lane line detection method is subjected to strengthening treatment on the whole picture when facing the strong light interference, so that the identification condition of the lane line under the existence of the straight line strong light interference is not ideal.
Disclosure of Invention
The invention aims to provide a strong light interference lane line detection method based on an image restoration algorithm, which aims to solve the problem that the influence of strong light interference on lane line detection is not considered in the existing method.
In order to achieve the above purpose, the specific technical scheme of the strong light interference lane line detection method based on the image restoration algorithm is as follows:
The strong light interference lane line detection method based on the image restoration algorithm comprises the following steps of:
s1, acquiring a video image according to a monocular vision camera at the front part of a vehicle, extracting the image according to the real-time speed of the vehicle at intervals of frames, and processing the image into a png format;
Step S2, performing ROI processing on the extracted current frame image, performing filtering operation by using a binary mask, selecting a road part in the image as an interested region, calculating the brightness mean value and standard deviation of the ROI region, further calculating a discrete coefficient to be used as a judging condition of a strong light environment, if the calculated discrete coefficient is higher than a threshold value, performing step S3, and if the calculated discrete coefficient is smaller than or equal to the threshold value, performing step S4, wherein the brightness mean value and standard deviation are considered, and the brightness discrete coefficient is calculated, so that the discrete coefficient can effectively reflect the differentiation of brightness. Test calculation shows that the case discrete coefficient of the method is 0.97, the discrete coefficient of a normal road is 0.21, and the larger the discrete coefficient is, the larger the strong light interference is, the threshold value set by the method is 0.45, so that the image of the case is subjected to strong light interference. The method is suitable for strong lights with different shapes, and can effectively judge strong light interference;
And S3, calibrating a strong light interference area to generate a mask, carrying out image restoration by utilizing incoherent pixels in adjacent areas to eliminate strong light interference based on a rapid non-iterative image restoration method, traversing the restoration area only once by adopting a rapid pushing method, transmitting an image value along the coherence direction of the robust estimation of the structure tensor, namely eliminating the strong light interference by utilizing a inpaintCoherent algorithm, and normalizing the image by restoring the area of the strong light interference so as to detect the lane line. The existing lane line detection method does not consider image restoration, and the application range of the external sensing sensor of the vehicle can be wider by restoring the image, so that the reliability of the system is improved;
Step S4, converting the image from RGB channels to HSV channels, performing global equalization processing on each channel of the HSV channels, performing global equalization on color images, changing the brightness of each pixel in the image by changing the histogram of the image, enhancing the contrast of the image with smaller dynamic range, wherein the original image is not clear enough due to uneven brightness distribution, adopting global histogram equalization, converting the histogram of the original image into a uniformly distributed form, retaining the color information of the image, thereby achieving the effect of enhancing the integral contrast of the image, converting the RGB image format into HSV format, and performing histogram equalization on each channel, thereby realizing global histogram equalization. The method has the advantages that the color information of the image is reserved, and the global contrast is improved so that the image is clearer. Some of the existing lane line detection methods are histogram equalization, and color information is not reserved. The method can improve the reliability of the system;
step S5, gray processing is carried out on the enhanced image, further image edge detection is carried out by using a Gaussian-Laplacian operator (LAPLACIAN OFGAUSSIAN, LOG operator), the convolution kernel size is 5 multiplied by 5, and then average filtering processing is carried out on noise in the range of 3 multiplied by 3 of the image;
S6, calculating the mean value and variance of brightness after mean value filtering, constructing threshold constraint to perform binarization processing on the image and selecting an ROI image of a region to be detected;
And S7, carrying out lane line detection by using a Hough transform detection algorithm, classifying the detection result based on positive and negative slopes of the straight lines, filtering outliers, finding out the straight line endpoint with the farthest distance in each classification, carrying out straight line fitting, and drawing a lane line.
Further, in the step S1, the image is extracted according to the real-time speed of the vehicle at intervals and processed into png format, which comprises the following steps, and the following steps are sequentially performed:
Step S11, calculating and extracting real-time frame interval
The frame rate of the monocular vision camera is defined as f, and the real-time display speed of the vehicle is defined as v. In order to ensure the requirement of the real-time detection of the lane line in the running process of the vehicle, the calculated extraction real-time frame interval is as follows:
And step S12, extracting the current real-time image every t frames according to the calculated extraction real-time frame interval t, and processing the current real-time image into a png format.
Further, in the step S2, the calculation of the mean value and standard deviation of the brightness of the ROI area and further the calculation of the discrete coefficient as the condition for judging the strong light environment includes the following steps, which are sequentially performed:
Step S21, calculating a luminance mean value of the ROI area as mean_value, a standard deviation as std_value, and further calculating a discrete coefficient:
and S22, setting the discrete coefficient threshold value to be 0.45, if c is more than 0.45, performing step S3, and if c is less than or equal to 0.45, performing step S4.
Further, in the step S4, the image is converted from the RGB channel to the HSV channel and each HSV channel is subjected to equalization processing, and global equalization of the color image is performed, which includes the following steps:
S41, converting an image from an RGB channel to an HSV channel, and processing a V channel component to a range of [0,255 ];
Step S42, calculating the histogram distribution and frequency of V, calculating the cumulative distribution frequency of V, carrying out equalization treatment on the V channel component, and restoring to the range of [0,1], wherein the statistical frequency distribution formula and the equalization formula are as follows:
Wherein r k is the gray level number, M and N are the number of rows and columns of the number of pixel points, N k is the number of times the current gray value appears, L is the maximum gray level number, and s k is the equalized gray level number;
And S43, replacing the original un-equalized V-channel component with the equalized V-channel component, converting the image from the HSV space back to the RGB space, and outputting the equalized image.
Further, in the step S5, the 5×5 discrete convolution kernel of the image edge detection operator using the gaussian-laplacian operator is:
Because the Laplace operator has higher sensitivity to image noise, the image is firstly processed by Gaussian blur and then edge detection is carried out, so that a better detection effect can be realized.
Further, in the step S6, the mean value and variance of the brightness after the mean value filtering are calculated, a threshold constraint is constructed, the set threshold is the sum of the mean value and the variance, then binarization processing is performed, and the ROI image of the region to be detected is selected.
Further, the step S7 includes the following steps, and the following steps are sequentially performed:
Step S71, detecting lane lines through a Hough change straight line detection algorithm to obtain a structural body with end point coordinate information stored, calculating the slope of each straight line, storing the slope in a vector k, and removing outlier slopes through outlier filtering;
and S72, respectively storing the obtained slopes in two vectors according to positive and negative classifications, finding out two endpoints with the farthest longitudinal distance by traversing the longitudinal coordinates of the endpoints, performing straight line fitting, and drawing a lane line.
The strong light interference lane line detection method based on the image restoration algorithm has the following advantages:
1) According to the invention, by setting the region of interest (ROI), the corresponding brightness discrete coefficient is calculated, so that whether the current image is interfered by strong light or not can be effectively judged, and the image interfered by strong light enters an image restoration process.
2) According to the invention, the video image is acquired according to the monocular vision camera at the front part of the automobile, and the image is extracted according to the real-time speed of the automobile at intervals, so that the image to be processed can be reduced when the speed is lower, and the system calculation force can be reduced.
3) According to the invention, the Gaussian-Laplace operator with the convolution kernel size of 5 multiplied by 5 is used for detecting the image edge, and then the average filtering is carried out to process the noise in the range of 3 multiplied by 3 of the image, so that more accurate edge detection is realized on the image, and the influence of the noise on lane line detection is better avoided.
4) The invention can effectively improve the detection precision of the lane line under the interference of external strong light, avoid the false judgment of the lane line detection and improve the driving safety of the road.
Drawings
FIG. 1 is a flow chart of the present invention.
Fig. 2 is a schematic diagram of lane line detection to be interfered by strong light.
FIG. 3 is a schematic diagram of a selected ROI area for calculating discrete coefficients.
FIG. 4 is a schematic diagram of a selected mask to repair an area.
Fig. 5 is a schematic diagram of the image restoration after eliminating strong light interference.
Fig. 6 is a schematic diagram after HSV global equalization.
Fig. 7 is a schematic diagram after image edge detection using LoG operator with convolution kernel size of 5×5.
Fig. 8 is a schematic diagram after noise cancellation using mean filtering.
FIG. 9 is a diagram of a selected lane line detection area after binarization.
Fig. 10 is a schematic diagram of lane line detection and fitting on an original image.
Detailed Description
In order to better understand the purpose, structure and function of the present invention, the following describes in detail a strong light interference lane line detection method based on an image restoration algorithm with reference to the accompanying drawings.
As shown in figure 1, the method comprises the steps of firstly obtaining a video image according to a monocular vision camera at the front part of a vehicle, extracting the image according to the real-time speed of the vehicle, judging whether the current image has strong light interference or not through calculating a brightness discrete coefficient of a region of interest, carrying out image restoration processing on the current image if the current image has strong light interference, carrying out restoration processing on the image by demarcating a region to be restored, carrying out image edge detection on the image by a Gaussian-Laplace operator, enabling the convolution kernel size to be 3 multiplied by 3, carrying out binarization processing of a mean value filtering processing kernel based on threshold constraint of brightness mean value and variance after mean value filtering, and finally carrying out Hough transformation detection and slope-based clustering processing on marking lane lines.
Example 1:
As shown in fig. 1, the method for detecting the strong light interference lane line based on the image restoration algorithm provided by the embodiment of the invention comprises the following steps in sequence:
s1, acquiring a video image according to a monocular vision camera at the front part of a vehicle, extracting the image according to the real-time speed of the vehicle at intervals of frames, and processing the image into a png format;
the method specifically comprises the following steps:
Step S11, calculating and extracting real-time frame interval
The frame rate of the monocular vision camera is defined as f, and the real-time display speed of the vehicle is defined as v. In order to ensure the requirement of the real-time detection of the lane line in the running process of the vehicle, the calculated extraction real-time frame interval is as follows:
Step S12, extracting the current real-time image every t frames according to the calculated extraction real-time frame interval t, and processing the current real-time image into a png format, wherein the obtained image subjected to strong light interference is shown in fig. 2.
Step S2, performing ROI processing on the extracted current frame image, performing filtering operation by using a binary mask, selecting a road part in the image as an interested region, calculating the brightness mean value and standard deviation of the ROI region, further calculating a discrete coefficient to be used as a judging condition of a strong light environment, performing step S3 if the calculated discrete coefficient is higher than a threshold value, and performing step S4 if the calculated discrete coefficient is smaller than or equal to the threshold value to obtain the ROI region as shown in figure 3;
the method specifically comprises the following steps:
Step S21, calculating a luminance mean value of the ROI area as mean_value, a standard deviation as std_value, and further calculating a discrete coefficient:
and S22, setting the discrete coefficient threshold value to be 0.45, if c is more than 0.45, performing step S3, and if c is less than or equal to 0.45, performing step S4.
Step S3, calibrating a strong light interference area to generate a mask, and performing image restoration to eliminate strong light interference by utilizing incoherent pixels in adjacent areas based on a rapid non-iterative image restoration method, wherein the algorithm adopts a rapid pushing method, traverses the restoration area only once, and simultaneously transmits an image value along a coherent direction of a robust estimation of a structure tensor, namely, eliminates strong light interference by utilizing inpaintCoherent algorithm, so that an area to be restored is shown in figure 4, and is shown in figure 5 after performing image restoration to eliminate strong light interference;
S4, converting an image from an RGB channel to an HSV channel, performing global equalization processing on each channel of the HSV channel, performing global equalization on a color image, changing the brightness of each pixel in the image by changing the histogram of the image, enhancing the contrast of the image with smaller dynamic range, wherein the original image is not clear enough due to uneven brightness distribution, and adopting global histogram equalization, the histogram of the original image can be converted into a uniformly distributed form, and the color information of the image is reserved, so that the effect of enhancing the integral contrast of the image is achieved;
the method specifically comprises the following steps:
S41, converting an image from an RGB channel to an HSV channel, and processing a V channel component to a range of [0,255 ];
Step S42, calculating the histogram distribution and frequency of V, calculating the cumulative distribution frequency of V, carrying out equalization treatment on the V channel component, and restoring to the range of [0,1], wherein the statistical frequency distribution formula and the equalization formula are as follows:
Wherein r k is the gray level number, M and N are the number of rows and columns of the number of pixel points, N k is the number of times the current gray value appears, L is the maximum gray level number, and s k is the equalized gray level number;
Step S43, replacing the original V channel component with the equalized V channel component, converting the image from the HSV space back to the RGB space, outputting the equalized image, and obtaining the globally equalized image as shown in FIG. 6.
S5, carrying out gray level processing on the enhanced image, further carrying out image edge detection by using a Gaussian-Laplace operator, wherein the convolution kernel size is 5 multiplied by 5, and then carrying out mean value filtering processing on noise in the range of 3 multiplied by 3 of the image;
the 5×5 discrete convolution kernel for the image edge detection operator with the gaussian-laplace operator is:
Because the Laplace operator has higher sensitivity to image noise, the image is firstly processed by Gaussian blur and then edge detection is carried out, so that better detection effect can be realized, the image obtained after edge detection by the LoG operator is shown in figure 7, and the image obtained by mean filtering and noise elimination is shown in figure 8.
S6, calculating the mean value and variance of brightness after mean value filtering, constructing threshold constraint to perform binarization processing on the image and selecting an ROI image of a region to be detected;
and calculating the mean value and variance of the brightness after mean value filtering, constructing a threshold constraint, setting the threshold as the sum of the mean value and the variance, performing binarization processing, and selecting an ROI image of the region to be detected as shown in figure 9.
And S7, carrying out lane line detection by using a Hough transform detection algorithm, classifying the detection result based on positive and negative slopes of the straight lines, filtering outliers, finding out the straight line endpoint with the farthest distance in each classification, carrying out straight line fitting, and drawing a lane line.
The method specifically comprises the following steps:
Step S71, detecting lane lines through a Hough change straight line detection algorithm to obtain a structural body with end point coordinate information stored, calculating the slope of each straight line, storing the slope in a vector k, and removing outlier slopes through outlier filtering;
step S72, the obtained slopes are respectively stored in two vectors according to positive and negative classifications, two endpoints with the farthest longitudinal distance are found by traversing the longitudinal coordinates of the endpoints, straight line fitting is carried out, lane lines are drawn, and a fitted lane line detection image is obtained as shown in FIG. 10.
It will be understood that the application has been described in terms of several embodiments, and that various changes and equivalents may be made to these features and embodiments by those skilled in the art without departing from the spirit and scope of the application. In addition, many modifications may be made to adapt a particular situation or material to the teachings of the application without departing from the essential scope thereof. Therefore, it is intended that the application not be limited to the particular embodiment disclosed, but that the application will include all embodiments falling within the scope of the appended claims.