Introduction: 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.


mikedude524 made it! (author)2010-08-26

this looks kinda cool, but why the heck is this under nerf?

NatNoBrains made it! (author)NatNoBrains2010-12-30

Exactly what I was thinking!


leevonk made it! (author)leevonk2010-12-30

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)

anas_11 made it! (author)2008-03-14

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?

leevonk made it! (author)leevonk2010-12-30

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):

but other ones might work too: use amazon and read the reviews of different models to make sure you buy a good one.

CueOminousMusic made it! (author)2006-08-27

We tried to use a version of this camera for FIRST robotics, but failed miserably...

leevonk made it! (author)leevonk2006-09-17

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.

About This Instructable




More by leevonk:WolfPack: Large-Dog CarrierVortex-Drive Micro ROV (ROVVor)Squintasaurus: cybernetic dynamically adjustable vision enhancement system
Add instructable to: