-1
我有以下代碼:錯誤的OpenCV&openframework雖然裁剪圖像
IplImage* f(IplImage* src)
{
// Must have dimensions of output image
IplImage* cropped = cvCreateImage(cvSize(1280,500), src->depth, src->nChannels);
// Say what the source region is
cvSetImageROI(src, cvRect(0,0, 1280,500));
// Do the copy
cvCopy(src, cropped);
cvResetImageROI(src);
return cropped;
}
void testApp::setup(){
img.loadImage("test.jpg");
finder.setup("haarcascade_frontalface_default.xml");
finder.findHaarObjects(img);
}
//--------------------------------------------------------------
void testApp::update(){
}
//--------------------------------------------------------------
ofRectangle cur;
void testApp::draw(){
img = f(img);
img.draw(0, 0);
ofNoFill();
for(int i = 0; i < finder.blobs.size(); i++) {
cur = finder.blobs[i].boundingRect;
ofRect(cur.x-20, cur.y-20, cur.width+50, cur.height+50);
}
}
它產生一個錯誤。我認爲這是因爲我不會將IplImage
轉換爲ofImage
。有人可以告訴我該怎麼做嗎?
嗨。你能指定你收到的錯誤信息嗎? –
| error:無法將'ImageI'轉換爲'IplImage *'參數'1'爲'IplImage * f(IplImage *)'| – user1543957
我的代碼中沒有看到'ofImage'類型的變量。幫不了你。 – karlphillip