Multiple ofCvBlobListener

I know that ofCvBlobListener has not been released as apart of ofOpencv but I have a question regarding multiple listeners.

So I am extending ofCvBlobListener like:

  
class testApp : public ofSimpleApp, public ofCvBlobListener {   

If I want to have more than one listener with the call backs:

  
  
blobOn(...)  
blobMoved(...)  
blobOff(...)  

Not sure how to structure this? Thanks OF

First of all you might want to relay the events. There is something nice about seeing everything explicitly in your main OF class. Simply create another class with the same blob callbacks and call them from the main class callbacks.

If you want to have multiple listeners you would have to hack this yourself at the moment. This should be fairly straight forward. Simply go to the cvBlobTracker files and change

ofCvBlobListener* listener;

to

vector<ofCvBlobListener*> listeners;

and also all the places where listener is used accordingly.

We should probably add this to the next iteration of the blobtracker anyways. At the same time I am also hoping there will be a general way in OF to register callbacks and listeners. There have already been some good ideas floating around.

Happy Hacking,

thanks this sounds great Ill try it out.

Is ofCvBlobListener a file somewhere? I have the blobtracker cpp/h but I can’t find any ofCvBlobListener.

I’m trying to setup a blob listener setup just like the one in ofCVBlobTracker

Hey cerupcat.

This class in inside ofCvConstants.h. I am sure you had figured this out by now, sorry for the late as reply. :smiley:

ding

Thanks ding! You’re right though, I got it :wink: