3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Color Tracking w/ CMUcam and MATLAB

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.
 
Remove these adsRemove these ads by Signing Up
 

Step 1How to do use the code

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.
« Previous StepDownload PDFView All StepsNext Step »
7 comments
Aug 26, 2010. 9:54 AMmikedude524 says:
this looks kinda cool, but why the heck is this under nerf?
Dec 30, 2010. 2:54 AMNatNoBrains says:
Exactly what I was thinking!

F
Mar 14, 2008. 5:35 AManas_11 says:
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?
Aug 27, 2006. 9:33 PMCueOminousMusic says:
We tried to use a version of this camera for FIRST robotics, but failed miserably...

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
80
Followers
40
Author:leevonk
www.leevonk.com