Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

image description

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"

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.

image description

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

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.

image description

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;
}

}