Mac Mini + Yosemite + OpenCV + CoreImage (also, I'm out of time - Help!)

Hello everyone.

I’ve developed an app using a Logitech 920 which does face detection using a modified version of ofxCoreImageDetector on OSX. Dev has been problem free on my MacBook Pro, but now i’m at the event trying to get it all working on a late 2014 Mac Mini (i5 with Intel HD Graphics 5000) and am running into several problems.

  • video lags and progressively gets worse ( using ofQTKitGrabber )

  • several ofImages just aren’t drawing at all

  • i’m using OpenCV to resize the 1920x1080 video feed to a quarter of the size, which then creates a CIImage for detection.

  • ofxCoreImageDetection uses CIImage::imageWithBitmapData method which I’ve heard might be a bad idea

  • getting 24 fps, which isn’t a big deal (app is set to 40fps and that’s what i get on the MBP)

I’m happy to post code, or offer any other info. I don’t want to run out and buy the top-of-the-line Mac Mini unless it’s necessary.

Should I try out the 64-bit branch of oF?

Thanks in advance!

Update: got the faster Mini with Intel Iris GPU, no change at all. One other problem that I didn’t note before, the face detection triggers a video to play, using ofxAVFVideoPlayer, and it’s not working at all either.

Also, I’m using v0.8.4.

Ok, solved the problem. At least the big one.

Issue was that even though I was packaging the app with the data folder, and setting ‘ofSetDataPathRoot("…/Resources/data/")’ - the assets were not being found correctly. I copied the data folder to the desktop, adjacent to the app, and all is well. The Mini is still not delivering super fast video, but i’m gonna chalk that up to the face detection routine and CoreImage (for now).

I have followed @NickHardeman’s post on how to copy over the data for use as a self-contained app, and have done so several times in the past without this issue. I’ll try to do more per-asset debugging and post any results.

Thanks for following if you’ve done so. The client is happy… :wink:

1 Like


Any external assets loaded in an object’s constructor method will fail as setting ofSetDataPathRoot() in the app’s setup() occurs AFTER those objects are created. I had a mix of using init() or build() methods that did the loading and they all worked fine of course.

Also, I’m bookmarking this so I never forget to run the app from Terminal when debugging while at an event: Run from Terminal

Live and learn, no more asset loading in a constructor!


i have found your post because i am looking around for some more info on coreimage facetracking.
i too am using ofxCoreImageDetector (unmodified) and have used it in multiple project.
some projects had two separate apps running their own ofxCoreImageDetector , other projects used multiple instances of ofxCoreImageDetector in separate threads.

but something i have noticed is that these apps seem to crash after running for longer time. the crash happens at random points due to some memory error.
has this been your experience too?
if not, would you be willing to let me try your modified ofxCoreImageDetector version?

thanks, stephan.

Hey @stephanschulz - if memory serves, I had only added in getters/setters and some attempts at getting face angle, cause it wasn’t really implemented. I certainly didn’t add anything that would have changed it’s memory allocation/release.

I had used the addon for only one project so far, but it was for a tradeshow booth that ran all day and I had no trouble with crashing. The app placed an image around your face as you walked by, and if you looked long enough a video would play - so not very complex.

I wonder if anything has changed in more recent versions of OSX in relation to oF 0.9?

I’m happy to help if I can, let me know if you’d like me to post my version of the addon.


thanks for your fast reply.
yes it would be great to let your code run on my machine for an extended period and see if i see the same behaviour.

if you are still up for it please post your modified addon and a sample use of it.


Hey! I apologize for spacing out on this - things have been very busy this week, but that’s a good thing.

I took a look at my modified version and it all came back - I modified it so that I could pass a pointer to raw pixels, re-use as much memory as possible. I was using OpenCV to downsample a 1920x1080 video feed, and set some static sizes to support that as well. I don’t think the CIImageFrom() method works at all in my version, but it’s still there.

It’s not super well-documented but my changes are obvious. Hope it helps!

-N (5.3 KB)

i want to quickly test it. do you think you also have a quick example project. :slight_smile:
not sure when i will have time to sit and write my own tester, so hoping you already have one.