Can I wrap these OpenCV C++ CvStatModel Methods in C successfully?

asked 2013-11-20 20:36:50 -0600

joeish80829 gravatar image

updated 2013-11-21 02:59:21 -0600

berak gravatar image

Kiril on of the main OpenCV developers is in talks with Arjun Comar to include his Autogenerated C wrappers for the C++ OpenCV functions in the next release of OpenCV 3.0.0. Arjun Comar has a buildable fork of 3.0.0 here https://github.com/arjuncomar/opencv that creates a file in the "build" folder called opencv_generated.cpp when you build his release. in that file are 500 or so C wrappers for C++ functions...but I noticed only two of the CvStatModel Class methods from the Machine Learning part of opencv are included in that file....load and save....I pasted the contents on past bucket here:http://pastebucket.com/22680. for reference but below are the 2 CvStatModel wrappers from opencv_generated.cpp

void cv_CvStatModel_save2(CvStatModel* self, c_string filename, c_string name) {
    self->save(filename, name);
}    

void cv_CvStatModel_load2(CvStatModel* self, c_string filename, c_string name) {
    self->load(filename, name);
}

i was hoping someone could take a look at the above 2 wrappers and compare them with the 10 or so methods (CvStatModel) here in opencv documentation http://docs.opencv.org/modules/ml/doc/statistical_models.html#cvstatmodel

and tell me why the other 8 or so CvStatModel methods werent included in opencv_generated.cpp....was it my build...too hard to wrap i/e

a method from the prev documentation link has trailing periods in its parameter declarations i/e below

float CvStatModel::predict(const Mat& sample, ...) const 
// what do the trailing dots mean....Is that what it predicts?

so that seems hard to wrap.....If some one can give me a clue as to whether or not its possible to wrap all the CvStatModel Methods in c before I get started that could save time in the long run and help me learn this soon to be added important part of OpenCV...thx in advance to any takers=).....and an addendum extra question would learning neural networks and applying them to opencv code be more advantageous than learning the Machine Learning part of OpenCV....like is the Machine Learning part of OpenCV so, excuse my french=), badass, that it would trump any neural network.

edit retag flag offensive close merge delete

Comments

hi joeish80829, maybe it's time for you, to get familiar with the python scripts, that actually generate those wrappers.

i can only give you a hint, why there's only 2 wrapped member functions from CvStatModel:

the generator script(s) only looks at classes, that are marked with CV_EXPORTS_W, and only wraps functions marked with CV_WRAP ( so that leaves you with load() & save() only )

also, again, take Arjun Comar's wrappers there with a grain of salt, they were made to simplify his haskell bindings, not to be a c api for humans. ( it isn't even c, just a 'flattened' /imperative version of the c++ api )

(and please don't cram so many things into one question, impossible to answer all of it)

berak gravatar imageberak ( 2013-11-21 03:14:07 -0600 )edit