Nirzvi
Nirzvi

Reputation: 11

Error while installing OpenCV for Python 2.7 on OSX Yosemite - error: no matching function

I was using this guide for installing OpenCV on my Mac: http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/

Everything worked until the last step:

make install

When I got this error message:

/Users/Nirzvi/opencv_contrib/modules/aruco/src/aruco.cpp:1629:12: error: no matching function for call to 'calibrateCamera'
return calibrateCamera(processedObjectPoints, processedImagePoints, imageSize, _cameraMatrix,
       ^~~~~~~~~~~~~~~

/Users/Nirzvi/opencv/modules/calib3d/include/opencv2/calib3d.hpp:844:21: note: candidate function not viable: requires at most 9
  arguments, but 12 were provided

CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints,

The install process stopped immediately and, being a beginner programmer, I have no idea what to do next.

Upvotes: 0

Views: 255

Answers (2)

hiro-jp
hiro-jp

Reputation: 11

According to the source (opencv_contrib/modules/aruco/src/aruco.cpp L1583~1585), he call calibrateCamera like;

return calibrateCamera(processedObjectPoints, processedImagePoints, imageSize, _cameraMatrix, _distCoeffs, _rvecs, _tvecs, _stdDeviationsIntrinsics, _stdDeviationsExtrinsics, _perViewErrors, flags, criteria);

but 8th to 10th parameter is recently (2016-06-07) added feature (see https://github.com/opencv/opencv/blame/master/modules/calib3d/src/calibration.cpp L3368~3374).

That's why the number of parameter does't match even if your OpenCV version is 3.1.0 (latest release as of 2016-11-6).

Do these two and get both latest version.

$ git clone https://github.com/Itseez/opencv.git

$ git clone https://github.com/Itseez/opencv_contrib.git

Upvotes: 0

argvareater
argvareater

Reputation: 11

If you're using this guide, make sure you remember to clone both opencv and opencv-contrib in your home folder rather than nesting them. It's easy to miss the instruction where it tells you to go back to ~/

As stated above, make sure you've downloaded matching versions of opencv and opencv-contrib from git.

Finally, make sure that your cmake command "OPENCV_EXTRA_MODULES_PATH" is pointing to the correct path for your corrected version of "opencv_contrib". If you just pull the correct version to the proper path, but don't update that value, it will keep trying to use the incorrect version of contrib.

Note: The following is not recommended: As an absolute last resort, you can always navigate to the cpp file it errored on (in your case: /Users/Nirzvi/opencv_contrib/modules/aruco/src/aruco.cpp), and comment out the "calibrateCamera" call and its surrounding function. You won't be able to make use of whatever that function was, but opencv has a ton of functions, if it's not one you need for your project, commenting out the function will at least get you further in your install process.

Upvotes: 1

Related Questions