1 | initial version |
please do not try to inherit from ml::SVM, but layer(encapsulate) it.
the long story is: while your class can inherit the interface, this way you can't inherit the hidden implementation
2 | No.2 Revision |
please do not try to inherit from ml::SVM, but layer(encapsulate) it.
the long story is: while your class can inherit the interface, this way you can't inherit the hidden implementation
also, please avoid using new
, and raw pointers in general. either use plain RAII and auto storage, like:
MyClass mysvm;
or use a smartpointer, like:
cv::Ptr<MyClass> mysvm = cv::makePtr<MyClass>();
3 | No.3 Revision |
please do not try to inherit from ml::SVM, but layer(encapsulate) it.
the long story is: while your class can inherit the interface, this way you can't inherit the hidden implementation
also, please avoid using new
, and raw pointers in general. either use plain RAII and auto storage, like:
MyClass mysvm;
mysvm.setC(1);
or use a smartpointer, like:
cv::Ptr<MyClass> mysvm = cv::makePtr<MyClass>();
mysvm->setGamma(0.2);
4 | No.4 Revision |
please do not try to inherit from ml::SVM, but layer(encapsulate) it.
the long story is: while your class can inherit the interface, this way you can't inherit the hidden implementation
also, please avoid using new
, and raw pointers in general. either use plain RAII and auto storage, like:
MyClass mysvm;
mysvm.setC(1);
mysvm.doSomething();
or use a smartpointer, like:
cv::Ptr<MyClass> mysvm = cv::makePtr<MyClass>();
mysvm->setGamma(0.2);
mysvm->doSomething();
5 | No.5 Revision |
please do not try to inherit from ml::SVM, but layer(encapsulate) it.
the long story is: while your class can inherit the interface, this way you can't inherit the hidden implementation
so, try like:
class MySVM
{
Ptr<ml::SVM> svm;
public:
MySVM() : svm(ml::SVM::create()) {}
void doSomehing()
{
// use layered, private implementation
svm->someMethod();
}
};
also, please avoid using new
, and raw pointers in general. either use plain RAII and auto storage, like:
MyClass mysvm;
mysvm.doSomething();
or use a smartpointer, like:
cv::Ptr<MyClass> mysvm = cv::makePtr<MyClass>();
mysvm->doSomething();
6 | No.6 Revision |
please do not try to inherit from ml::SVM, but layer(encapsulate) it.
the long story is: while your class can inherit the interface, this way you can't inherit the hidden implementationimplementation, meaning, that you will have to implement 32 virtual functions from the SVM interface.
if you instead layer it, you will only need to write wrapper functions for the situations you actually use.
so, try like:
class MySVM
{
Ptr<ml::SVM> svm;
public:
MySVM() : svm(ml::SVM::create()) {}
void doSomehing()
{
// use layered, private implementation
svm->someMethod();
}
};
also, please avoid using new
, and raw pointers in general. either use plain RAII and auto storage, like:
MyClass mysvm;
mysvm.doSomething();
or use a smartpointer, like:
cv::Ptr<MyClass> mysvm = cv::makePtr<MyClass>();
mysvm->doSomething();
7 | No.7 Revision |
please do not try to inherit from ml::SVM, but layer(encapsulate) it.
the long story is: while your class can inherit the interface, this way you can't inherit the hidden implementation, meaning, that you will have to implement all 32 virtual functions from the SVM interface.interface on your own ...
if you instead layer it, you will only need to write wrapper functions for the situations you actually use.
so, try like:
class MySVM
{
Ptr<ml::SVM> svm;
public:
MySVM() : svm(ml::SVM::create()) {}
void doSomehing()
{
// use layered, private implementation
svm->someMethod();
}
};
also, please avoid using new
, and raw pointers in general. either use plain RAII and auto storage, like:
MyClass mysvm;
mysvm.doSomething();
or use a smartpointer, like:
cv::Ptr<MyClass> mysvm = cv::makePtr<MyClass>();
mysvm->doSomething();
8 | No.8 Revision |
please do not try to inherit from ml::SVM, but layer(encapsulate) it.
the long story is: while your class can inherit the interface, this way you can't inherit the hidden implementation, meaning, that you will have to implement all 32 pure virtual functions from the SVM interface on your own ...
if you instead layer it, you will only need to write wrapper functions for the situations you actually use.
so, try like:
class MySVM
{
Ptr<ml::SVM> svm;
public:
MySVM() : svm(ml::SVM::create()) {}
void doSomehing()
bool train(const Mat &features, const Mat &labels)
{
// use layered, private implementation
svm->someMethod();
return svm->train(features, ml::ROW_SAMPLE, labels);
}
};
also, please avoid using new
, and raw pointers in general. either use plain RAII and auto storage, like:
MyClass mysvm;
mysvm.doSomething();
or use a smartpointer, like:
cv::Ptr<MyClass> mysvm = cv::makePtr<MyClass>();
mysvm->doSomething();
9 | No.9 Revision |
please do not try to inherit from ml::SVM, but layer(encapsulate) it.
the long story is: while your class can inherit the interface, this way you can't inherit the hidden implementation, meaning, that you will have to implement all 32 pure virtual functions from the SVM interface on your own ...
if you instead layer it, you will only need to write wrapper functions for the situations you actually use.
so, try like:
class MySVM
{
Ptr<ml::SVM> svm;
public:
MySVM() : svm(ml::SVM::create()) {}
// wrapper:
bool train(const Mat &features, const Mat &labels)
{
// use layered, private implementation
return svm->train(features, ml::ROW_SAMPLE, labels);
}
};
also, please avoid using new
, and raw pointers in general. either use plain RAII and auto storage, like:
MyClass mysvm;
mysvm.doSomething();
or use a smartpointer, like:
cv::Ptr<MyClass> mysvm = cv::makePtr<MyClass>();
mysvm->doSomething();