Roi Mulia
Roi Mulia

Reputation: 5896

OpenCV - Unknown array type in function cvarrToMat

I'm using OpenCVinside one of my projects (iOS app). I'm trying to use cvMatchTemplate (Link : Documentation ) . For some reason I'm getting this error :

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

Running this code:

cv::Mat mOriginal, mTemp,res;
UIImageToMat(original, mOriginal);
UIImageToMat(temp, mTemp);

// Crashing at this line
cvMatchTemplate(&mOriginal, &mTemp, &res, CV_TM_CCOEFF_NORMED);

Any help would be greatly appreciated. Thank you.

Upvotes: 2

Views: 4701

Answers (1)

Roi Mulia
Roi Mulia

Reputation: 5896

@Miki too humble to post his answer :)

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

Working code:

cvMatchTemplate(mOriginal, mTemp, res, CV_TM_CCOEFF_NORMED);

Upvotes: 2

Related Questions