We try to detect lane lines on a running track (and with this information the upcoming direction).
We currently use the following (simplified) steps:
Binary: transform the input with a binary threshold
Cropped: crop the region of interest (currently just the lower half of the image)
Canny: detect edges and group them with HoughLinesP
Upward Lines & Closing: only keep lines with an extreme slope - ignore horizontal lines
Result: find connected components and fit quadratic function through each line
This works in general (examples: straight.png, left.png) but has issues if for example a horizontal connection line wasn't removed (example: problems.png - bottom right & bottom left). In such a case the two lines and the connection get interpreted as one connected component.
As our point of view can tilt a lot from left to right (camera mounted on a running person) it is quite hard to define a slope threshold for upwards pointing lines.
Is there a better way to get rid of non upwards pointing track lines? As the current solution with canny, hough transform and slope filtering is not optimal for curves and sometimes doesn't work at all (as described above).
Would it be possible to get from the cropped image straight to the separated lines through morphology operations? Similar to this example. I know we have no strict horizontal lines which makes any fitting kernel a lot more complex (I assume).
Currently, we try to use perspective transformations to get a bird view on the track. This should help to distinguish between horizontal and upward pointing lines.
Another small issue is too short lines which result in inaccurate approximated quadratic functions (most left line in problems.png and straight.png). This might be easily solvable (by requiring a minimal pixel count for a component to be counted as track line) and should not be part of this question.
EDIT (answer questions from vlad_tepesch)
What is with the curves? should they be part of your lane models or not?
We clearly want to detect curves of the running track - as this is needed for the direction estimation. But we want to ignore (remove) the horizontal connection curve on the bottom of the problems.png example.
4./6. rectification - camera distortion
I will take another look at rectification, until now I postponed it, as I thought it isn't that important.
7.3 how many pixel if overlap between segments is ignored (group pixel count)
Just draw all lines from a group and check the non zero pixel count?
10. lanes normally are not quadratic - look int clothoids instead - this may overkill so may be use a 3rd order polynomial instead
I get your point. Clothoids are out of scope at the moment, but I will keep them in mind. How would you go with the direction estimation if we use more complex fitting? Currently we just take the first coefficient of the 2nd oder polynomial to estimate the bending direction (and the degree of curvature to differentiate between curves and straight parts).
optional more advanced
Good point, we already thought about averaging results over multiple frames. I also keep that proposal in the back of my mind.
Straight
Left
Problems
This function grabs 4 points on the lane image that encompass the lane, and warps it onto a flat plane, transforming our perspective of the road to a bird's eye view. The following is an example of some test images warped and filtered to show only their lane lines. Note how the lane curvature corresponds to its original image.
Also Region of Interest assumes that camera stays at same location and lanes are flat. So there is “guess” work or hard coding involved in deciding polygon vertices. In general, there are many roads which might not be with lane markings where this won’t work.
Retrieve Hough lines. Consolidate and extrapolate the Hough lines and draw them on original image. Converting original image to grayscale has its benefit. We have to find yellow and white lanes , and converting original image to grayscale increases the contrast of lanes with respect to road.
Instead of line , it would be beneficial to use higher degree curve that will be useful on curved road. Even when we used information from previous frames, just averaging lanes might not be very good strategy. may be weight average or some form of priority value might work.
It seems that your real problem is the filtering and the connecting step. because you filter out a lot of horizontal components, then for connecting of the unfiltered nearly vertical lines only sub optimal segments are left.
What is with the curves? should they be part of your lane models or not? At first I assume not, but it only has some influence during the grouping stage.
I would suggest the following steps
optional more advanced
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With