我試圖使用OpenCv 2.3進行人臉檢測。 我試圖在我的項目中加載「haarcascade_frontalface_alt_tree.xml」,我經常無法加載xml文件。OpenCV(CvHaarClassifierCascade *)cvLoad不加載,無法加載xml文件
CvHaarClassifierCascade * pCascade = 0; // the face detector
const char* file ="C:\OpenCV2.3\opencv\data\haarcascades\haarcascade_frontalface_alt_tree.xml" ;
pCascade = (CvHaarClassifierCascade*) cvLoad(file , NULL, NULL, NULL);
if (!pCascade) {
exit(-1); // unable to load xml
}
我相信我expeiancing同樣的問題this problem
我曾嘗試cvLoad命令之前加載的圖像,但它並沒有幫助。
我使用的OpenCV 2.3,使我的配置,就像在這個tutorial
我使用這些庫(我相信我的配置是正確的,該文件存在,可以用記事本打開++)
#include <stdio.h>
#include "opencv2\opencv.hpp"
#include "cv.h"
#include "highgui.h"
//#include "cvaux.h"
using namespace cv;
#pragma comment(lib, "opencv_core230d.lib")
#pragma comment(lib, "opencv_highgui230d.lib")
//#pragma comment(lib, "opencv_contrib230d.lib")
//#pragma comment(lib, "opencv_calib3d230d.lib")
//#pragma comment(lib, "opencv_features2d230d.lib")
//#pragma comment(lib, "opencv_flann230d.lib")
//#pragma comment(lib, "opencv_gpu230d.lib")
#pragma comment(lib, "opencv_haartraining_engined.lib")
#pragma comment(lib, "opencv_imgproc230d.lib")
//#pragma comment(lib, "opencv_legacy230d.lib")
//#pragma comment(lib, "opencv_ml230d.lib")
//#pragma comment(lib, "opencv_objdetect230d.lib")
//#pragma comment(lib, "opencv_video230d.lib")
我希望OP會評論您的哪些解決方案回答了他的問題題。 – Joshua