Ask Your Question

ERFilter_Train in Visual studio C++

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

Junglee gravatar image

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

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

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

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. 
    // finally, train it:
    bool ok = boost->train(cvml);
edit flag offensive delete link more


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

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

@break , struck at line# 66 from this ,

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

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

damn, that's a gcc specific extension ;(


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

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

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

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 -0600 )edit

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 -0600 )edit

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

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

UPDATE: should be:

berak gravatar imageberak ( 2017-05-20 06:38:37 -0600 )edit

Question Tools

1 follower


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

Seen: 301 times

Last updated: Aug 24 '16