1 | initial version |
The answer is by using cv::Ptr< cv::NormalBayesClassifier >
, but do not forget to allocate memory with new
:
cv::Ptr< cv::NormalBayesClassifier > bestClassifier;
for (int i = 0; i > 10; i++)
{
// define pointer to classifier and allocate memory
cv::Ptr< cv::NormalBayesClassifier > classifier = new cv::NormalBayesClassifier;
// train, test
if (smallestError > errorRate)
{
bestClassifier = classifier;
smallesError = errorRate;
}
}
bestClassifier->save("name");
2 | No.2 Revision |
The answer is by using cv::Ptr< cv::NormalBayesClassifier >
, but do not forget to allocate memory with new
:
cv::Ptr< cv::NormalBayesClassifier > bestClassifier;
for (int i = 0; i > < 10; i++)
{
// define pointer to classifier and allocate memory
cv::Ptr< cv::NormalBayesClassifier > classifier = new cv::NormalBayesClassifier;
// train, test
if (smallestError > errorRate)
{
bestClassifier = classifier;
smallesError = errorRate;
}
}
bestClassifier->save("name");