View Single Post
  #7   Spotlight this post!  
Unread 22-06-2012, 19:56
daniel_dsouza daniel_dsouza is offline
does what needs to be done.
FRC #2449 (Out of Orbit Robotics)
Team Role: Alumni
 
Join Date: May 2011
Rookie Year: 2011
Location: Chandler, AZ
Posts: 231
daniel_dsouza has a spectacular aura aboutdaniel_dsouza has a spectacular aura about
Re: Vision Tracking Tutorial

Quote:
Originally Posted by RyanN View Post
Ahah! So that's what they want you to figure out. Look at what data is available to you. Isn't there a nice array of targets found? How about simpiy index the first array element. Now what does each element of the array hold? Well there is an X and Y coordinate. When you're centered on the target, x should read 0.
Depending on how you processed your image, you might just get the x,y of the pixel coordinates. So if this is the case, and you want a number -1<=x<=1, use this formula:

drivingValue = (pixelValue - (maxImageDimension / 2)) / (maxImageDimension/2)
where maxImageDimension is the size of that image axis.

That way, you can get an value between that could easily be plugged into an algorithm or speed controller. (ex. 640,480 turns to 1,-1)

Hopes this helps. Good luck tomorrow! (I Wish my team was doing something offseason)