Ask Your Question
0

ERFilter_Train in Visual studio C++

asked 2016-08-24 01:05:05 -0500

Junglee gravatar image

updated 2016-08-24 02:09:09 -0500

HI All,

I found this Library for extending and training our own NM Classifiers but how to build it in Visual studio c++,CMake was successful and i am facing problems while building as below

error C2039: 'Params' : is not a member of 'cv::ml::Boost'

I tried to findout the solution, This Syntax was used in older versions of OpenCV but not in OpenCV 3.1, can anyone please tell me how to fix this.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-08-24 01:44:00 -0500

berak gravatar image

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);
}
edit flag offensive delete link more

Comments

Thanks for the answer, 'll fix and update the complete answer shortly.

Junglee gravatar imageJunglee ( 2016-08-24 02:08:40 -0500 )edit

@break , struck at line# 66 from this https://github.com/lluisgomez/erfilte... ,

error is "Error 1 error C2057: expected constant expression"

Junglee gravatar imageJunglee ( 2016-08-24 02:36:11 -0500 )edit

damn, that's a gcc specific extension ;(

workaround:

int * crossings = new int[rectFilled.height];

then, later (say, between line 139, 140) :

delete [] crossings;
berak gravatar imageberak ( 2016-08-24 02:41:54 -0500 )edit
1

my bad i never built things on GCC so didn't get that. i'll look for some GCC Tuts anyway Thanks @break That fixed everything, 'll share fixed code via Drive that will help some.

Junglee gravatar imageJunglee ( 2016-08-24 02:48:51 -0500 )edit
3

You can better suggest a PR to the repository with that fix, supporting the OpenCV3.x interface!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-08-24 06:33:30 -0500 )edit
1

@Jungleee , ^^ yes, please try to that !

berak gravatar imageberak ( 2016-08-24 06:37:31 -0500 )edit

UPDATE: should be:

 boost->setWeightTrimRate(0);
berak gravatar imageberak ( 2017-05-20 06:38:37 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-08-24 01:04:03 -0500

Seen: 179 times

Last updated: Aug 24 '16