――I wanted to use FFmpeg this time to prepare various environments, so I tried to build the environment. ――In addition, I have summarized the procedure for building Python + OpenCV because it is confusing because it rolls too much on the net and there are situations where it is necessary to use it properly depending on the combination of versions. --The steps to build Homebrew, pip, and pyenv are omitted. The procedure of pasting the PATH is also omitted. --OpenCV and FFmpeg take time to make, so it's a good idea to do it when you can afford it.
Python2.7+OpenCv2
brew install python
brew install opencv
Python2.7+OpenCv3
Homebrew + pip
brew install python
pip install opencv-python
pyenv + pip
--pyenv was entered from anyenv.
pyenv install 2.7
pip install opencv-python
Python3.6+OpenCv3
Homebrew + pip
brew install python3
pip3 install opencv-python
Python3.6+OpenCv3+FFmpeg
――It seems that pip doesn't compile FFmpeg with OpenCV. video related functionality is not supported (not compiled with FFmpeg) --If you can create the following files, you are successful. Please put a symbolic link in /usr/local/lib/python3.6/site-packages. (For some reason, I gave up because I couldn't do this file many times last time.)
/usr/local/Cellar/opencv3/3.2.0/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so
brew install opencv3 --with-python3 --with-ffmpeg --without-python
Recommended Posts