OpenCV/en
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.
where X.Y.Z represent 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
where X.Y.Z represent the desired version.
Usage¶
-
Load the required modules.
where
X.Y.Zrepresent the desired version. -
Import OpenCV.
If the command displays nothing, the import was successful.
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
With the 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'
This usually means one of the two following cases: 1. A module for OpenCV was not loaded 2. A Python module was not loaded
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 being 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
pipand is accessible for your currently loaded Python module.
If no errors are raised, then everything is OK!