Why CvSVM is non-copyable?
CvSVM class copy constructors are private.
private:
CvSVM(const CvSVM&);
CvSVM& operator = (const CvSVM&);
This generates a lot of trouble to manage several classifiers in stl containers. What is the best way to manage, for instance, a vector of CvSVM? I have tried by using C++11's unique_ptr but after training, when using the predict method, I get an error message saying that I have to train before predicting (which I already did).
Thanks,
use a cv::Ptr<CvSVM> ?
( actually, the only way to use it in upcoming opencv3.0 would be : Ptr<ml::SVM> = ml::SVM::create(); )
@berak, so I guess I will move this project to 3.0 now that I still can, thanks
oooooh, wait, i did not say that you should move to 3.0 now ;) (might be still too much of an adventure, it's still in alpha)
all i was trying to say was, that e.g : vector<Ptr<CvSVM>> vec; vec.push_back(new CvSVM); might work in your case.
@berak Oh thanks for warning, I know it is in alpha, but I really like the Ptr<> = create() scheme. In any case, it is working now in 2.4.9 also, both with unique_ptr and Ptr (I had a bug). Thank you :)