View Single Post
  #3   Spotlight this post!  
Unread 01-11-2013, 09:33 PM
sarangmittal's Avatar
sarangmittal sarangmittal is offline
Registered User
FRC #1683 (Techno Titans)
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Atlanta GA
Posts: 20
sarangmittal is an unknown quantity at this point
Re: Camera Tracking help please

In order to start to use the data that you get from the camera, I suggest finding the corners of the targets, which shouldn't be too hard.Then, use that to find the center of the targets.

There was a white paper on this kinda thing last year, but I can't find it so I'll try and summarize

Once you find the center, there is some simple math you can do with pixels.
You should know the resolution of your camera and its FOV (as in the angle created by the left most point and the right most point the camera can see).

First, use the pixel value for the length or height of the target and compare it to the known length or height of the target to create a ratio of pixels to feet for that specific image. Once you have this, you can calculate the width of the camera image (resolution * feet/pixel). And since you know the FOV of the camera, you can calculate the direct distance from the camera to the center of the target. Then using the physical vertical distance from the camera to the center of the target, you can calculate the horizontal difference.

As for left/right movement, just compare the center pixel of the camera to where the center of the target is and adjust accordingly (assuming your camera is mounted in the middle of the robot).

I hope this helps, and if not, I can post our code from last year.
Reply With Quote