OpenCV: Difference between revisions
(Marked this version for translation) |
No edit summary |
||
Line 15: | Line 15: | ||
To discover which are the compatible Python versions, run | To discover which are the compatible Python versions, run | ||
{{Command|module spider opencv/4.5.5}} | {{Command|module spider opencv/4.5.5}} | ||
Or search directly | Or search directly <i>opencv_python</i>, by running | ||
{{Command|module spider opencv_python/4.5.5}} | {{Command|module spider opencv_python/4.5.5}} | ||
Line 32: | Line 32: | ||
Other Python packages depend on OpenCV bindings in order to be installed. | Other Python packages depend on OpenCV bindings in order to be installed. | ||
OpenCV provides four different packages: | OpenCV provides four different packages: | ||
* < | * <code>opencv_python</code> | ||
* < | * <code>opencv_contrib_python</code> | ||
* < | * <code>opencv_python_headless</code> | ||
* < | * <code>opencv_contrib_python_headless</code> | ||
<!--T:10--> | <!--T:10--> | ||
Line 48: | Line 48: | ||
<!--T:9--> | <!--T:9--> | ||
With the < | With the <code>opencv</code> module loaded, your package dependency for one of the OpenCV named will be satisfied. | ||
== Use with OpenEXR == <!--T:11--> | == Use with OpenEXR == <!--T:11--> |
Revision as of 00:18, 18 June 2023
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.
[name@server ~]$ module load gcc/9.3.0 cuda/11.4 opencv
Extra modules
The module also contains the extra modules (contrib).
Python bindings
The module contains bindings for multiple Python versions. To discover which are the compatible Python versions, run
[name@server ~]$ module spider opencv/4.5.5
Or search directly opencv_python, by running
[name@server ~]$ module spider opencv_python/4.5.5
Usage
1. Load the required modules.
[name@server ~]$ module load gcc/9.3.0 opencv python scipy-stack
2. Import OpenCV.
[name@server ~]$ python -c "import cv2"
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
[name@server ~]$ pip list | grep opencv
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.
[name@server ~]$ OPENCV_IO_ENABLE_OPENEXR=1 python <file>