|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: Visual Tracking Help
depends what you mean by 'distance' (which side of the target tracking triangle are you looking for). also, depends on what values you're calculating from the image and how you're calculating the angle to target.
the most general way to explain it is that you know how wide the target is (20 inches). you also know how wide the resolution is for the camera (that depends on the camera you are using and how it's set up). same with the field of view, as that's camera dependent. you can convert how wide the target is in pixels in your camera image to a distance to that target in inches by doing the trigonometry and using the pixels to inches conversion by keeping in mind that the target is 20 inches wide. that's probably a bit too ambiguous of an answer, but the specifics depend on how you're initially processing the image and calculating that angle to target. |
|
#2
|
|||
|
|||
|
Re: Visual Tracking Help
Quote:
|
|
#3
|
|||||
|
|||||
|
Re: Visual Tracking Help
of the whole tower? or just the goal target?
|
|
#4
|
|||||
|
|||||
|
Re: Visual Tracking Help
If you know the vertical pixel position of the target in your camera image and the vertical field of view of the camera in both pixels and degrees, you can compute the vertical angle from the camera to the target.
If you know the vertical angle to the target, the height of the target, and the height of the camera, you can compute both the horizontal distance to a point directly beneath the target and the straight-line diagonal distance to the target. The vertical field of view of the camera in pixels is a constant (720 pixels for a 720p image). The field of view in degrees is also a constant that you can measure. The height of the target is a constant, defined in the field drawings. The height of the camera is something you can define for yourself. Once you have the location of the target in the image, finding distance is a matter of simple trigonometry. |
|
#5
|
|||
|
|||
|
Re: Visual Tracking Help
Quote:
Height of camera is = 7in How do I find the vertical angle to the target and the vertical field of view of the camera in pixels. The camera says that its is a 16:9 widescreen I don't know if that the field of view in degrees or what is. Sorry I'm brand new to this Link to camera info is http://www.amazon.com/Microsoft-T3H-.../dp/B004ETQHDM |
|
#6
|
|||
|
|||
|
Re: Visual Tracking Help
Just the goal target width.
|
|
#7
|
|||
|
|||
|
Re: Visual Tracking Help
I think you would benefit from reading some of the existing CD threads on this subject, starting with:
http://www.chiefdelphi.com/forums/sh...hreadid=144809 |
|
#8
|
|||
|
|||
|
Re: Visual Tracking Help
Quote:
|
|
#9
|
|||
|
|||
|
Re: Visual Tracking Help
Understood...but the math is the same no matter where you get your measurements. We do all (or most of) the math in our robot code, reading values from NetworkTables which be populated by GRIP on the driver station, GRIP on the roborio, or our opencv-based tracker on a raspberry pi.
You need to separate out the problem and focus on the parts separately. GRIP won't tell you distance--but neither will OpenCV. Both will tell you height, width, center X and center Y. You will need to determine the distance to the target based on those inputs, as described in the linked thread. Last edited by BenBernard : 29-02-2016 at 15:39. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|