2

How to check the current version of OpenCV for mac and how to update my version to the newest version? I am trying to use the drawMatchesKNN and drawMatches function. The error I get is something like name 'drawMatches' is not defined". What I know is that I don't have the right version of OpenCV. But I don't know how to check my openCV version and update it to the newest version?

thewaywewere
  • 8,128
  • 11
  • 41
  • 46
Judie
  • 81
  • 3
  • 10

2 Answers2

5

If you use Python, run below code will get the OpenCV version:

import cv2
print cv2.__version__

3.2.0

3.2.0 is the latest one. As for upgrade on macOS, if you are using Anaconda, it would be easier. You may refer to this page to get some more information. For draw matching and related functions, seems you need to have opencv_contrib modules (I haven't checked at the time being).

EDIT:

The Anaconda repository has two channels with OpenCV 3.2.0 available.

You may try conda install -c menpo opencv3=3.2.0. This menpo repository does have OpenCV 3.2.0 for Python 2.7/3.4/3.5 and for linux-64.

The conda-forge repository, conda install -c conda-forge opencv=3.2.0, has many difference version of binary on OpenCV 3.2. You may have a trial this conda-forge if the menpo package doesn't work. You can check its file page on the binary available.

To uninstall the conda package, just type conda uninstall opencv3 for OpenCV 3.x.

Before installing OpenCV 3.x, it would be better to uninstall your OpenCV 2.4.8 to avoid conflict. You may try conda uninstall opencv for OpenCV 2.x or find out the package name by conda list.

As for the OSX, what are the version you are using?

thewaywewere
  • 8,128
  • 11
  • 41
  • 46
  • Thank you! I checked my openCV version with your code successfully. Mine is 2.4.8 I am wondering what does the page link to? After I clicked hyperlink, there is a login page for my google account. – Judie Apr 05 '17 at 23:09
  • I found out that I installed openCV through Anaconda. Do you know how to update the openCV version using Anaconda? – Judie Apr 06 '17 at 01:58
  • @ thewaywewere Thank you so much for your answer. I used `conda install -c menpo opencv3` to create a virtual environment and it works. My reputation for Stackoverflow is less than 15. So even though I click the vote, the number will not change. I will vote your answer when I get 3 more reputation. – Judie Apr 07 '17 at 03:25
  • @Judie You are welcome. Glad to hear you have solved the problem. – thewaywewere Apr 07 '17 at 10:05
1

It depends how you installed it. If you use homebrew and you did:

brew install opencv

then, you can get your version with:

brew info opencv

and you can get the latest version with:

brew upgrade opencv

If you did:

brew install opencv3

then you need to do:

brew info opencv3

and you can upgrade with:

brew upgrade opencv3

If you cloned the git repo on github, you need to go to your build directory and run:

more *tmp

and you can upgrade with:

cd /where/ever/you/cloned/opencv
git pull
cd /where/ever/you/built/opencv
cmake /where/ever/you/cloned/opencv
make -j 8
sudo make install

Failing all that, build a simple executable that calls getBuildInformation()

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • Thank you! It seems like that I did not use both of the ways you listed. What do you mean by building a simple executable that calls getBuildInformation()? – Judie Apr 05 '17 at 23:15