技巧集合
How Self Driving Cars perceive under adverse conditions!
无人驾驶汽车在不利条件下的感觉如何!
A Self driving car needs to perceive lane lines of different colours and under varying lighting conditions in order to detect lanes accurately. It should also know the lane curvature, apart from speed and car dynamics, to determine the steering angle necessary to stay in the lane.
一种自驾车需要不同颜色的感知车道线和下,以准确地检测车道不同的照明条件 。 除了速度和汽车动力学之外,还应该知道车道曲率 ,以确定留在车道上所需的转向角。
We will look at a few techniques, self-driving cars can use to find lane lines under such varying conditions.
我们将研究几种技术,自动驾驶汽车可以在这种变化的条件下查找车道线。
技巧 (Techniques)
- Colour Spaces 色彩空间
- Sobel Operator 索贝尔算子
- Radius Of Curvature 曲率半径
色彩空间 (Colour Spaces)
RGB colour space works well for images with white lanes. It has limitations with other coloured lanes. Lets explore other colour spaces like HSV (Hue, Saturation, Value) and HLS (Hue, Lightness, Saturation ) etc.
RGB色彩空间非常适合带有白色通道的图像。 它在其他彩色车道上有局限性。 让我们探索其他颜色空间,例如HSV(色相,饱和度,值)和HLS(色相,亮度,饱和度)等。
Hue represents colour that is independent of any change in brightness. Lightness and Value are different ways to measure lightness or darkness of a colour. Saturation is the measure of colourfulness.
色相表示与亮度变化无关的颜色。 亮度和价值是测量颜色的明暗度的不同方法。 饱和度是色彩度的量度。
Image with yellow lane lines was split into RGB and HLS as seen below.
带有黄色车道线的图像分为RGB和HLS,如下所示。
Only R,G and S channels show high pixel intensities corresponding to yellow lane lines. Blue channel has zero yellow pixel intensity.
仅R,G和S通道显示与黄色车道线相对应的高像素强度。 蓝色通道的黄色像素强度为零 。
By choosing the best channel and the right colour thresholds for that channel, we can now identify yellow lane lines more accurately, as seen below.
通过选择最佳通道和该通道的正确颜色阈值,我们现在可以更准确地识别黄色车道线,如下所示。
Yet, even S-channel was unable to detect yellow lane under the shaded area.
但是,即使是S通道也无法在阴影区域下检测到黄色车道 。
索贝尔算子 (Sobel Operator)
Since lanes lines are vertical, we can use gradients in a smarter way to detect steep edges that are more likely to be lanes.
由于车道线是垂直的,因此我们可以更智能地使用渐变来检测更可能是车道的陡峭边缘。
Applying the Sobel operator to an image is a way of taking the derivative of the image in the x or y direction
将Sobel运算符应用于图像是一种在x或y方向上获取图像导数的方法
By choosing the gradient in x direction (Sobel x operator) and adjusting the strength of this gradient, we can now find those parts of the lane, which could not be detected by S-Channel (in the earlier section), as seen below.
通过选择x方向上的渐变(Sobel x运算符)并调整该渐变的强度,我们现在可以找到车道的那些部分(S-Channel无法检测到)(在前面的部分中),如下所示。
We can now combine the pixels identified by each of the above techniques (Sobel x and S- Channel), to find yellow lane lines more accurately, under varying lighting conditions, as seen below.
现在,我们可以结合以上每种技术(Sobel x和S通道)识别的像素,以在变化的照明条件下更准确地找到黄色车道线,如下所示。
Even though our algorithm can now detect lanes of different colours and under different lighting conditions, it might still fail, when it encounters sudden curves.
即使我们的算法现在可以检测到不同颜色和在不同光照条件下的车道, 但是当遇到突然的弯道时 , 它仍然可能失败 。
曲率半径 (Radius Of Curvature)
The knowledge of lane curvature, is necessary for the car to stay in the lane. Perspective transform changes our perspective, to view the same scene from different view points and angles. Birds eye view, lets us fit a polynomial to the lane lines. We then extract lane curvatures from the polynomial.
车道曲率的知识对于汽车停留在车道上是必不可少的。 透视变换改变了我们的视角,从不同的视角和角度观看同一场景。 鸟瞰,让我们将多项式拟合到车道线。 然后,我们从多项式中提取车道曲率。
Plotting the histogram and finding the peaks in left and right halves of the above image, gives starting positions of left and right lanes as shown below.
绘制直方图并在上图的左右两边找到峰值,如下图所示,得出左右车道的起始位置。
滑动窗 (Sliding Windows)
Using the starting positions, and applying sliding window technique on the image, we are able to fit polynomial to the lane lines as shown below.
使用起始位置,并在图像上应用滑动窗口技术,我们能够将多项式拟合到车道线,如下所示。
车道中心的曲率半径和偏移 (Radius of Curvature and Offset from Lane Center)
Pixels were converted to meters and polynomial fit was recomputed to determine radius of curvature in meters, as seen below.
像素被转换为米,然后重新计算多项式拟合以确定以米为单位的曲率半径,如下所示。
结果 (Results)
Consecutive frames have lane lines at similar position. Hence, to find lane pixels in the next frame, we can search around the previously detected lane line positions with-in a certain margin.
连续框架的车道线位置相似。 因此,要查找下一帧中的车道像素,我们可以在一定距离内搜索先前检测到的车道线位置。
Application of the above techniques resulted in the car accurately identifying lanes of different colours (yellow and white), under varying lighting conditions (bright light and shaded areas) and at steep curves, as shown in the video below.
上述技术的应用使汽车能够在变化的照明条件(明亮的光线和阴影区域)和陡峭的弯道上准确识别不同颜色(黄色和白色)的车道 ,如以下视频所示。
The final video is the output of my ‘Advanced Lane Finding Project’, of the Udacity self driving car nano-degree program.
最后的视频是我的Udacity自动驾驶汽车纳米学位计划的“高级车道发现项目”的输出。
Originally published at https://github.com.
最初发布在 https://github.com 。
翻译自: https://medium.com/swlh/3-techniques-to-tackle-steep-turns-and-varying-light-conditions-342bfb0e9845
技巧集合