The RSSC competition for June is to build a robot that can find a power outlet and plug itself in. After a great deal of experimentation with laser based navigation systems, I decided t
o try using image recognition.
Here the two base images I took of the outlet in question:
is a free software package designed to use a webcam as part of a robotic vision system. So far it seems extremely easy to use. I have run it on my HP Laptop (2.4Ghz), my 2.4 GHz desktop and the computer that will actually be mounted on the robot, an old Toshiba Portege Celeron 600 with 192 Mb of ram. See my article about webcams for some details about different cameras. On the fast machines the Kinamax camera produces great images.
On the slower machine, the $5.99 Generic silver camera seems to actually do a bit better. On the faster machines I can consistently get 30fps with the full image pipeline. On the slower machine I am lucky to get 5 fps. Good thing this isn’t a race!
The processing pipeline I used consisted of the following:
- Negative:
This inverts all color values. I will want to end up with a white image to find the center of mass. Since the outlet is black this is a good first step.
- Flood Fill: Since there a re larger areas that have similiar colors that I want to ignore, flood fill will let me merge large areas into each other. I choose a tolerence of 121 and a size of 54. These were picked based on the first image and still produced good results on the second image.
- Color Filter: I use the color filter to remove anything that isn’t a fairly bright white. I use a RGB value of 235 +- 10. This removes everything that isn’t bright white.
- Circle finder: There may have been other objects that were black in the image (The lines on the maze or the eraser on the whiteboard.) Now I will just look for things that are circles. I choose a threshold of 1.5.
- Center of Mass: This is the useful bit. If everything has gone well, there are only two white circles left on the image. If I find the center of these, then I know where to point the robot.
You can see from the final images that these filters do a pretty good job. I am sure that there is a much faster and easier way to do this. Now I just have to build the chassis for the computer and webcam. I think it is time to break open the vex kits this time….
Here is a link to my .robo file outletfinder.txt You can either rename the extension to .robo or just open it from robo realm.