Log in

View Full Version : Anyone able to track targets?


bakerjohn42
17-01-2012, 23:24
Has anyone had their robot track a target using a camera yet? if so, could you tell me what you called in your code to do so.

JewishDan18
17-01-2012, 23:27
I have. I threshold the image and get the particles analysis reports, and do some math on them to determine the location of any targets in the image (you need to first determine which ones are rectangles, then figure out their location). I changed a bunch of the WPILib code to suit my needs, but that's the basic idea. I hope sample code is released soon, so I can see how my results compare.

youxinche95
17-01-2012, 23:57
Correct, you getImage().thresholdHSL(bla,bla,bla,bla,bla,bla)

then you take that binary image and getParticles or something like that...

Those particles give you the essentially the loops.

NOTE! the threshold is set to the color of the color hoop, so the binaryimage will only be on if it fits those requirements.

Good luck!

Robby Unruh
18-01-2012, 00:09
Yes, we have! In fact, there's a really good example (http://firstforge.wpi.edu/sf/go/doc1209) on FIRST Forge to find reflective tape (or other?). It's one of the coolest thing's I've worked with to date, for sure. I couldn't be more excited about it.

Correct, you getImage().thresholdHSL(bla,bla,bla,bla,bla,bla)

then you take that binary image and getParticles or something like that...

Those particles give you the essentially the loops.

NOTE! the threshold is set to the color of the color hoop, so the binaryimage will only be on if it fits those requirements.

Good luck!

Sidenote: You can get these "bla bla bla" arguments from the NI Vision Assistant. Simply run an HSL threshold over your image (after acquiring one, of course) and mess with the cool sliders until it's only seeing the tape.

xmendude217
23-01-2012, 20:18
what is supposed to be done to the image after it's processed?

nickpeq
23-01-2012, 22:42
Has anyone had their robot track a target using a camera yet? if so, could you tell me what you called in your code to do so.

We just got our robot tracking today, using the new sample.
Still gotta work on a good PID though; the robot is too eager to center on the target and goes crazy. :p
Also, with the camera overexposed (I think it's technically a very low exposure...), it likes to change colors on me every time it restarts. -_- So, for now, I keep having to adjust the color criteria. However, switching to HSL criteria, instead of RGB, helped significantly. The hue is very constant for the target.

sng
29-01-2012, 01:42
Does the cRio have enough horsepower to track the targets? We're finding it takes about a second to analyze each image, but maybe we are doing something wrong....

Greg McKaskle
29-01-2012, 08:30
What is the resolution of the camera?

Greg McKaskle