I have a SVM classifer saved as "classifier.xml". I take input images from webcam and want to classify them. So, instead of loading the classifier for each input image, i just want to load the classifier only once (something like static) using the following code:
mySvm.load("classifier.xml");
PROBLEM: Currently i have declared cv::SVM mySvm;
as global variable but i want to get rid of global variable. So, what should i do to make cv::SVM mySvm;
as a member variable of Class Classifier
?
The structure of my files is following:
(1) classifier.h
class Classifier
{
private:
public:
void getSvm();
};
(2) main.cpp
int main()
{
Classifier objectSvm;
objectSvm.getSvm();
}
(3) loadSVM.cpp
#include "classifier.h"
cv::SVM mySvm;
void svm::getSvm()
{
mySvm.load("classifier.xml");
}