View Single Post
  #3   Spotlight this post!  
Unread 12-01-2012, 22:32
shoffing's Avatar
shoffing shoffing is offline
WINriver C++
AKA: Steve Hoffing
FRC #1647
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Shamong, New Jersey, America
Posts: 10
shoffing is an unknown quantity at this point
Re: Tracking in JAVA?

So I've been messing around with it for a bit and so far all I managed to get is this:

Code:
try {
    ColorImage img = camera.getImage();

    // Do the threshold
    BinaryImage bImg = img.thresholdHSL(0, 255, 0, 20, 239, 255);

    //Do convex hull???

    for(int i = 0; i < bImg.getNumberParticles(); i++)
    {
        ParticleAnalysisReport report = bImg.getParticleAnalysisReport(i);

        // Identify the vision targets in here using the reports
    }

    // Work with the vision targets

} catch (AxisCameraException ex) {
    ex.printStackTrace();
} catch (NIVisionException ex) {
    ex.printStackTrace();
}
But the binary image needs to be modified before it gets the particle analysis report. More specifically, a convex hull operation needs to be used to turn the hollow rectangles into filled ones (and ensuring they only show up as single particles instead of potentially multiple). At least, that's what it says to do in the Vision Tracking PDF. However, functionality of the convex hull operation appears to have not been implemented, I found this line in NIVision.java, line 521:

Code:
//IMAQ_FUNC int           IMAQ_STDCALL imaqConvexHull(Image* dest, Image* source, int connectivity8);
That's the function I want! But it's commented out! Why? Does anybody know of any ways to do a convex hull operation in java? Or is there a work around?

This is the first year our team is attempting camera tracking, by the way.

http://www.wbrobotics.com/javadoc/ed...e-summary.html
__________________
---
Team 1647's Software "thing" for 2011
Death-Spin autonomous mode is my favorite.
Reply With Quote