Been trying out ofxCv and ofxFaceTracker (got in contact with Jason and he was super prompt and helpful)…
I ported over a 062 project of mine to 007 so I could compare openCV Haar finding with FaceTracker…
I’ve found that it IS possible to compile ofxCv and ofxFaceTracker together in CB (win) and Xcode (mac) but only if you do a ‘magic dance’ to get the two Tracker.h files to play nice.
Basically it goes:
Step to the right: add src and libs for both ofxCv and ofxFaceTracker;
Step to the left: try to compile and get: ‘FACETRACKER’ has not been declared OR ‘FACETRACKER’ is not a namespace-name (oh but it has…and oh but it is…isn’t it?)
Step to the right: Try a bunch of other things with header includes paths etc that are all irrelevant OR just don’t do any of that…
Step to the left again: …and just remove Tracker.h and Tracker.cpp from ofxCv (has to be ofCv’s Tracker) and hit compile (oh yes there goes Tracer.cc making a nice .o)
Step to the right again: drag Tracker.h/cpp back in and voila!
Step to the never: have to do the dance again once you do this the first time - even if you clean all dependencies…
At first I thought I was dreaming but just double/triple checked that dance and it’s repeatable (I checked on Xcode, but I remember was pretty much the same in C::B)…
…perhaps this should be in another thread but also found:
On Windows: In Utilities.h the enum ABSOLUTE is causing some kind of conflict (trying a “Find declaration…” with the IDE didn’t get me anywhere so it might be in a a non-header library somewhere. It needs a:
in the Utilities.h or a rename in the enum.
Once I threaded FaceTracker I was getting assert crashes every 1 to 60 seconds:
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file c:/OpenCV-2.2.0/modules/core/src/matrix.cpp, line 307
After laborious printf debugging I found that inserting:
if (temp_.rows > 0) R.width = (((R.width) < (temp_.rows)) ? (R.width) : (temp_.rows));
if (temp_.cols > 0) R.height = (((R.height) < (temp_.cols)) ? (R.height) : (temp_.cols));
temp_ = small_(R).clone();
at line 180 of Tracker.cc fixes the problem - R is a rect that occassionally returns a width and/or height smaller than temp_.cols and/or temp_.rows…
Yeah, there’s a bug in my code to do with re-initialising the face when it is close to the periphery of the image. I was planning to fix that, but keep putting it off. Anyways, if your fix stops the crashes and the tracker continues to “work” I guess that’s sufficient for now.