Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

assuming, you're using opencv3, this is possible.

you can open a filestorage with data from memory:

const char *your_string_data = ????
FileStorage fs( your_string_data, FileStorage::MEMORY);

and read it into your CascadeClassifier:

 CascadeClassifier cascade;
 cascade.read(fs);

remaining problem: how to get the xml file into a const char * ?

you can't use the original xml as a string (it contains other strings), but have to write a small prog, that reads the xml file, and generates ascii numbers from the letters, like:

const char *xmldata = {
    11,23,44,154,324,12,88,
    177,200,1,99, .....
};

once you have that, you can either paste it directly into your code, or #include it from a header.

assuming, you're using opencv3, this is possible.

you can open a filestorage with data from memory:

const char *your_string_data *your_xml_data = ????
FileStorage fs( your_string_data, your_xml_data, FileStorage::MEMORY);

and read it into your CascadeClassifier:

 CascadeClassifier cascade;
 cascade.read(fs);

remaining problem: how to get the xml file into a const char * ?

you can't use the original xml as a string (it contains other strings), but have to write a small prog, that reads the xml file, and generates ascii numbers from the letters, like:

const char *xmldata = {
    11,23,44,154,324,12,88,
    177,200,1,99, .....
};

once you have that, you can either paste it directly into your code, or #include it from a header.

assuming, you're using opencv3, this is possible.

you can open a filestorage with data from memory:

const char *your_xml_data = ????
FileStorage fs( your_xml_data, FileStorage::MEMORY);

and read it into your CascadeClassifier:

 CascadeClassifier cascade;
 cascade.read(fs);
cascade.read(fs.getFirstToplevelNode());

remaining problem: how to get the xml file into a const char * ?

you can't use the original xml as a string (it contains other strings), but have to write a small prog, that reads the xml file, and generates ascii numbers from the letters, like:

const char *xmldata = {
    11,23,44,154,324,12,88,
    177,200,1,99, .....
};

once you have that, you can either paste it directly into your code, or #include it from a header.