Color Tracking W/ CMUcam and MATLAB

14K246

Intro: Color Tracking W/ CMUcam and MATLAB

description of how to use my MATLAB code to get MATLAB to talk to a CMUcam to do simple color tracking.

STEP 1: How to Do Use the Code

connect the CMUcam to the computer via serial cable as mentioned inthe documentation (the grey serial adapter should be attached so that the ribbon cable sticks away from the camera).

connect the power to the white power socket on the CMUcam.

run the java GUI from their website to make sure the camera works
do a screen dump, click on a color you want to track (in the screen dump) click the color tab

write down the min and max color values (1st#=Redmin 2nd#=GreenMin 3rd#=BlueMin 4th#=RedMax 5th#=GreenMax 6th#=BlueMax)

Close the java GUI and open the MATLAB code (MATLABtoCMUcam.m) in the MATLAB mfile editor
change the Track Color (TC) values appropriately (format: Rmin Rmax Gmin Gmax Bmin Bmax)

change the COM# according to which COM port you're using to talk to your CMUcam (I was using a USB to Serial Adapter and it worked very well).

Run the program, you'll see 100 sets of coordinates stream down the screen, as you move your object around the coordinates will change.

NOTES: I attached the cmucam2 gui and manuals for your convenience. They were created by carnegie melon, not me, don't sue me. I didn't take that photo either. Only the MATLAB code was written by me. Not knowing matlab, I worked for a while to get the serial itnerface to work correctly and thought it would be helpful to others.

7 Comments

this looks kinda cool, but why the heck is this under nerf?
not sure, maybe cause I guess you could make a servo controlled nerfe gun that would track people/objects and shoot at them (I think there was a project like that on instructables)
Hello, I am facing a problem in connecting the USB to Serial cable, I can see that the camera is recognized bu laptop but it is not acknowledging that ? Do you have any suggestions?
make sure you're using a good serial to usb adapter, I used this one (IOGear USB 2.0 to Serial/PDA Converter Cable GUC232A):
http://www.amazon.com/IOGear-Serial-Converter-Cable-GUC232A/dp/B000067VB7/ref=sr_1_7?ie=UTF8&qid=1293730831&sr=8-7

but other ones might work too: use amazon and read the reviews of different models to make sure you buy a good one.
We tried to use a version of this camera for FIRST robotics, but failed miserably...
it's a great camera, nothing else like it. it's definately worth learning how to use. Can be interfaced with anything, PICs, computers, basicstamps, etc.