Visual Tracking Help

Hi this is are teams second year and are first time trying to use visual tracking we are using Java (Eclipse) and our camera is the LifeCam HD-3000. My goal is to be able to find the distance to the high goal that we will be trying to score in. I have tried using Grip but it doesn’t seem to have the capabilities to find the distance at the current stage in it development. Should I use OpenCV or some other visual tracking program. Any links to help get started would be appreciative.

Our Camera
https://www.microsoft.com/accessories/en-us/products/webcams/lifecam-hd-3000/t3h-00011

Thanks

We used a Kangaroo and OpenCV I believe… not sure if its working yet as we have had little practice with it… Seems though to recognize the goal and isolate it just fine.

Do you know if you can help me or send me instructions on how you have gotten OpenCV to work. The only instructions I can find are… but they are really old.
http://docs.opencv.org/2.4/doc/tutorials/introduction/java_eclipse/java_eclipse.html

I’ll send a message to a programmer and see if they can PM you.

Thanks a lot for your help.

No problem I sent the email, you should keep this thread going in case there are any other vision experts as this was our first year with trying to aim with tracking too. I hope it works (have yet to see it though due to lack of practice).

We’ll know Thursday. I’m sure he can get you started though.

My team has been able to track both distance and angle to the target pretty reliably based off of GRIP. Search Tower Tracker from the programming subforum, we based our math off of that, but we used GRIP to find the contours.

I will look into this for sure I know how to use GRIP but didn’t know it was feasible. I’ll check back if I have any questions.

Once I have the conturs what do I do with them send them to the smartdash board or the driver station or do I have to integrate it into my code first?

Does anyone know how after I find the counters and send them to the driver station and the smart dashboard then how I can find the distance.

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.

I am trying to track the front one mostly. I am tracking the area, width, and height the pixels of the tower then would be 1500 pixels. My camera resolution is 720p HD. Don’t know then where to go from there.

of the whole tower? or just the goal target?

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.

Height of target is = 7ft 1in
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-00001-LifeCam-HD-3000/dp/B004ETQHDM

Just the goal target width.

I think you would benefit from reading some of the existing CD threads on this subject, starting with:

I don’t want to use OpenCV really if I can avoid it. I want to try and get it to work with grip like some of the other users.

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.