opencvcomputer-visionraspberry-pisimplecv

Computer Vision, Detecting roads, where to start?


I am an EE undergrad, I am working on a project that requires me to detect roads (primarily the turns). The requirement is that, given the GPS coordinates and directions of the turns, the robot should be able to navigate it's way to a given point. The problem is that the GPS coordinates are very inaccurate and roads aren't always straight. So I will have to detect the sides of the road and navigate my robot accordingly.

I am thinking mounting two cameras on either sides of the robot. Which would normally be used to keep the robot in the center of the road and when robot is withing 5 meters of the turn, one of the camera would guide it through the turn.

I will be working on raspberry pi, but for testing purposes i have installed simplecv and opencv on my laptop running Ubuntu. I have absolutely no prior experience with computer vision. I have no idea where to start. Could someone please guide me through the algorithm for achieving the above mentioned task? Should I be working with simplecv or opencv? Python or C++? Personally i like the simplecv on python, but I have no idea if it is capable of achieving the task.

Any help would be appreciated. Put me on the right track!

I will be demoing the project on campus, here the pictures of the campus's roads.

Edit: Ideal conditions, No traffic, No obstacles. Constant road width.


Solution

  • A suggestion, that I think will work, so give it a shot. The 4 images I will be using are in reference from "OpenCV 2 Computer Vision Application Programming Cookbook" by Robert Laganiere. This was one of the books I used for studying image processing, and there was a similar example on road using HoughLine.

    I used HoughLine before, but not on roads. So to give u better idea, here it is=>

    The original image is as seen:

    enter image description here

    Now u can apply Canny to the image, and it will look like this:

    enter image description here

    OR u can use Sobel too...

    enter image description here

    After which, u apply HoughLine:

    enter image description here

    You will have to adjust the parameters yourself.

    So here is my suggestion=>

    Put a front camera, slightly low enough to be able to detect the lanes up to a few metres, you can use ROI too(Region of Interest) to focus on the bottom half of the video where the lanes are most likely to be. This is to eliminate noise, where other objects parallel to the road is detected as well.

    You make the robot stay in the centre both the detected road lines. And another usage of the ROI is that one side of the line disappear,means that it is moving sightly slanted. You can adjust the robot to go back right on track.

    When there is a turn, you can specify that if the lines(maybe through canny operator) is no longer vertical, do a turn till the lines are vertical again.

    Of course, you will have to write two different functions to check whether to do a right turn or a left turn based on the angle of the lines.

    This is how I would tackle the problem. My method should have pretty decent results. The only problem you may face is adjusting the parameters of Houghlines and Canny.

    (P.S. In viewing your pictures, I notice the side of the road kerb have gaps once in a while. So I would recommend HoughLineP instead of HoughLine where you can specify the maximum gap between each line to consider it a line, if I do remember correctly. If that still doesn't work, you may need to do some pre-processing on the frames of the video.)

    Hope you find my method useful. Good Luck. If there is anything else you may need help with, comment on this answer, I try my best to help(: