Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you can no more create it on the 'stack' (like it was in 2.4.9)

instead, you will have to use a factory function, returning a cv::Ptr :

cv::Ptr<cv::ml::NormalBayesClassifier>  classifier = cv::ml::NormalBayesClassifier::create();

//Train classifier...
classifier->train(trainingData, trainingLabels);

//Evaluate classifier...
classifier->predict(evalData,&results);

since you're obviously running opencv3.0, you can no more create it on the 'stack' (like it was in 2.4.9)

instead, you will have to use a factory function, returning a cv::Ptr :

cv::Ptr<cv::ml::NormalBayesClassifier>  classifier = cv::ml::NormalBayesClassifier::create();

//Train classifier...
classifier->train(trainingData, trainingLabels);

//Evaluate classifier...
classifier->predict(evalData,&results);

since you're obviously running opencv3.0, you can no more create it on the 'stack' (like it was in 2.4.9)

instead, you will have to use a factory function, returning a cv::Ptr :


cv::Ptr<cv::ml::NormalBayesClassifier>  classifier = cv::ml::NormalBayesClassifier::create();

//Train classifier...
classifier->train(trainingData, trainingLabels);

//Evaluate classifier...
classifier->predict(evalData,&results);

also, better look at the 3.0 documentation, i.e. the ml module got some huge overhaul lately.

since you're obviously running opencv3.0, you can no more create it on the 'stack' (like it was in 2.4.9)

instead, you will have to use a factory function, returning a cv::Ptr :


cv::Ptr<cv::ml::NormalBayesClassifier>  classifier = cv::ml::NormalBayesClassifier::create();

//Train classifier...
classifier->train(trainingData, trainingLabels);

//Evaluate classifier...
classifier->predict(evalData,&results);
classifier->predict(evalData,results); 
// note: i skipped the address-operator on results,
// which probably was wrong in the 1st place

also, better look at the 3.0 documentation, i.e. the ml module got some huge overhaul lately.

since you're obviously running opencv3.0, you can no more create it on the 'stack' (like it was in 2.4.9)

instead, you will have to use a factory function, returning a cv::Ptr :


cv::Ptr<cv::ml::NormalBayesClassifier>  classifier = cv::ml::NormalBayesClassifier::create();

//Train classifier...
classifier->train(trainingData, cv::ml::ROW_SAMPLE, trainingLabels);
// note: it needs a flag now, if a feature is on a row or a column.

//Evaluate classifier...
classifier->predict(evalData,results); 
// note: i skipped the address-operator on results,
// which probably was wrong in the 1st place

also, better look at the 3.0 documentation, i.e. the ml module got some huge overhaul lately.

since you're obviously running opencv3.0, you can no more create it on the 'stack' (like it was in 2.4.9)2.4.9). it does not have a public constructor (that's your 'abstract class' error above)

instead, you will have to use a factory function, returning a cv::Ptr :


cv::Ptr<cv::ml::NormalBayesClassifier>  classifier = cv::ml::NormalBayesClassifier::create();

//Train classifier...
classifier->train(trainingData, cv::ml::ROW_SAMPLE, trainingLabels);
// note: it needs a flag now, if a feature is on a row or a column.

//Evaluate classifier...
classifier->predict(evalData,results); 
// note: i skipped the address-operator on results,
// which probably was wrong in the 1st place

also, better look at the 3.0 documentation, i.e. the ml module got some huge overhaul lately.