Lane Detection

in #self-driving7 years ago (edited)

"Lane driving is sane driving"

We all have heard this saying, and if leave some exceptions like Uttar Pradesh in India (where a red light means green and green means wait, and Yellow means 'Bhaga sako to bhaga lo') normally people driving on road tend to follow lanes.

And so when we decided to make a self-driving car, the first step is detecting the lanes on the road. There can be many ways to detect lanes from colour, shape, orientation and even position on the road. In this post let us see the logic behind using the only colour as criteria and the issues therein.

The lanes on roads are mainly of two colours Yellow and White. So let us first see if we have to detect a lane in an image of the road how will we go about.
test.jpg

In the image above, the lane is white in colour. The images when in RGB format (three channel) are represented by a three-dimensional matrix, with one dimension each for the Red, Green and Blue Channel. The individual elements of the matrix can have an integral value from 0-255. with zero representing the black colour, and 255 representing the maximum intensity of the particular (channel) colour.

So one simple way is to define a threshold value for each channel and replace all the pixels in the original image with the value below threshold with zero. Here is the result, when the threshold value is chosen to be 220:
test-after.png

So what do we see:

  • First yep the lanes are detected (except the left distant road marking, since it is covered by shadow in the original image).
  • Beside the lanes our code also detects the horizon line.

This proves using only colour for lane detection is not sufficient we will need more information to even just detect the existing lanes on the road!!

Keep a watch on my future posts. You can subscribe me and also follow my Github. See you soon
Chao!

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 62948.49
ETH 2583.15
USDT 1.00
SBD 2.74