Anaconda is a good Python integrated development environment, you can also use Conda or pip to install PYTHON-OPENCV directly, but this installation method after the installation of OPENCV missing video packets, such as the following read video commands
Import cv2
cap = Cv2. Videocapture (' Path/to/your/video.mp4 ')
cap.isopened ()
You will find that the status is always false, and the Read Command Cap.read () also does not read the data. This is because the anaconda of the direct command installation lacks video-related modules, and then we need to compile the installation OpenCV.
There are a lot of tutorials to install OPENCV, and GitHub has a setup script that's good. The address is here: Install OpenCV.
One of the things you should be aware of is that in the CMake process, you have to specify the python environment you want to install, otherwise your Anaconda environment will not be able to use OPENCV:
If you are a Linux environment such as Ubuntu,
-D python_packages_path=/home/user_name/anaconda2/lib/python2.7/site-packages #这里的路径要根据你的具体情况设定
If you are windows, the path for this
-D Python_packages_path = C:\Anaconda\Lib\site-packages