cannot declare field 'std::pair<const std::basic_string<char>, cv::ml::SVM>::second' to be of abstract type 'cv::ml::SVM'
hey everybody,
i am really new to openCV and i am trying to implement a surf detector using openCV 3.1 and i getting always after building my project in eclipse the error message above. There are a lot of information i getting, too. Most of them concerning to ml.hpp.
My code seem to be okay. The only error appearing references to "line 102, external location: /usr/local/Cellar/gcc48/4.8.2/lib/gcc/x86_64-apple-darwin11.4.2/4.8.2/include/c++/bits/stl_pair.h C/C++ Problem"
I do not know what to do cause the error is not my fault?
desperate floyd
EDIT 1
void categorizer::train_classifiers() {
// Set the vocabulary for the BOW descriptor extractor
bowDescriptorExtractor -> setVocabulary(vocab);
// Extract BOW descriptors for all training images and organize them into positive and negative samples for each category
make_pos_neg();
for(int i = 0; i < categories; i++) {
string category = category_names[i];
// Positive training data has labels 1
Mat train_data = positive_data[category];
Mat train_labels = Mat::ones(train_data.rows, 1, CV_32S);
// Negative training data has labels 0
train_data.push_back(negative_data[category]);
Mat m = Mat::zeros(negative_data[category].rows, 1, CV_32S);
train_labels.push_back(m);
svm = ml::SVM::create();
svm->setType(ml::SVM::C_SVC);
svm->setKernel(ml::SVM::POLY);
svm->setGamma(3);
svm->train( train_data , ml::ROW_SAMPLE , train_labels );
cout << "Trained and saved SVM for category " << category << endl;
}
}
please try to give us a TEXT version of your error, not an (unreadable) screenshot.
also, the resp. part of code might be helpful
apart from that, you probably need a
pair<string,Ptr<ml::SVM>>
. ml::SVM is an abstract interface."My code seem to be okay." -- definitely not !
i do agree with you my code is probably (or definitely) not okay. but way is there no reference to my code? so i don't know which part of the code i need to post.
the parts, where you construct the SVM, and where you're trying to put it into your pair
I'm doing like you did it here: link, a pair i do nowhere have.
that's the problem, i do not know what is going on. the only error appearing is the title of that question. the location of the error is in the header file stl_pair.h. That is why i wrote my code seem to be okay. the location is out of my code. and all the informations shown in the screenshot are out of my code, too.
it seems, you're trying to train an svm per class,
do you have a map of svm's ? (it's using pairs internally)
indeed i did have a unused map of svm's left in the code. all problems are gone. a new problem appeared, but so far for today and the new problem i can handle on my own. thanks a lot. :D :D