Installing OpenCV 4 in Mac Os
- Install Anaconda
- Create a new environment
- Open the new environment in the terminal
- Run:
conda install -c conda-forge/label/main opencv conda install notebook Jupyter notebook
- In the notebook
import cv2
- Check the version with
cv2.__version__
- You should see something like 4.1.1
Problems when showing an image or video
If when opening an image or playing a video/camera stream it just crashes every time, then there is a simple trick to fix it, after destroying all windows sentence just add:
cv2.waitKey(1)