Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood
The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not
For limiting the application.
Method for detecting lane lines provided by the present application can be applied in application environment as shown in Figure 1.In this implementation
Example, by taking terminal 102 is car terminals as an example.Firstly, car terminals 102 acquire the original image of lane line, to the original image
Lane detection is carried out, fitting lane line is obtained, fitting lane line is shown, or make the control in car terminals 102
Device processed keeps stablizing smooth traveling according to fitting lane line traffic control automobile.In other embodiments, terminal 102 is also possible to and vapour
Vehicle terminal passes through network connection, for realizing the cloud server terminal of lane detection, and cloud server terminal is specially server.In addition, eventually
End 102 can also be any required equipment for realizing lane detection.
In one embodiment, as shown in Fig. 2, providing a kind of method for detecting lane lines, it is applied in Fig. 1 in this way
Terminal for be illustrated, comprising the following steps:
Image to be processed is converted to the color space including saturation degree channel and luminance channel, it is empty to obtain color by S202
Between image.
Wherein, color space is also referred to as color model (also known as color space or color system), (is usually made using a class value
With three, four value or color component) indicate color approach abstract mathematical model.In the present embodiment, color space is
Triple channel color space including saturation degree channel and luminance channel.For example, HSV (Hue, Saturation, Value) face
The colour space, wherein H refers to that tone, S refer to saturation degree, the brightness that V refers to;HLS (Hue, Saturation, Lightness/
Luminance) color space, wherein H refers to that tone, S refer to saturation degree, the brightness that L refers to.Color space image refers to
The image of the color space format obtained after converting to corresponding color space, such as HSV format-pattern, HLS format-pattern.
Specifically, the color vector of pixel is obtained according to image zooming-out to be processed, is counted by the color vector of pixel
Calculation obtains each channel value in corresponding color space, and each channel value includes saturation degree channel value and luminance channel value, by each channel value shape
At color space image.It, can be just by converting image to be processed to the color space including saturation degree channel and luminance channel
Processing is distinguished to yellow lane line and white lane line in subsequent, improves the accuracy of lane detection.
Further, image to be processed, which refers to, is acquired image obtained to lane line.In one embodiment, wait locate
Reason image can be the original image of acquisition;In another embodiment, image to be processed is also possible to carry out original image pre-
Treated image.Wherein, pretreatment includes but is not limited to any one or more of processing such as image denoising, normalization.And
The interference that tiny noise can be reduced by image denoising can convert the image into reference format by normalization, after being convenient for
Continuous processing.
When image to be processed is to carry out pretreated image to original image, image to be processed is converted to including full
With degree channel and luminance channel color space, obtain color space image the step of before, further includes: obtain acquisition lane line
Original image;Original image is pre-processed, image to be processed is obtained.It, can be with when being pre-processed to original image
Denoising purpose is realized using any one filtering method such as bilateral filtering algorithm, median filtering, gaussian filtering.
S204, saturation degree channel and luminance channel based on color space image, is filtered respectively, obtains color
The image segmentation information of spatial image, image segmentation information include: carry out that gradient direction filtering obtains to saturation degree channel the
One marginal information;Carry out the second edge information that horizontal direction filtering obtains respectively to saturation degree channel and luminance channel.
Specifically, gradient direction filtering is carried out to the saturation degree channel of color space image, obtains first edge information;It is right
The saturation degree channel of color space image and luminance channel carry out horizontal direction filtering respectively, obtain second edge information.Wherein,
Second edge information is by carrying out the first vertical edge information and lead to brightness that horizontal direction filtering obtains to saturation degree channel
Road carries out the second vertical edge information that horizontal direction filtering obtains and carries out step-by-step or handle to obtain.The mesh of step-by-step herein or processing
Be to make second edge information while carrying the first vertical edge information and the second vertical edge information.Wherein, marginal information is
The pixel value for referring to edge pixel point is nonzero value, and the pixel value of non-edge pixels point is zero picture element matrix.
In the present embodiment, by carrying out horizontal direction filtering to saturation degree channel, the yellow of vertical direction can be obtained
Marginal information (the first vertical edge information) can obtain vertical direction by carrying out horizontal direction filtering to luminance channel
White edge information (the second vertical edge information), and lane line generally includes white lane line and yellow lane line, by this
Processing is also obtained with white lane line marginal information and yellow lane line marginal information.
Specifically, the gradient calculating carried out when executing gradient direction and filtering will be realized by following formula (1), it may be assumed that
Wherein, (x, y) indicates the pixel coordinate of each pixel of color space image;F (x, y) indicates corresponding pixel points
Gray value;The gradient value of Grad expression corresponding pixel points.
When carrying out horizontal direction filtering processing, the filtering algorithm of use can be any achievable Vertical edge detection
Filtering algorithm, for example, Sobel filtering algorithm.
To carry out horizontal direction filtering to channel S and the channel V using Sobel, for obtaining second edge information, calculate
Formula is as follows:
Wherein, S indicates channel S value;SobelxSIt indicates to carry out the first vertical edge that horizontal direction filters to channel S
Edge information;V indicates V channel value;SobelxVIt indicates to carry out the second vertical edge information that horizontal direction filters to the channel V;
M1Indicate second edge information.
S206 determines lane line binary map based on image segmentation information.
Wherein, lane line binary map refers to the binary map including lane line marginal information.Specifically, believed according to first edge
Breath and second edge information determine lane line marginal information, generate lane line two-value based on identified lane line marginal information
Figure.More specifically, 1 is set by the gray value of the edge pixel point determined according to lane line marginal information, other pixels
Gray value is set as 0, generates lane line binary map.
S208 carries out curve fitting according to the effective pixel points in lane line binary map, obtains fitting lane line.
Specifically, according to preset curve matching rule, it is quasi- that curve is carried out to the effective pixel points in lane line binary map
It closes, determines lane line model, generate fitting lane line in lane line binary map according to lane line model.Wherein, lane line mould
Type refers to the function model of fitting lane line.
Above-mentioned method for detecting lane lines, by converting image to be processed to the face including saturation degree channel and luminance channel
The colour space obtains color space image, and saturation degree channel and luminance channel based on color space image are filtered place respectively
Reason, obtains the image segmentation information of color space image, wherein image segmentation information includes: to carry out gradient to saturation degree channel
The first edge information that trend pass filtering obtains;Carry out horizontal direction filtering obtains the respectively to saturation degree channel and luminance channel
Two marginal informations.And then the image segmentation information obtained based on multiple filter determines lane line binary map.Turned by color space
Change, then carry out the multiple filter of gradient direction and horizontal direction to saturation degree channel and luminance channel respectively, effectively filter out shade,
The edge of vehicle or other barriers, obtaining includes accurate lane line edge and the lane line binary map for interfering less with edge.Into
One step, it is carried out curve fitting based on the effective pixel points in the lane line binary map, effectively increases the standard of fitting lane line
True rate.
In one embodiment, the step of lane line binary map being determined based on image segmentation information, comprising: first edge is believed
Breath, second edge information carry out step-by-step and processing, determine lane line marginal information;According to lane line marginal information, lane is generated
Line binary map.
Specifically, the calculating for carrying out step-by-step and processing to first edge information, second edge information will pass through following formula
(3) it realizes, it may be assumed that
M=Grad&M1 (3)
Wherein, M indicates lane line marginal information.
In the present embodiment, it filters to obtain first edge information by the way that gradient direction will be carried out to saturation degree channel, and
Horizontal direction is carried out respectively to saturation degree channel and luminance channel respectively to filter to obtain the progress step-by-step of second edge information and operation,
So that the pixel value for only belonging to the pixel at edge after gradient filtering and horizontal filtering is nonzero value, namely by multiple
Filtering achieved the purpose that filter out irrelevant point, is only retained in the pixel that edge is belonged to after gradient filtering and horizontal filtering
Point is edge pixel point.For example, by step-by-step and processing filter out shade in image to be processed, vehicle, other barriers or its
The edge pixel point of his background object reduces the interference of environmental element to obtain accurate lane line marginal information.
In one embodiment, image segmentation information further include: the overall situation is carried out certainly to saturation degree channel and luminance channel respectively
Adapt to the mask area information that Threshold segmentation obtains.Wherein, mask area information is global adaptive by carrying out to saturation degree channel
The first sub- mask area information that Threshold segmentation obtains and global adaptive threshold fuzziness obtains is carried out to luminance channel the
Two sub- mask area informations carry out step-by-step or processing obtains.The purpose of step-by-step herein or processing is to make mask area information while taking
The sub- mask area information of band first and the second sub- mask area information.Wherein, mask area information, which refers to, belongs to masked areas
The pixel value of pixel is nonzero value, and the pixel value of the pixel of unmasked areas is zero picture element matrix.
Further, the saturation degree channel based on color space image and luminance channel, are filtered respectively, obtain
The step of image segmentation information of color space image, specifically further include: to the saturation degree channel of color space image and brightness
Channel carries out global adaptive threshold fuzziness respectively, obtains mask area information.
By carrying out global adaptive threshold fuzziness to saturation degree channel, yellow mask area information (first can be obtained
Sub- mask area information), by carrying out global adaptive threshold fuzziness to luminance channel, white mask area information can be obtained
(the second sub- mask area information), and lane line generally includes white lane line and yellow lane line, also can through this process
White lane line region and yellow lane line region are obtained to extract.
When carrying out global adaptive threshold fuzziness, the calculation formula of global adaptive threshold is as follows:
Wherein, g indicates the gray value of each tonal gradation of grey level histogram;H (g) indicates to belong to g in present image
The pixel quantity of gray level;Amount indicates pixel quantity summation;ThreshAvg indicates average gray value;Thresh indicates complete
Office's adaptive threshold.
The pixel that gray value is less than the threshold value can be filtered out by global adaptive threshold fuzziness, retains gray value and reaches
To the pixel of the threshold value, mask area information is obtained.
Assuming that MThresh-SIndicate the first sub- mask area information, MThresh-VIndicate the second sub- mask area information, then mask
Area information M2Acquisition can be calculated by the following formula:
M2=MThresh-S|MThresh-V (5)
Further, the step of lane line binary map being determined based on image segmentation information, comprising: to first edge information,
Second edge information and mask area information carry out step-by-step and processing, determine lane line marginal information;Believed according to lane line edge
Breath generates lane line binary map.
Specifically, the calculating of step-by-step and processing is carried out to first edge information, second edge information and mask area information
It will be realized by following formula (6), it may be assumed that
M=Grad&M1&M2 (6)
Referring to Fig. 9 (a), (b), wherein Fig. 9 (a) is when only carrying out global adaptive threshold fuzziness to color space image
Effect picture;Fig. 9 (b) is to the more of color space image progress gradient direction, horizontal direction and global adaptive threshold fuzziness
The effect picture filtered again.It will thus be seen that by the way that the mask area information of global adaptive threshold fuzziness and first edge are believed
Breath, second edge information carry out step-by-step and processing, have further filtered out the tiny vertical edge such as road surface top shadow, gap, have kept away
Its interference constituted to subsequent processing is exempted from.
Further, after determining lane line binary map based on image segmentation information, further includes: determine lane line binary map
In effective pixel points.Wherein, effective pixel points refer to the pixel that can be used for carrying out curve fitting.
In one embodiment, the step of determining the effective pixel points in lane line binary map, comprising: determine lane line two-value
Multiple sliding windows of lane line in figure;Using the non-zero pixels point in sliding window as effective pixel points.
Specifically, rule is determined according to sliding window, multiple sliding windows is generated in lane line binary map, make multiple cunnings
It include lane line in dynamic window.Further according to identified sliding window, the non-zero pixels point in sliding window is obtained, by non-zero picture
Vegetarian refreshments is as effective pixel points, to be carried out curve fitting using effective pixel points.
In another embodiment, as shown in figure 3, determine lane line binary map in effective pixel points the step of, including with
Lower sub-step:
S302 carries out perspective transform to lane line binary map, obtains birds-eye view.
Perspective transform refers to using the centre of perspectivity, picture point, the condition of target point three point on a straight line, makes to hold by chasles theorem
Shadow face (perspective plane) rotates a certain angle around trace (axis of homology), destroys original projected light harness, is still able to maintain on image-bearing surface
The constant transformation of perspective geometry figure.
In the present embodiment, lane line binary map is converted to by the birds-eye view overlooked under visual angle by perspective transform, namely
By the lane line binary map under former three-dimensional system of coordinate, the birds-eye view under two-dimensional coordinate system is converted to.Under birds-eye view, lane line base
This is in parastate, and lane line bending degree is than small in former lane line binary map, more convenient to be searched for using sliding window
With carry out curve fitting.
S304 determines multiple sliding windows of lane line in birds-eye view.
Specifically, rule is determined according to sliding window, multiple sliding windows is generated in birds-eye view, so that multiple sliding windows
It include lane line in mouthful.
S306, using the non-zero pixels point in sliding window as effective pixel points.As shown in Fig. 9 (d), (e), Fig. 9 (d) is
The schematic diagram of effective pixel points is searched in one embodiment by sliding window, Fig. 9 (e) is according to the effective picture determined in Fig. 9 (d)
Vegetarian refreshments carries out curve fitting, the schematic diagram of the fitting lane line of acquisition.
By the way that the perspective transform of lane line binary map at birds-eye view, is reduced the bending degree of lane line, more convenient for making
It is searched for sliding window and determines effective pixel points.
Further, referring to Fig. 4, the step of determining multiple sliding windows of lane line in birds-eye view, including following sub-step
It is rapid:
S402, be based on the corresponding pixel distribution histogram of birds-eye view, determine initial sliding window and with initial sliding window
The center of the first adjacent sliding window.
Pixel distribution histogram refers to the histogram for describing pixel distribution situation, specifically, pixel distribution histogram
Horizontal axis it is identical as the horizontal axis of birds-eye view pixel coordinate system, the axis of ordinates of pixel distribution histogram indicates non-
Zero pixel quantity.In the present embodiment, the corresponding pixel distribution histogram of birds-eye view refers to the picture of setting regions in birds-eye view
Plain distribution histogram.Setting regions can be specifically configured according to demand, be not limited thereto.For example, setting regions can be
The arbitrary region between 1/3 region~1/2 region below birds-eye view.It is the pixel point in an embodiment as shown in Fig. 9 (c)
Cloth histogram.
Specifically, the horizontal coordinate value where the corresponding pixel distribution histogram middle left and right peak value of birds-eye view is obtained, by this
Two horizontal coordinate values respectively as left and right lane line initial sliding window, while also by two horizontal coordinate values difference
Center as first sliding window adjacent with initial sliding window.Wherein, center refers in sliding window
Heart horizontal coordinate, initial sliding window refer to first sliding window on lane line, and adjacent with initial sliding window
Second sliding window on one sliding window actually lane line.
Pixel as where lane line all concentrates in x-axis (horizontal axis) a certain range, and picture one is divided
It is two, the position where the peak value of the right and left pixel distribution in x-axis is very likely to be exactly lane line basic point.It therefore, will be left
Horizontal coordinate value where the peak value of right both sides pixel distribution is sliding respectively as the initial sliding window of left and right lane line and first
The center of dynamic window.
S404 determines initial sliding window and the first sliding according to preset home window size and size change over rule
The size of window, using the first sliding window as current sliding window mouth.
Specifically, using preset home window size as the size of initial sliding window, further according to preset initial window
Mouth size and size change over rule determine that the size of the first sliding window is prolonged using the first sliding window as current sliding window mouth
Lane line extending direction continues growing sliding window.
Wherein, home window size and size change over rule are configured in advance, and home window size includes home window
Width and length, size change over rule include the width transformation rule and/or length transformation rule of window.For example, initial window
The width W of mouth0It can be configured to 200pix, the length of home window can be configured to 100pix.When size change over rule only includes window
When the width/height transformation rule of mouth, then the length/width of all sliding windows is all the length/width of home window.?
In one embodiment, the size that the width transformation rule of window further can be configured to newly-increased sliding window is slided than adjacent history
Window reduces fixed value Δ W (such as Δ W=5pix).
Certainly, in other embodiments, size change over rule is also configurable to constant rule, so that each sliding window
Size remains home window size constancy.
S406, according to the center of current sliding window mouth and the history sliding window adjacent with current sliding window mouth,
The non-zero pixels coordinate of current sliding window mouth determines the center of newly-increased sliding window.Wherein, under newly-increased sliding window refers to
One it needs to be determined that sliding window, history sliding window refers to the sliding window having determined.
Specifically, it is determined that the center of current sliding window mouth and the history sliding window adjacent with current sliding window mouth
Difference, current sliding window mouth non-zero pixels coordinate horizontal coordinate mean value, determine newly-increased sliding window based on the two numerical value
Center.
S408 determines the size of newly-increased sliding window according to the size of current sliding window mouth and size change over rule.
For example, when the size that size change over rule is newly-increased sliding window reduces fixed value than adjacent history sliding window
When Δ W, then the size W of sliding window is increased newlyi+1=Wi-ΔW.Wherein, WiIndicate i-th of sliding window (current sliding window mouth)
Size;Wi+1Indicate the size of i+1 sliding window (newly-increased sliding window).
S410 judges whether to meet termination condition.If so, terminating to determine multiple sliding windows of lane line in birds-eye view
Step;If it is not, executing step S412.
Wherein, termination condition can be sliding window total quantity and reach preset value, is also possible to newly-increased sliding window and reaches
The top margin of birds-eye view.
S412, using newly-increased sliding window as current sliding window mouth.Return to step S406.
When being unsatisfactory for termination condition, then using newly-increased sliding window as current sliding window mouth, continue to determine next cunning
Dynamic window, until meeting termination condition.
In another embodiment, when not carrying out perspective transform to lane line binary map, and lane line binary map is directly determined
When multiple sliding windows of middle lane line, then the birds-eye view in each step of embodiment illustrated in fig. 4 is replaced with into lane line binary map
, specific steps remain unchanged.
In one embodiment, it referring to Fig. 5, is slided according to current sliding window mouth and the history adjacent with current sliding window mouth
The center of window, current sliding window mouth non-zero pixels coordinate, the step of determining the center of newly-increased sliding window, packet
Include following sub-step:
S502 determines the non-zero pixels point in current sliding window mouth.
Wherein, non-zero pixels point refers to that gray value is the pixel of nonzero value.Due to birds-eye view and binary map, in the figure
Other than the edge pixel point determined according to lane line marginal information, the gray value of other pixels is zero.
In the present embodiment, according to the gray value of pixel each in current sliding window mouth, non-zero pixels point is determined, to obtain
The coordinate value of identified non-zero pixels point.
S504 obtains the horizontal coordinate mean value of non-zero pixels point.
Specifically, the horizontal coordinate value of non-zero pixels point determined by obtaining, each horizontal coordinate value is averaged, is obtained
The horizontal coordinate mean value of non-zero pixels point in current sliding window mouth.
S506, according to the center of current sliding window mouth and the history sliding window adjacent with current sliding window mouth it
Difference, the horizontal coordinate mean value of non-zero pixels point, the determining center with newly-increased sliding window.
Specifically, to the center of current sliding window mouth and the history sliding window adjacent with current sliding window mouth it
The horizontal coordinate mean value of poor, current sliding window mouth non-zero pixels coordinate is weighted summation, new by being used as obtained by weighted sum
Increase the center of sliding window.
It can specifically be realized by following formula:
Assuming that current sliding window mouth is i-th of sliding window, then i+1 sliding window is to increase sliding window newly, (i-1)-th
A sliding window is the history sliding window adjacent with i-th of sliding window.Wherein, xiIndicate the center of i-th of sliding window
Position;NiIndicate the horizontal coordinate mean value of the non-zero pixels coordinate of i-th of sliding window;N indicates the sliding on a lane line
Window total quantity;K indicates the horizontal coordinate value where the peak value of corresponding lane line pixel distribution;α indicates weight, specifically can basis
Empirical value is determined, and referring generally to the maximum deflection amplitude of lane line, bending amplitude is bigger, and α is bigger.Under normal conditions, α can
Default setting is 1.
Method is determined by the sliding window, it, can be to avoid because of cunning when the bending amplitude in lane line curved areas is larger
The sliding stride of dynamic window is insufficient, and sliding window is caused to deviate with normal lane line, and then produces lane line fitting result
The case where raw error;Sliding window can also be allowed to continue to search along lane line extending direction when local lane line lacks
Rope enhances the robustness of lane detection.
In one embodiment, it is carried out curve fitting according to the effective pixel points in lane line binary map, obtains fitting lane
The step of line, including following sub-step: according to preset curve matching rule, the valid pixel in lane line binary map is clicked through
Row curve matching determines current lane line model coefficient;According to current lane line model coefficient, fitting lane line is obtained.
Curve matching rule includes but is not limited to stochastical sampling consistency method, least square method.In the present embodiment, based on pre-
If curve matching rule, carry out curve fitting to the effective pixel points in lane line binary map, determine current lane line model
Coefficient obtains updated lane line model based on determining current lane line model coefficient, according to lane line model in lane
Fitting lane line is generated in line binary map.Wherein, current lane line model coefficient refers to and currently processed image pair to be processed
The coefficient for the lane line model answered.
In one embodiment, the effective pixel points in lane line binary map are carried out using stochastical sampling consistency method
Curve matching determines current lane line model coefficient.It carries out curve fitting by using stochastical sampling consistency method, due to only right
The key point of preset model is fitted, therefore can reduce noise jamming, is quickly obtained accurate current lane line model system
Number.
In another embodiment, it referring to Fig. 6, is carried out curve fitting, is obtained according to the effective pixel points in lane line binary map
The step of lane line must be fitted, including following sub-step:
S602 carries out curve fitting to the effective pixel points in lane line binary map according to preset curve matching rule,
Determine current lane line model coefficient.
S604 is smoothed according to current lane line model coefficient and history lane line model coefficient, will work as front truck
Diatom model coefficient is updated to the processing result of smoothing processing.
As described above, current lane line model coefficient refers to lane corresponding with currently processed image to be processed
The coefficient of line model;Accordingly, history lane line model coefficient refers in the n frame image before image to be processed, each frame
The coefficient of the corresponding lane line model of image, wherein the specific value of n can configure on demand.
In the present embodiment, smoothing processing includes exponential smoothing and Smoothing Prediction, and accordingly, processing result includes referring to
Number smooth value and Smoothing Prediction value.The validity for first determining whether current lane line model coefficient, when current lane line model
When coefficient is effective, exponential smoothing is carried out to current lane line model coefficient according to history lane line model coefficient, it is flat to obtain index
Sliding value;When the failure of current lane line model coefficient, Smoothing Prediction is carried out according to history lane line model coefficient, is referred to
Number smoothing prediction value.By current lane line model coefficient update to be obtained exponential smoothing value or Smoothing Prediction value.
S606 obtains fitting lane line according to updated current lane line model coefficient.
Updated lane line model is obtained based on updated lane line model coefficient, according to lane line model in lane
Fitting lane line is generated in line binary map.
In one embodiment, as shown in fig. 7, step S604 further comprises following sub-step:
S702 detects current lane line according to the first row pixel coordinate of lane line binary map and the second row pixel coordinate
The validity of model coefficient.When current lane line model coefficient is effective, step S704 is executed;When current lane line model coefficient
When failure, step S706 is executed.
Wherein, the first row pixel coordinate refers to the row pixel coordinate of the image apex of lane line binary map;Second row pixel
Coordinate refers to the row pixel coordinate of the image bottom end of lane line binary map.
Specifically, according to the first row pixel coordinate of lane line binary map and the second row pixel coordinate and current lane line mould
Type coefficient obtains radius of curvature, upper intercept and the lower intercept of current lane line model;When radius of curvature, upper intercept and lower intercept
When Arbitrary Term meets corresponding failure condition, determine that current lane line model coefficient fails;When radius of curvature, upper intercept and lower section
When away from corresponding failure condition is not satisfied, determine that current lane line model coefficient is effective.
Wherein, upper intercept refers to the fitting lane line obtained according to current lane line model coefficient cutting in image apex
Away from lower intercept, which refers to, is fitted lane line in the intercept of image bottom end according to what current lane line model coefficient obtained.To work as front truck
Road line model is x=ay2For+by+c, then current lane line model coefficient includes: a, b and c.Radius of curvature R are as follows:Upper intercept top_x are as follows: top_x=ay[0] 2+by[0]+c.Lower intercept bottom_x are as follows:
Bottom_x=ay[h-1] 2+by[h-1]+c.Wherein, y indicates that the row pixel coordinate in image, h indicate the pixels tall in image.
Accordingly, y[0]Indicate the first row pixel coordinate, y[h-1]Indicate the second row pixel coordinate.
In the present embodiment, the failure condition of radius of curvature are as follows: radius of curvature is less than curvature threshold, and curvature threshold is according to curved
Road maximum deflection amplitude is set.The failure condition of upper intercept are as follows: upper intercept of the current upper intercept with respect to previous frame image
Transformation amplitude be greater than first threshold.The failure condition of lower intercept are as follows: lower intercept of the current lower intercept with respect to previous frame image
Transformation amplitude be greater than second threshold.Wherein, first threshold and the specific value of second threshold can be configured respectively on demand,
This is not construed as limiting, for example, first threshold, which is configurable to 25%, second threshold, is configurable to 15% etc..
S704 carries out exponential smoothing to current lane line model coefficient according to history lane line model coefficient, obtains index
Current lane line model coefficient update is exponential smoothing value by smooth value.
Specifically, when current lane line model coefficient is effective, according to history lane line model coefficient to current lane line
Model coefficient carries out exponential smoothing, obtains exponential smoothing value and is realized by following formula:
Wherein, qtIndicate the exponential smoothing value at t frame moment;ptIndicate the lane line that the t frame moment is not smoothed
Model coefficient;qt-1Indicate the exponential smoothing value at t-1 frame moment;β is smoothing factor, and value is pre-configured with, and configuration range is
[0,1]。
S706 carries out Smoothing Prediction according to history lane line model coefficient, obtains Smoothing Prediction value, will be current
Lane line model coefficient is updated to Smoothing Prediction value.
Specifically, when current lane line model coefficient fails, exponential smoothing is carried out according to history lane line model coefficient
Prediction obtains Smoothing Prediction value and is realized by following formula:
Wherein,Indicate the Smoothing Prediction value at t frame moment;pt-1Indicate that the t-1 frame moment is not smoothed
Lane line model coefficient;qt-1Indicate the exponential smoothing value at t-1 frame moment.
Exponential smoothing or Smoothing Prediction are carried out by using history lane line model coefficient, to current lane line
Model coefficient is corrected, and can keep the duration and stability of the fitting lane line between sequential frame image.
Above-mentioned method for detecting lane lines, by being directly fitted to curve using effective pixel points, do not need to distinguish straight line with it is curved
Road lane line situation, so that subsequent coefficient correction update method is suitable for straight line and bend lane line situation simultaneously.Also, it is logical
It crosses using radius of curvature, upper intercept, lower intercept as principal element, it is accurate to determine not correct the current lane line mould before updating
Whether type coefficient is effective, and corrects current lane line model coefficient based on history lane line model coefficient, keeps sequential frame image
Between fitting lane line duration and stability.
Further, when effective pixel points be based on after perspective transform lane line binary map (birds-eye view) determine when,
According to updated current lane line model coefficient, after the step of obtaining fitting lane line, further includes: to fitting lane line into
Row inverse perspective mapping obtains final lane line.
Inverse perspective mapping is carried out by the way that lane line will be fitted, is converted into the final lane under original image same view angle
Line, to load on final lane line in original image.It is appreciated that being then fitted lane line when not carrying out perspective transform
As final lane line can directly load on fitting lane line in original image.As shown in Fig. 9 (f), for by final lane line
Load on the schematic diagram of original image.
In one embodiment, referring to Fig. 8, a kind of method for detecting lane lines is provided, method includes the following steps:
Image to be processed is converted to the color space including saturation degree channel and luminance channel, it is empty to obtain color by S801
Between image.
S802 carries out gradient direction filtering to the saturation degree channel of color space image, obtains first edge information.
S803 carries out horizontal direction filtering to the saturation degree channel of color space image and luminance channel respectively, obtains the
Two marginal informations.Wherein, second edge information includes the first vertical edge for carrying out horizontal direction filtering to saturation degree channel and obtaining
Edge information, and the second vertical edge information that horizontal direction filtering obtains is carried out to luminance channel, by by the first vertical edge
Edge information and the second vertical edge information carry out step-by-step or processing, can be obtained second edge information.
S804 carries out global adaptive threshold fuzziness to the saturation degree channel of color space image and luminance channel respectively,
Obtain mask area information.Wherein, mask area information includes: and carries out global adaptive threshold fuzziness to saturation degree channel to obtain
The first sub- mask area information, and the second sub- mask region that global adaptive threshold fuzziness obtains is carried out to luminance channel
Information can be obtained mask by the way that the first sub- mask area information and the second sub- mask area information are carried out step-by-step or processing
Area information.
S805 carries out step-by-step and processing to first edge information, second edge information and mask area information, determines lane
Line marginal information.
S806 generates lane line binary map according to lane line marginal information.
S807 carries out perspective transform to lane line binary map, obtains birds-eye view.
S808, be based on the corresponding pixel distribution histogram of birds-eye view, determine initial sliding window and with initial sliding window
The center of the first adjacent sliding window.
S809 determines initial sliding window and the first sliding according to preset home window size and size change over rule
The size of window, using the first sliding window as current sliding window mouth.
S810 determines the non-zero pixels point in current sliding window mouth.
S811 obtains the horizontal coordinate mean value of non-zero pixels point.
S812, according to the center of current sliding window mouth and the history sliding window adjacent with current sliding window mouth it
Difference, the horizontal coordinate mean value of non-zero pixels point, the determining center with newly-increased sliding window.
S813 determines the size of newly-increased sliding window according to the size of current sliding window mouth and size change over rule.
S814 judges whether to meet termination condition.If so, executing step S816;Otherwise, step S815 is executed.
S815, using newly-increased sliding window as current sliding window mouth.And return to step S810.
S816, using the non-zero pixels point in sliding window as effective pixel points.
S817 carries out curve fitting to effective pixel points, determines current lane line mould according to preset curve matching rule
Type coefficient.
S818 detects current lane line according to the first row pixel coordinate of lane line binary map and the second row pixel coordinate
The validity of model coefficient.When the failure of current lane line model coefficient, step S819 is executed;When current lane line model coefficient
When effective, step S820 is executed.
S819 carries out Smoothing Prediction according to history lane line model coefficient, obtains Smoothing Prediction value, will be current
Lane line model coefficient is updated to Smoothing Prediction value.
S820 carries out exponential smoothing to current lane line model coefficient according to history lane line model coefficient, obtains index
Current lane line model coefficient update is exponential smoothing value by smooth value.
S821 obtains fitting lane line according to updated current lane line model coefficient.
S822 carries out inverse perspective mapping to fitting lane line, obtains final lane line.
Above-mentioned method for detecting lane lines is handled by multiple filter and effectively filters out tiny perpendicular such as road surface top shadow, gap
Straight edge and other chaff interferent edges, obtaining includes accurate lane line edge and the lane line two-value for interfering less with edge
Figure.And by lane line binary map carry out perspective transform after, then using sliding window search for by the way of determine effective pixel points so that
, can be insufficient to avoid the sliding stride because of sliding window when bending amplitude in lane line curved areas is larger, lead to sliding window
It the case where mouthful deviateing with normal lane line, and then making lane line fitting result generation error, can also be in local lane line
When missing, sliding window is allowed to continue searching along lane line extending direction, enhances the robustness of lane detection.Using having
Effect pixel carries out curve fitting, and corrects current lane line model coefficient based on history lane line model coefficient, keeps continuous
The duration and stability of fitting lane line between frame image.
It should be understood that although each step in the flow chart of Fig. 2-8 is successively shown according to the instruction of arrow,
These steps are not that the inevitable sequence according to arrow instruction successively executes.Unless expressly stating otherwise herein, these steps
Execution there is no stringent sequences to limit, these steps can execute in other order.Moreover, at least one in Fig. 2-8
Part steps may include that perhaps these sub-steps of multiple stages or stage are not necessarily in synchronization to multiple sub-steps
Completion is executed, but can be executed at different times, the execution sequence in these sub-steps or stage is also not necessarily successively
It carries out, but can be at least part of the sub-step or stage of other steps or other steps in turn or alternately
It executes.
In one embodiment, as shown in Figure 10, a kind of lane detection device 1000 is provided, comprising: conversion process
Module 1002, filtering processing module 1004, binary map determining module 1006 and process of fitting treatment module 1008, in which:
Conversion processing module 1002 obtains color space image, color for converting image to be processed to color space
Space includes saturation degree channel and luminance channel.
Be filtered module 1004, for based on color space image saturation degree channel and luminance channel, carry out respectively
Filtering processing, obtains the image segmentation information of color space image, and image segmentation information includes: to carry out gradient to saturation degree channel
The first edge information that trend pass filtering obtains;Carry out horizontal direction filtering obtains the respectively to saturation degree channel and luminance channel
Two marginal informations.
Binary map determining module 1006, for determining lane line binary map based on image segmentation information.
Process of fitting treatment module 1008 is obtained for being carried out curve fitting according to the effective pixel points in lane line binary map
It is fitted lane line.
Above-mentioned lane detection device carries out ladder to saturation degree channel and luminance channel respectively by color space conversion
The multiple filter for spending direction and horizontal direction effectively filters out the edge of shade, vehicle or other barriers, and obtaining includes accurate vehicle
Diatom edge and the lane line binary map for interfering less with edge.Further, based on the effective pixel points in lane line binary map
It carries out curve fitting, improves the accuracy rate of fitting lane line.
In one embodiment, binary map determining module 1006 is also used to carry out first edge information, second edge information
Step-by-step and processing, determine lane line marginal information;According to lane line marginal information, lane line binary map is generated.
In another embodiment, image segmentation information further include: saturation degree channel and luminance channel are carried out respectively global
The mask area information that adaptive threshold fuzziness obtains.Binary map determining module 1006 is also used to first edge information, second
Marginal information and mask area information carry out step-by-step and processing, determine lane line marginal information;It is raw according to lane line marginal information
At lane line binary map.
In one embodiment, lane detection device further includes effective pixel points determining module, for determining lane line two
The effective pixel points being worth in figure.
Further, effective pixel points determining module includes: perspective transform module, sliding window determining module and effective picture
Vegetarian refreshments determines submodule.Wherein, perspective transform module obtains birds-eye view for carrying out perspective transform to lane line binary map;It is sliding
Dynamic window determining module, for determining multiple sliding windows of lane line in birds-eye view;Effective pixel points determine submodule, are used for
Using the non-zero pixels point in sliding window as effective pixel points.
In one embodiment, sliding window determining module include: center determining module, window size determining module and
Current window determining module.
Wherein, center determining module determines initial sliding for being based on the corresponding pixel distribution histogram of birds-eye view
The center of window and first sliding window adjacent with initial sliding window;Window size determining module, for according to pre-
If home window size and size change over rule, determine the size of initial sliding window and the first sliding window;Current window
Determining module, for using the first sliding window as current sliding window mouth.
Further, center determining module, be also used to according to current sliding window mouth and with current sliding window mouth phase
The center of adjacent history sliding window, current sliding window mouth non-zero pixels coordinate, determine the center of newly-increased sliding window
Position;Window size determining module is also used to size and the size change over rule according to current sliding window mouth, determines newly-increased sliding
The size of window;Current window determining module is also used to using newly-increased sliding window as current sliding window mouth.
In one embodiment, center determining module includes: non-zero pixels point determining module, coordinate mean value acquisition module
Submodule is determined with center.Wherein, non-zero pixels point determining module, for determining the non-zero pixels in current sliding window mouth
Point;Coordinate mean value obtains module, for obtaining the horizontal coordinate mean value of non-zero pixels point;Center determines submodule, is used for
According to current sliding window mouth and and the adjacent history sliding window of current sliding window mouth the difference of center, non-zero pixels point
Horizontal coordinate mean value, the determining center with newly-increased sliding window.
In one embodiment, process of fitting treatment module includes: current coefficient determining module, coefficient updating module and fitting submodule
Block.Wherein, current coefficient determining module, for regular according to preset curve matching, to effective picture in lane line binary map
Vegetarian refreshments carries out curve fitting, and determines current lane line model coefficient;Coefficient updating module, for according to current lane line model system
Several and history lane line model coefficient is smoothed, and is the processing knot of smoothing processing by current lane line model coefficient update
Fruit;It is fitted submodule, for obtaining fitting lane line according to updated current lane line model coefficient.
Further, coefficient updating module further includes validation checking module, exponential smoothing module and Smoothing Prediction
Module.Wherein, validation checking module, for according to the first row pixel coordinate of lane line binary map and the second row pixel seat
Mark detects the validity of current lane line model coefficient;Exponential smoothing module is used for when current lane line model coefficient is effective,
Exponential smoothing is carried out to current lane line model coefficient according to history lane line model coefficient, obtains exponential smoothing value, it will be current
Lane line model coefficient is updated to exponential smoothing value;Smoothing Prediction module, for failing when current lane line model coefficient
When, Smoothing Prediction is carried out according to history lane line model coefficient, Smoothing Prediction value is obtained, by current lane line model
Coefficient update is Smoothing Prediction value.
Above-mentioned lane detection device is handled by multiple filter and effectively filters out tiny perpendicular such as road surface top shadow, gap
Straight edge and other chaff interferent edges, obtaining includes accurate lane line edge and the lane line two-value for interfering less with edge
Figure.And by lane line binary map carry out perspective transform after, then using sliding window search for by the way of determine effective pixel points so that
, can be insufficient to avoid the sliding stride because of sliding window when bending amplitude in lane line curved areas is larger, lead to sliding window
It the case where mouthful deviateing with normal lane line, and then making lane line fitting result generation error, can also be in local lane line
When missing, sliding window is allowed to continue searching along lane line extending direction, enhances the robustness of lane detection.Using having
Effect pixel carries out curve fitting, and corrects current lane line model coefficient based on history lane line model coefficient, keeps continuous
The duration and stability of fitting lane line between frame image.
Specific about lane detection device limits the restriction that may refer to above for method for detecting lane lines,
This is repeated no more.Modules in above-mentioned lane detection device can come fully or partially through software, hardware and combinations thereof
It realizes.Above-mentioned each module can be embedded in the form of hardware or independently of in the processor in computer equipment, can also be with software
Form is stored in the memory in computer equipment, executes the corresponding operation of the above modules in order to which processor calls.
In one embodiment, a kind of computer equipment is provided, which can be terminal, internal structure
Figure can be as shown in figure 11.The computer equipment includes the processor connected by system bus, memory, network interface, shows
Display screen and input unit.Wherein, the processor of the computer equipment is for providing calculating and control ability.The computer equipment
Memory includes non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system and computer
Program.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The meter
The network interface for calculating machine equipment is used to communicate with external terminal by network connection.When the computer program is executed by processor
To realize a kind of method for detecting lane lines.The display screen of the computer equipment can be liquid crystal display or electric ink is shown
Screen, the input unit of the computer equipment can be the touch layer covered on display screen, be also possible on computer equipment shell
Key, trace ball or the Trackpad of setting can also be external keyboard, Trackpad or mouse etc..
It will be understood by those skilled in the art that structure shown in Figure 11, only part relevant to application scheme
The block diagram of structure, does not constitute the restriction for the computer equipment being applied thereon to application scheme, and specific computer is set
Standby may include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of computer equipment, including memory and processor are provided, is stored in memory
The step of computer program, which realizes above-mentioned method for detecting lane lines when executing computer program.Lane line is examined herein
The step of survey method, can be the step in the method for detecting lane lines of above-mentioned each embodiment.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated
The step of machine program realizes above-mentioned method for detecting lane lines when being executed by processor.The step of method for detecting lane lines can be with herein
It is the step in the method for detecting lane lines of above-mentioned each embodiment.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer
In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein,
To any reference of memory, storage, database or other media used in each embodiment provided herein,
Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM
(PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include
Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms,
Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing
Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM
(RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment
In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance
Shield all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously
It cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art
It says, without departing from the concept of this application, various modifications and improvements can be made, these belong to the protection of the application
Range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.