0
我寫一個小腳本會自動偵測出使用C面++, 我在Visual Studio中開發2010C++ OpenCV的人臉檢測
相關的方法連接, 我得到下面的異常,這我不不明白:
"opencvVisualization.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::CascadeClassifier::~CascadeClassifier(void)" ([email protected]@@[email protected]) referenced in function "void __cdecl `dynamic atexit destructor for 'cascade_eye''(void)" ([email protected]@YAXXZ)"
任何幫助將不勝感激。
#include "opencvVisualization.h"
#include "main.h"
#include <cstdio>
#include <highgui.h>
#include <cv.h>
#include <iostream>
using namespace cv;
using namespace std;
CvRect *r;
const string haarcascade_face = "C:\\haarcascades\\haarcascade_frontalface_alt.xml";
const string haarcascade_eye = "C:\\haarcascades\\haarcascade_eye.xml";
CvHaarClassifierCascade* cascade;
CvMemStorage* storage;
CascadeClassifier cascade_face, cascade_eye;
char c;
void detectAndDisplay(IplImage* img);
void prepareCascade();
boolean isFaceImage (IplImage * image);
void prepareCascade() {
cascade = (CvHaarClassifierCascade*)cvLoad("C:\\haarcascades\\haarcascade_frontalface_alt.xml");
CvCapture *capture = 0;
cascade_face.load(haarcascade_face);
cascade_eye.load(haarcascade_eye);
}
boolean isFaceImage (IplImage * image) {
CvSeq* faces = cvHaarDetectObjects(image, cascade, storage, 1.1, 3, CV_HAAR_DO_CANNY_PRUNING, cvSize (100, 100));
int i;
for(i = 0; i<(faces ? faces->total:0); i++)
{
r=(CvRect*)cvGetSeqElem(faces,i);
cvRectangle(image,
cvPoint(r->x, r->y),
cvPoint(r->x + r->width, r->y + r->height),
CV_RGB(255,0,0), 1, 8, 0);
}
return (i>0);
}
/* **************************************************************************************** */
難道你還上傳'opencvVisualization.h'爲這足以運行臉檢測算法好..?看起來你的程序似乎無法識別那裏的類/功能。 – scap3y
你在鏈接opencv_objdetect嗎? – berak
scap3y - 它已上傳。 – vlady