Install OpenCV3.2 on MacOS X and opencv3.2 on macos
Windows platform and linux Platform Installation See Official documentation: http://docs.opencv.org/3.2.0/da/df6/tutorial_py_table_of_contents_setup.html
The installation on mac is not found on the official platform. Refer:
Https://www.learnopencv.com/install-opencv-3-on-yosemite-osx-10-10-x/ Core Command on two sentences, super simple.
brew tap homebrew/sciencebrew install opencv3
However, we also encountered a bunch of problems. The record process is as follows:
1.
brew install opencv3
Error:
Error: You must `brew link openexr` before homebrew/science/opencv3 can be installed
2. I thought that openexr is not installed, check the http://www.openexr.com/I think it is OK to not install, just have -- without-openexr this option, so:
brew install opencv3 --without-openexr
Error:
Error: The `brew link` step did not complete successfullyThe formula built, but is not symlinked into /usr/localCould not symlink share/aclocal/cmake.m4/usr/local/share/aclocal is not writable.You can try again using: brew link cmake………………
3. Follow the prompts:
brew link pkg-config
Error:
Error: Could not symlink share/aclocal/pkg.m4/usr/local/share/aclocal is not writable.
4. Oh, no permission. So:
sudo brew link pkg-config
Error:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
5. It was not allowed, so I had to change the folder permission.
Whoami # 'whoamam' in the following two commands replaces sudo chown-R 'whoam' with the output of the command: admin/usr/local/share sudo chown-R 'whoam ': admin/usr/local/bin
brew link pkg-configbrew link cmakebrew install opencv3 --without-openexr
Success: it is estimated that the first error reported in the first step is that you do not have the permission to establish software access.
6. Link to the python environment. Here is the link to the tensorflow1.0 environment created by anaconda.
cd /Users/yuetiezhu/anaconda2/envs/tensorflow1.0/lib/python2.7/site-packagesln -s /usr/local/Cellar/opencv3/3.2.0/lib/python2.7/site-packages/cv2.so cv2.so
/Usr/local/Cellar/opencv3/3.2.0/lib/python2.7/site-packages no cv. py only cv2.so, but it can be used.
7. Test it.
source activate tensorflow1.0pythonimport cv2
OK.