0
我想在iphone中使用Opencv獲取子圖像。這段代碼中的問題是什麼? 錯誤從控制檯是:OpenCV錯誤:壞標誌(參數或結構字段)(無法識別或不支持的數組類型)在cvGetMat,文件/用戶/macmade/Desktop/OpenCV-iPhone/OpenCV/build/iPhoneSimulator/../ .. /./tmp/OpenCV-2.0.0/src/cxcore/cxarray.cpp,線路2470 拋出 'CV ::例外'opencv在iphone中獲取子圖像
std::vector<IplImage*> vec_images;
int h = bw->height;
for (int i=0; i<Xleft.size(); ++i) {
CvRect rect = cvRect(Xleft[i], 0, avgx, h);
/* dst image */
IplImage* subimg;
/* copy ROI to subimg */
cvSetImageROI(bw, rect);
cvCopy(bw, subimg, NULL);
vec_images.push_back(subimg);
cvResetImageROI(bw);
}
for (int i=0; vec_images.size(); ++i) {
cvReleaseImage(&vec_images[i]);
}
仍然崩潰... – space 2011-03-29 17:21:33
@space你能否更新你的代碼,看看你是如何初始化subimg?我只看到subimg被宣佈。 – 2011-03-29 18:16:46