OpenCV
OpenCV (Open Source Computer Vision Library) is a library of programming functions mainly aimed at real-time computer vision.
CUDA¶
OpenCV is also available with CUDA.
whereX.Y.Z represents the desired version.
Extra modules¶
The module also contains the extra modules (contrib).
Python bindings¶
The module contains bindings for multiple Python versions. To know which are the compatible Python versions, run:
Or search directly opencv_python, by running: whereX.Y.Z represents the desired version.
Usage¶
- Load the required modules.
X.Y.Z represents the desired version.
- Import OpenCV.
Available Python packages¶
Other Python packages depend on OpenCV bindings in order to be installed.
OpenCV provides four different packages:
* opencv_python
* opencv_contrib_python
* opencv_python_headless
* opencv_contrib_python_headless
opencv-contrib-python 4.5.5
opencv-contrib-python-headless 4.5.5
opencv-python 4.5.5
opencv-python-headless 4.5.5
opencv module loaded, your package dependency for one of the OpenCV named will be satisfied.
Use with OpenEXR¶
In order to read EXR files with OpenCV, the module must be activated through an environment variable.
Troubleshooting¶
This is a normal error generated by this dummy wheel.¶
See This is a normal error generated by this dummy wheel.
ModuleNotFoundError: No module named 'cv2'¶
When importing cv2, one may get the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
Module OpenCV not loaded¶
Find a compatible OpenCV module and load it. See Python bindings.
Python module not loaded¶
When omitting to load a Python module, and activating a virtual environment, the Python bindings will not be available, hence resulting in cv2 not seen.
To remedy:
- Deactivate any Python virtual environment.
Note
If you had a virtual environment activated, it is important to deactivate it first, then load the module, before reactivating your virtual environment.
- Load the module.
- Check that it is visible by
pip: