Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

that repo is unfortunately 3 years old, and opencv's api has moved on.

in general, all "Params" structs were removed from the ml classes in favour of individual getters/setters per param.

lacking data, i cannot try, but i reckon, this should work here

if (ifile) 
{
    //The file exists, so we don't want to train 
    printf("Found trained_boost_char.xml file, remove it if you want to retrain with new data ... \n");
    boost = StatModel::load<Boost>("./trained_classifierNM2.xml");
} else {
    //Train with 100 features
    printf("Training ... \n");
    boost = Boost::create();
    // those are actually the default values, so you might as well skip them,
    // they're only here to show the idea. 
    boost->setBoostType(Boost::REAL);
    boost->setWeakCount(100);
    boost->setWeightTrimRate(1);
    // finally, train it:
    bool ok = boost->train(cvml);
}