Setup
OpenCV installation
We will be installing OpenCV package in Python. For using OpenCV with C++, see OpenCV Linux Install and OpenCV with gcc and CMake. There are 4 different opencv packages.
For desktop environments (GUI support):
- opencv-python
main modules package
- opencv-contrib-python
main + extra modules (OpenCV Docs)
For server setups (no GUI):
opencv-python-headless
opencv-contrib-python-headless
The most preferred version is opencv-python but if you need extra modules install the opencv-contrib-python package.
# Create a virtual environment
python3 -m venv .venv
# Activate environment (In Linux)
source .venv/bin/activate
# Install OpenCV package (It has numpy as dependency so numpy will be installed automatically.)
pip3 install opencv-python
MATLAB
Recommended toolbox: