OpenCV: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
(Marked this version for translation)
No edit summary
Line 29: Line 29:
If the command displays nothing, the import was successful.
If the command displays nothing, the import was successful.


==== Fulfilling other Python package dependency ==== <!--T:8-->
==== Available Python packages  ==== <!--T:8-->
Other Python packages depends 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:
* <tt>opencv_python</tt>
* <tt>opencv_python</tt>

Revision as of 19:29, 28 November 2022

Other languages:

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.

Question.png
[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

Question.png
[name@server ~]$ module spider opencv/4.5.5

Or search directly opencv_python, by running

Question.png
[name@server ~]$ module spider opencv_python/4.5.5

Usage

1. Load the required modules.

Question.png
[name@server ~]$ module load gcc/9.3.0 opencv python scipy-stack

2. Import OpenCV.

Question.png
[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
Question.png
[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.