Detecting the vision target

What is the best way to detect the Vision target with the camera?

For last year, we were able to use the NIVision detect circle to find the posts.
So far, I have not been able to get the Vision Assistant to detect a rectangle.
Steps:


Acquire image -> extract Saturation plane -> binary threshold -> detect geometry (Rectangle, allow scaling, occlusion, and rotation)

What is the best way to detect the target?

The LV installation contains a new example for rectangular image processing. Additionally, there should soon be a white paper posted to the NI site that will explain a few approaches.

The most obvious approach is to use the rectangle fit function, but it is quite picky, expecting angles to be quite close to 90 degrees and lines to be quite straight. Distortion due to lens and position easily cause the rectangle definition to fail its requirements.

The example in LV is particle based, and scores the particles for rectangularity, aspect ratio, and edge strength. If they score above the limits, the position and distance are calculated.

If the paper doesn’t make it up soon, I’ll be happy to answer other questions.

Greg McKaskle

Is this example in the other languages? (C++, Java)
I don’t have the software installed and updated yet.

If the paper doesn’t make it up soon, I’ll be happy to answer other questions.

Greg McKaskle

Thank you very much.

EDIT:
Does the example depend on the lighting source being a certain color?
and does the distance calculation account for which target is seen (I would assume that it doesn’t)?

If your software guys are up for some heavy image processing, they can use the resources linked by davidthefat in this thread. They describe the Hough algorithm, which constructs a polygon from a series of points in an image. If you use an algorithm that can construct a polygon instead of looking for an ellipse or rectangle, you don’t have to worry as much about perspective distortion affecting detection, because even if you’re at an angle that makes the vision target look like a parallelogram instead of a rectangle, the algorithm will be able to tell that it’s there.

The new vision example has not yet been ported to java or c++.

Joe

Where is the code example in LV located? Having a hard time finding it.

It is located in Program Files\National Instruments\LabVIEW 2011\examples\FRC\vision and is called Rectangular Target Processing or something very similar. You can also find it using the Getting Started window’s Support tab and the Find FRC Examples button. And that is just a shortcut to the Help>>Find Examples and then scrolling to FRC Robotics. Finally, I believe the Tutorials tab includes one on integrating vision and it is based on the Rectangular Target code.

Greg McKaksle

Thanks for the information

I would try to find bounding boxes first, and then further analyze the target.