computer-visionnavigationrobotics

How to make a robot follow a line using its video camera


I'm trying to get a robot to identify a line on the ground and follow it.
I've searched the internet and found many examples of line following robots, but all of them are using specialized sensors to detect the line.
I'd like to use the camera on the robot for that purpose.

I'm new to the field of computer vision, so I'd like some advice on how to approach the problem. Specifically, how can I detect the line and its angle/direction in relation to the robot? How can I detect turns?

Update following nikies comment:
How the line looks is up to me, i was thinking to put some bright colored tape on the ground, but i can use whatever is easiest...
The camera can take both color and b&w image.
Lighting and location may vary but i'll worry about it later, i just want to know what to look for to get started. Is there a "common" way to do it ?


Solution

  • Here's one approach, suitable for refinement.

    Through a combination of zooming, a pixellation filter, and thresholding, reduce the camera input to a 3 by 3 grid of white or black squares. With suitable adjustment, the reduction should be able to blow up the line such that it takes up exactly three of the reduced pixels. The robot's logic then consists of moving in one of eight directions to keep the center pixel black.

    The image after reduction:

    ☐ ■ ☐
    ☐ ■ ☐ ↑ move forward one unit
    ☐ ■ ☐
    

    What a left turn looks like:

    ☐ ☐ ☐
    ■ ■ ☐ ← turn 90 degrees left
    ☐ ■ ☐
    

    This is a very simple scheme, and converting the video input to a clean 3 by 3 grid isn't a trivial task, but it should be enough to get you moving in the right direction.