We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Using BlobDetection
Page Index Toggle Pages: 1
Using BlobDetection (Read 695 times)
Using BlobDetection
Aug 27th, 2009, 10:09am
 
Hi, I'm trying to use the "Blobdetection" library but I'm a bit lost :S. I don't really understand how to extract information from it.

It's supposed to be explained here but I'm confused.

http://www.v3ga.net/processing/BlobDetection/index-page-documentation.html

All I need to do is to obtain the centres of the blobs detected by my camera and store them into an array or into something else.

I think I have to use the "Blob" class and use what's under "fields" but I dont know how to use it!

I dont need to draw the blobs or obtain their size.. or anything, just what pixels in the whole frames are their centres.

Can someone please try to explain it? Thank you.
Re: Using BlobDetection
Reply #1 - Aug 27th, 2009, 11:50am
 
Well it looks like the main class is BlobDetection; so I guess you need to declare one of those at the start of your code and then make calls to the appropriate method - presumably computeBlobs (), to which you pass the pixels array collected from the camera - in draw().

My guess is you'd do something along the lines of:

Code:
// import relevant libraries
// Define BlobDetection object to make it global
BlobDetection myDetector;

void setup() {
 size(320,240);
 // instantiate BlobDetection with screen size (assuming this is the same as your video size)
 myDetector = new BlobDetection(width,height);
 // You may want to call additional methods on myDetector to adjust sensitivity etc...
}

void draw() {
 // get pixels array from whatever video library you're using...

 // Pass the pixels array to the BLobDetector
 myDetector.computeBlobs(videoPixelsArray);

 // iterate through the current Blobs
 for (int i=0; i<getBlobNb (); i++) {
   Blob myBlob = getBlob (i);
   ellipse(myBlob.x,myBlob.y,10,10);
 }
}


This is obviously untested: I haven't included all the code for setting up the video feed etc. but you should presumably already have that working.

It's a shame there isn't a proper working example

Roll Eyes Download the webcam example at the bottom of the page.  It seems to more or less confirm my assumptions above...
Re: Using BlobDetection
Reply #2 - Aug 28th, 2009, 4:58am
 
Wow, thanks a lot blindfish Smiley.

I had already checked the example but didnt quite understand it too well... but with your explanation I think I now understand how the whole thing works!
Page Index Toggle Pages: 1