Thread: Convex Hull
View Single Post
  #2   Spotlight this post!  
Unread 01-02-2012, 14:24
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: Convex Hull

First, have a look at the vision whitepaper, it goes through the theory.

NI Vision Assistant is a useful tool for helping you get started (and for tuning your values). Use a web browser to connect to your camera and get a few sample images (stop the stream and right click->save image as) to load in the vision assistant. You can also generate code from vision assistant (make sure you change the c file to a cpp, and it will have errors to be fixed)
That should help you get good value ranges for filtering.

In code:
You use AxisCamera::GetInstance("10.te.am.11"); to get the camera
then create new color image and specify the appropriate color space (we used HSL, after having some issues with HSV) to put the image from the camera into.
The colorImage has a number of filter methods (we again used HSL) which will return a binary image to you.

Then you use the binary image, and typically do a convex hull and particle filter (these are the parts we used from the generated C code from vision assistant), once all that is done, you can get the particle analysis data for each blob your algorithm found, and get some useful data from it such as it's center of mass to determine how you want to aim.


If you need any more help, just let me know, I assumed you have some moderate programming experience, so if you need more details on any steps, just let me know.