if you are using ClassifierCascade, you could save the xml as a string in some header file, and read it from memory using FileStorage.
string xml_in_memory = "<?xml> ..... </xml>";
CascadeClassifier cascade;
FileStorage fs( xml_in_memory, FileStorage::READ|FileStorage::MEMORY);
FileNode fn = fs.getFirstTopLevelNode();
bool ok = cascade.read(fn);
unfortunately, this will only work with cascades in the new format, generated by opencv_traincascade, not with the old ones generated by opencv_haartraining.
[edit] getting the xml-string right included some tricks.
string xml_in_memory =
"<?xml version=\"1.0\"?>\r\n" <-- escape the " (replace it by \")
"<!--\r\n"
" This is 20x34 detector of profile faces using LBP features.\r\n"
" It was created by Attila Novak during GSoC 2012.\r\n"
...
each line has to go into a single string, and you need to retain the linefeeds, so you will need a texteditor, that can handle backslash expressions like this:
\r\n -> \\r\\n"\r\n"
in general, avoid all c-api functionality, it's no more developed.
so, just don't use the CvHaarClassifier, but the newer ClassifierCascade instead. it will allow you to read a lbp,hog or haarcascade from memory, you don't have to hack it.
Ok, thank you for your answer.
I will use ClassifierCascade but I need to parse the .xml classifier and I have to save the data in a file.h
Can I do this?? Someone know how to do this.
Kind Regards
maybe someone will need something like that. it is changed version of OpenCV 2.4.11 functions