Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Toy example using opencv 3.0 object in a custom class

I'm new to opencv 3.0. I cannot figure out how to use a SVM object in a custom class. Can someone give me a toy example how to do it?

Here is an example for opencv 2.4.x:

// Class Definition    
class myClass{
    public:
        myClass();
        cv::Mat myMat;

    private:
        CvSVM svm;
};

// Constructor
myClass::myClass()
{
    CaffeMobile::svm.load("Some/hard/coded/path/to/a/SVM/File");
}

Toy example using opencv 3.0 object in a custom class

I'm new to opencv 3.0. I cannot figure out how to use a SVM object in a custom class. Can someone give me a toy example how to do it?

Here is an example for opencv 2.4.x:

// Class Definition    
class myClass{
    public:
        myClass();
        cv::Mat myMat;

    private:
        CvSVM svm;
};

// Constructor
myClass::myClass()
{
    CaffeMobile::svm.load("Some/hard/coded/path/to/a/SVM/File");
}

Toy example using opencv 3.0 object in a custom class

I'm new to opencv 3.0. I cannot figure out how to use a SVM object in a custom class. Can someone give me a toy example how to do it?

Here is an example for opencv 2.4.x:

// Class Definition    
class myClass{
    public:
        myClass();

    private:
        CvSVM svm;
};

// Constructor
myClass::myClass()
{
    CaffeMobile::svm.load("Some/hard/coded/path/to/a/SVM/File");
myClass::svm.load("Some/hard/coded/path/to/a/SVM/File");
}

Toy example using opencv 3.0 object in a custom class

I'm new to opencv 3.0. I cannot figure out how to use a SVM object in a custom class. Can someone give me a toy example how to do it?

Here is an example for opencv 2.4.x:

// Class Definition    
class myClass{
    public:
        myClass();

    private:
        CvSVM svm;
};

// Constructor
myClass::myClass()
{
    myClass::svm.load("Some/hard/coded/path/to/a/SVM/File");
}

I guess the class definition should look similar to this:

class myClass {
    private:
    static cv::Ptr<cv::ml::SVM> svm;
};

But my Constructor keeps on failing:

myClass::myClass(){
    myClass::svm->load("Some/hard/coded/path/to/a/SVM/File");
}

with the following error message:

error: no matching function for call to 'cv::ml::SVM::load(const char [120])'