Spout in with ofxCvHaarFinder

Hi Guys,

I’ve setup a spout receiver which is currently bringing in a texture (I’m using ofxSpout2) and then I want to do some simple face tracking on that. I have the whole setup working but it’s very slow as I’m capturing the texture to an image using image grabScreen. I was wondering if anybody knew of the best approach to speed this up. I’m still a beginner in openframeworks terms. Do I have to do some kind of texture to image conversion or is there a way to run haarfinder directly on the texture that comes in? I always find the terminology between the two quite confusing.

Thanks in advance,


The first thing to eliminate is whether it is slow with just the texture coming in from ofxSprout with no HaarFinder happening. If it slow in this case then the problem has nothing to do with the HaarFinder.

Just using the videoGrabber I was able to get good performance doing the following:

//in update

It looks like ofxSpout has a .getTexture() method perhaps it also has a getPixels() method? If so, you could feed it directly in without using grabScreen.

If it doesn’t have .getPixels(), you can simply convert from ofTexture to ofPixels:

ofPixels tempPix;
// setup
tempPix.allocate(camWidth, camHeight,GL_RGB);
// update
1 Like

Another thing that is a likely culprit is the size of your texture. When my image size was 320 x 240 I had great performance but I just tried out HD and my FPS plummeted.

Perhaps you can resize your texture to something much smaller and see how that effects things?

There are also other face tracking options if you haven’t already checked them out:

They are more heavy duty than HaarFinder so it might not be necessary for your application.

1 Like

Thanks Caroline thats really helpful. I’ll take on board your advice and see what I can do.