【发布时间】:2011-05-22 02:37:01
【问题描述】:
我正在尝试使用 cvMatchTemplate() 进行一些图像跟踪,但我不断收到断言失败错误 -215。我希望有人能解决这个问题。我确保所有 ivars 都不是 nil 并且结果和模板的大小都正确。我在 opencv 2.2
int ww = image->width - template->width + 1;
int hh = image->height - template->height + 1;
CvSize tempsize = cvSize(ww, hh);
IplImage *results = cvCreateImage(tempsize,image->depth, image->nChannels);
//set the roi
cvSetImageROI(image, roiFace);
cvMatchTemplate(image, template, results, CV_TM_SQDIFF_NORMED);
这是错误:
`OpenCV Error: Assertion failed (
result.size() == cv::Size(std::abs(img.cols - templ.cols) + 1, std::abs(img.rows - templ.rows) + 1)
&&
result.type() == CV_32F) in
cvMatchTemplate, file /Volumes/ramdisk/opencv/OpenCV-2.2.0/modules/imgproc/src/templmatch.cpp, line 381
terminate called after throwing an instance of 'cv::Exception'
what(): /Volumes/ramdisk/opencv/OpenCV-2.2.0/modules/imgproc/src/templmatch.cpp:381: error: (-215) result.size() == cv::Size(std::abs(img.cols - templ.cols) + 1, std::abs(img.rows - templ.rows) + 1) && result.type() == CV_32F in function cvMatchTemplate`
【问题讨论】:
标签: opencv