View Single Post
  #5   Spotlight this post!  
Unread 23-02-2012, 22:26
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Tracking Multiple Targets

To understand boundingBoxHeight and why you want it instead of imageHeight, you have to first understand what the bounding box is.
Now, particles can be any shape whatsoever, but National Instrument's IMAQ library (the library powering the FIRST image processing stuff) only worries about it's bounding rect. The image looks something like this:

The red circle is your particle, the red box is your bounding box, and the black box is your image. imageHeight is the height of the black box, which is always the same because you're getting it from the camera, which is why you should care about boundingBoxHeight instead; it's the height of the red box.

To use particleFilter, you need a CriteriaCollection. I don't have the code we used on me, but it would go something like this for a height filter:
Code:
CriteriaCollection cc = new CriteriaCollection();
cc.addCriteria(NIVision.MeasurementType.IMAQ_MT_BOUNDING_RECT_HEIGHT,min,max,outsideRange);
BinaryImage filteredImage = image.particleFilter(cc);
min and max are the minimum and maximum values for the range (floats), and outsideRange should be true if you want particles outside that range to pass, false if you want particles inside the range to pass.

You say that you changed the code to work with multiple targets. Can you provide this code?

And no, changing center_mass_y to boundingRectHeight would not be helpful. Height is independent of location, and you care about location, so height should not be what you're looking for.
Reply With Quote