Being able to see is greater than having sight. It's profound. Think about it.
Vision and Communication
In the pursuit of a robust vision algorithm, we experienced the reality of Murphy's Law. Indeed, the Legend of the Annihilated Vision Code was not a tall-tale for us. After having lost our developed vision code to Grendel, we started anew near deadline, implementing what we thought was our recreated code and advancing its development.
In the lost code was the communication code that we had perfectly developed, and after the loss, we never succeeded in restoring our fully functional communication between gumstix and Rabbit. Our vision algorithm was developed to segment 5 colors, using a Pose estimation algorithm. When we realized that the need for following a robot racer was eliminated, we changed to three LED colors.
In the process of developing vision, we needed to consider our options, considering our time constraints with our unexpected events:
Options for position estimation
- Write up your own objpose, using Dr Taylor's matlab code. I think this is quite difficult, and to me this code is hard to understand exactly what is happening. But it is probably the most reliable, but it also probably takes more processing power.
- Or you can use cvPosit, this is fairly easy to use, not too hard to understand, but it probably takes the most processing power, and probably isn't as accurate as Dr Tailor's algorithm. http://opencvlibrary.sourceforge.net/Posit
- Or you can use our method, it is a very easy and simple algorithm and I believe it is as accurate as you would need it, it uses very little processing power.
We tried all of the options above, The first was to hard and complicated for me, I bet if I looked at it longer I might be able to understand it, but it quite complicated. The second was working, but while I was working with cvPosit I noticed that we could make a very simple program with only three LEDs and that's why I chose the to do our new method. I explain our method on another page.
Color segmentation is fairly easy to understand. You just find all the pixels of a certain color, and the you find the average location.
At first we had five LEDs. Four of them were on the corners of a square, and we had one tall one in the center. If you are straight above the LEDs the red one appears to be in the center of all other LEDs. If you move the camera in a x/y direction the center red led appears to move away from the center, because it is taller than the
rest.
Now If you rotate the camera, in any direction , the LEDs move in the camera frame, but we noticed that the distance of the red LED from the center of the other LEDs stays the same. We noticed you can approximately find the location of the camera using this knowledge.
In the above picture: h = height of camera, hl= height of red LED, xp = difference between the x location of the red LED and the x position of the center of the other four LEDs, f = focal length, and xr = temp x variable. xr= xp*h/f; then x = xr*(h-hl)/hl; and x is the x location of the camera. You can also do the same thing for y. We noticed that you can also use just three LEDs instead of five, and put them in a line with the tall one in the center. You can also approximate h using similar triangles and the known distance between the purple and yellow LED.
To approximate h you use the known distance, Dpy, between the purple and yellow LED, and the distance, dpx and dpy, between their centers of mass in the camera picture. If Yx and Yy was the Center of Mass of the yellow LED and Px and Py was the purple then dpx= Yx-Px; and dpy=Yy-Py; dp = sqrt(dpx*dpx + dpy*dpy); then h= Dpy*f/dp;






