Does anyone have or know of a program in labview that uses the camera to track distance???:] :ahh:

No, but if you know the height and angle of the camera from the ground, you can figure out the number of pixels between the target and the ground and use that as a scale (because you know the height of the target) to find the distance.

What you are going to want to do is find a modeling equation and then use that. The apparent size of the target and the distance have a relationship approximated by D=sqrt(k/A), where k is a constant and A is the apparent area of the target (in this case, in pixels). You will need to take a few data points of distance and area to find a good K value. It should be approximately constant throughout all data points. If it isn’t, the tracking color ranges are probably not catching all of the target in the current conditions, or the target is not pointed directly at the camera. This formula works best when the camera is near-level with the target.

Other possibilities include finding the angle the camera is pointing, and knowing the height of the target, use trigonometry to find an approximate distance.

Please take a little time to search before you post. Searching for camera distance yields this thread as the 6th result:

how to find distance using two color servo camera?

Thanks and good luck,

–Ryan