OpenCV - 函数 cvarrToMat 中的未知数组类型



我在我的一个项目(iOS应用程序(中使用OpenCV。我正在尝试使用cvMatchTemplate(链接:文档(。由于某种原因,我收到此错误:

OpenCV Error: Bad argument (Unknown array type) in cvarrToMat, file /Volumes/build-storage/build/master_iOS-mac/opencv/modules/core/src/matrix.cpp, line 943
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Volumes/build-storage/build/master_iOS-mac/opencv/modules/core/src/matrix.cpp:943: error: (-5) Unknown array type in function cvarrToMat

运行此代码:

cv::Mat mOriginal, mTemp,res;
UIImageToMat(original, mOriginal);
UIImageToMat(temp, mTemp);
// Crashing at this line
cvMatchTemplate(&mOriginal, &mTemp, &res, CV_TM_CCOEFF_NORMED);

任何帮助将不胜感激。谢谢。

@Miki太谦虚了,无法发布他的答案:)

Don't use obsolete C api. Use cv::matchTemplate

工作代码:

cvMatchTemplate(mOriginal, mTemp, res, CV_TM_CCOEFF_NORMED);

最新更新