If you like exciting stories, keep on reading! If not, just scroll to the short version.
I started using OpenCV 2.4.13 a few weeks ago. Why didn't I use the newer version instead? Because the examples were mostly for 2.4.x and you know you're happy if you even find a Java example. ;)
The beginning stuff made so much fun! Find a face on a picture, on webcam source, on a video... So, after the beginner's stuff, I coded a program in Java which scans a whole directory (with subdirs) and lists up and saves the filenames (+timecodes) in which the chosen face was found.
This is pretty cool! But always searching for haarcascade_frontalface_alt can be damn boring. So I cloned and altered the program: now it looks for human faces and saves the frames to an image list, which are then passed to the FaceRecognizer, trained and saved as XML.
The problems up to this point were an odyssey! No fisher-, eigen- oder lbph-facerecognizer methods for Java 2.4.13! So I had to compile a DLL in C++ for later import in Java. I'll spare you with my C++ compiler problems (had to use MSVC++ 2012 finally). And I will not complain about opencv_ffmpeg2413_64.dll, which allows me to access MPeg4-files but prohibits the use of .avi Files (at least on my machine, so I have to turn them on/off as I need it). After somehow managing to get this running (because I put it all into a Java package, which is somewhat import for the DLL method names), I got it done and the found human-face-frames are actually being given to the FaceRecognizer, then .trained and .saved as XML.
Yey! :)
=== SHORT VERSION MARKER ===
But if I try to load the just generated XML file (with FaceRecognizer.save) in my opencv programs, it says:
"error: (-2) The node is neither a map nor an empty collection in function cvGetFileNodeByName"
That's because I use the CascadeClassifier instead of FaceRecognizer for Loading XML Files. But the FaceRecognizer is the only one I can train faces with in Java (opencv 2.4.13).
So what shall I do?
I like the way how CascadeClassifier gives me the option to detectMultiscale and then passes the result to a loop, so I know the region where the face(s) are found. But if I don't wanna export the frames to files and then use opencv_traincascade.exe manually I have to use the damn FaceRecognizer with the predict method, right?
Thanks in advance.