0
我試圖在我的代碼中使用NormalBayesClassifier
來應用單詞包。預訓練矩陣已準備就緒並提供給trainme
矩陣。我如下使用它:NormalBayesClassifier在opencv代碼中給出未聲明的標識符
NormalBayesClassifier classifier;
classifier.train(trainme, labels);
而且我收到以下錯誤:
error C2065: 'NormalBayesClassifier' : undeclared identifier
我添加了所有正確的庫和所有其他OpenCV函數的工作,包括features2d功能。
這裏是我的圖書館:
#include <stdafx.h>
#include <stdlib.h>
#include <cv.hpp>
#include <cxcore.hpp>
#include <highgui.h>
#include <iostream>
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include <fstream>
#include <windows.h>
using namespace cv;
using namespace std;
這應該覆蓋NormalBayesClassifier
功能,那麼爲什麼我會收到這個錯誤?
謝謝庫文件有助於修復該錯誤。這在文檔中沒有提及。你從哪裏得到關於頭文件的信息?再次感謝 – ipunished
這確實在文檔中沒有清楚描述,但通常可以在URL中找到所需的頭文件:http://docs.opencv.org/modules/ml/doc/normal_bayes_classifier.html - > module「ml 「表示頭文件」opencv2/ml/ml.hpp「。 – Niko