How can I detect road lanes using Hough Transform?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I need to detect the two lines from the road lane using the Hough Transform like the image below. Any help is appreciated.
1 comentario
Adeel Ahmed
el 19 de Oct. de 2017
1- Convert the input RGB image (I) to the HSV space. You can use Matlab function rgb2hsv. Create a binary image B of same size (row and column) of RGB image. Set all the pixels in the B to 1. HSV, it is basically a different way to describe color than the classic RGB we are used to, you can learn more about it on Wikipedia. We will explain later why this conversion is necessary. 2- Remove the noise by applying Gaussian filter. This should also remove small artifacts and small particles. 3- Filter out (turn black, set to zero) any pixel (in the binary image) that is not the color of the lanes (in HSV space), in our case white or yellow. Because lines on road are marked with yellow or white color. (Remember Assignment-1 where you were asked to convert gray scale image into color image, you used for loop to go around each pixel). You should get a result as in Fig. 2. You will notice that HSV has allowed us to remove unwanted pixels with much more ease. We have to look to both Hue and Saturation of the pixel (which color it is and how intense the color is), giving us a room of adjustment for “value” (how dark it is). This setup allows us to handle shadows and lighting variations. To extract the yellow and white color you will need to study about HSV color space. Also have a look at this table (<http://www.rapidtables.com/convert/color/index.htm>) 4- Convert the input image I to the gray scale image Ig. Use the Canny edge detector to detect the edges. The Canny algorithm detects edges on a picture by looking for quick changes in color between a pixel and its neighbors, in this case between the white or yellow lane line and black pixels. Use the binary image B to remove all the edge pixels (set to zero) which are set to zero in I. 5- Now we define region of interest. Given the position and orientation of the camera, you know that the lanes will be located in the lower half of the image, usually in a trapezoid covering the bottom corners and the center. You don’t want your region to be too narrow and have the lines out of our region of interest. 6- Run Hough transform to detect lines on our image. What does Hough transform do? To summarize quickly, it allows us to easily extract all the lines passing through each of our edge points and group by similarity, thus grouping together the points that are roughly located on a same line. After the above step we will still get multiple lines, but we only want 2 distinct lines (to form the lane) for our car to drive in between. 7- Filter the lines that only have horizontal slopes. Based on value of slopes distinguish and group the lines into left lines and right lines. 8- Last step is to compute the linear regression of both groups and draw the results on your region of interest. Simply, linear regression is an attempt at finding the relationship between a group of points, so basically finding the line that passes at the closest possible distance from each point. This operation will allow you to fill the blanks in a dashed lane line.
Respuestas (1)
Ver también
Categorías
Más información sobre Automated Driving Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!