用于无人驾驶技术的车道线
Teaching a computer to see, has wide varieties of applications. In the context of a self driving car, on seeing the below picture, the car has to know where the lanes are, in order to navigate safely.
牛逼 eaching电脑看,具有广泛的品种的应用。 在自动驾驶汽车的背景下,看到下面的图片,汽车必须知道车道在哪里,才能安全地行驶。
We will look at a few techniques to find lane lines.
我们将看一些找到车道线的技术。
技术技巧 (Techniques)
- Color Thresholding 颜色阈值
- Region Masking 区域遮罩
- Canny Edge Detection 坎尼边缘检测
- Hough Transformation 霍夫变换
颜色阈值 (Color Thresholding)
A coloured image is made of a stack of 3 images, each corresponding to red, green and blue channels. The above image can be split into three separate images as shown below
彩色图像由3个图像的堆栈构成,每个图像对应于红色,绿色和蓝色通道。 上面的图像可以分为三个单独的图像,如下所示
An image is a matrix of pixels, whose values range from 0 (dark) to 255 (white).
图像是一个像素矩阵,其值的范围从0(暗)到255(白)。
Since lanes are white markings on the road, these can be identified, by filtering out pixels, whose values are less than a certain threshold. By choosing the right thresholds, the following output can be produced.
由于车道是道路上的白色标记,因此可以通过滤除值小于特定阈值的像素来识别这些标记。 通过选择正确的阈值,可以产生以下输出。
However, this does not fully solve our problem, because you can see other white spots in the image, that are not lanes.
但是,这不能完全解决我们的问题,因为 您会看到图像中的其他白色斑点,而不是车道 。
区域遮罩 (Region Masking)
Assuming the camera that took pictures of the road is mounted on a fixed position in the front of the car, the lane lines will always appear around a general region of the image. Applying that region of interest to the images (blue dotted region) , we are now able to eliminate non lane lines, as shown below.
假设为道路拍照的摄像机安装在汽车前部的固定位置,则车道线将始终出现在图像的整个区域周围。 将感兴趣的区域应用于图像(蓝色虚线区域),我们现在可以消除非泳道线,如下所示。
However, under varying lighting conditions (day, night, shade etc) and lane colours (yellow etc) , the two techniques we looked at so far, may fail to detect lanes. Hence the need for more sophisticated algorithms.
但是,在变化的光照条件(白天,夜晚,阴影等)和车道颜色(黄色等)下,到目前为止,我们看过的两种技术可能无法检测到车道 。 因此,需要更复杂的算法。
坎尼边缘检测 (Canny Edge Detection)
This techniques helps find edges of objects in an image.
此技术有助于查找图像中对象的边缘。
Since we are only interested in finding edges, we first convert the coloured image into a grayscale image, as shown below.
由于我们只对寻找边缘感兴趣,因此我们首先将彩色图像转换为灰度图像,如下所示。
An image is a mathematical function f(x , y) of pixels, so you can perform mathematical functions on it.
图像是像素的数学函数f(x,y),因此您可以在图像上执行数学函数。
The brightness of each pixel corresponds to the strength of the gradient at that point. We find edge pixels by tracing out the pixels that follow the strongest gradients. By identifying edges, we can more easily detect objects by their shape.
吨他亮度每个像素对应的在该点处的梯度的强度。 我们通过追踪遵循最强渐变的像素来找到边缘像素。 通过识别边缘,我们可以更轻松地通过物体的形状检测物体。
The output of applying canny edge detection algorithm, shows an image full of dots, that represent edges of lane lines as well as other objects.
应用Canny边缘检测算法的输出显示了一个 充满点 的 图像 ,这些 点 代表车道线 以及其他对象的 边缘 。
霍夫变换 (Hough Transformation)
Since we are interested in finding lane lines only, we can model a line, and then fit that line model to the assortment of dots, to detect lane lines. To make it easier to work with lots of dots, we use hough space.
小号因斯我们感兴趣的只是发现的车道线 ,我们可以模拟线,然后适应该行模型点的品种,以检测车道线。 为了使处理许多点更容易,我们使用了霍夫空间。
A point in image space represents a line in the hough space and vice versa. By using polar co-ordinates, a dot in image space is transformed (hough transformation) into sine curve in hough space.
图像空间中的点表示霍夫空间中的一条线,反之亦然。 通过使用极坐标,图像空间中的点被转换(霍夫变换)为霍夫空间中的正弦曲线。
After applying Hough transformation, on the canny edge detected image, and performing parameter tuning, we are now able to detect lanes, as shown below.
在应用Hough变换之后,在检测到的Canny边缘上执行了参数调整之后,我们现在可以检测到车道,如下所示。
结果:无人驾驶汽车在行动 (Results : Self Driving Car In Action)
Application of the above techniques resulted in the car accurately identifying lanes, as shown in the video below.
上述技术的应用使汽车能够准确识别车道,如下视频所示。
Even though my algorithm was able to detect lanes accurately in the above video, it might fail to detect lanes correctly in several other cases. Such cases could include a combination of different conditions, like lighting (day, night, shade), curves etc.
即使我的算法能够在上述视频中准确检测车道,但在其他几种情况下也可能无法正确检测车道。 这种情况可能包括不同条件的组合,例如照明(白天,黑夜,阴影),曲线等。
These short comings were addressed in the next article (see link below)
这些缺点在下一篇文章中得到了解决(请参见下面的链接)
The final video is the output of my ‘Finding Lane Lines Project’, of the Udacity self driving car nano-degree program.
最后的视频是我的“ Finding Lane Lines Project”(我的“ Finding Lane Lines Project”)的输出,它是Udacity无人驾驶汽车纳米级程序的输出。
Originally published at https://github.com.
最初发布在 https://github.com 。
翻译自: https://medium.com/swlh/4-techniques-self-driving-cars-can-use-to-find-lanes-fcb6dd06b633
用于无人驾驶技术的车道线