OpenCV module contains C++ and Python libraries (.h header files, static and shared libraries, Python module) for image processing. You can read more OpenCV in documentation (see link below).
Currently, OpenCV is compiled without GPU support (Cuda).
Current and preferred OpenCV version in MetaCentrum environment: OpenCV 2.4.8 is available in opencv-2.4 module. Older version 2.3.2 (trunk version), available in opencv-2.3.2 module.
OpenCV can be used as a Python library. This module is compiled with Python 2.7 and Numpy support. To initialize your environment, use:
# for opencv-2.4 module (preferred) module add python-2.7.5 numpy-1.7.1-py2.7 ffmpeg opencv-2.4 # for older opencv-2.3.2 module module add python-2.6.2 numpy-py2.6 ffmpeg opencv-2.3.2
Then, in Python, library (Python module) cv2 is available, you can import it and use it:
import cv2 img = cv2.imread('test.png')
Here is a short demonstration, how to compile a C++ project with OpenCV. OpenCV module uses ffmpeg module internally for video processing.
Initialize your environment:
module add cmake-2.8 ffmpeg opencv-2.4
Module cmake is used for c++ project compilation. Our sample project is available here: metacentrum_opencv_demo.zip. Decompress this ZIP file in your home directory, at any metacentrum frontend machine.
Directory "metacentrum_opencv_demo" contains source cpp file, CMakeLists.txt for cmake, and several sample videos in "samples" subdirectory.
Create new directory "metacentrum_opencv_demo_build" (as a sibling directory to "metacentrum_opencv_demo" directory). Here, we will make a compilation and build of whole project. Similarly, create new directory "metacentrum_opencv_demo_install", where resulting binary file will be installed.
In "metacentrum_opencv_demo_build" directory, execute:
This will launch cmake GUI and create new configuration for our build. Configure the project as follows:
CMAKE_BUILD_TYPE CMAKE_INSTALL_PREFIX /home/campr/metacentrum_opencv_demo_install OpenCV_DIR /afs/ics.muni.cz/software/opencv-2.4/share/OpenCV
OpenCV_DIR should be set automatically. Adjust CMAKE_INSTALL_PREFIX to link to your "metacentrum_opencv_demo_install" directory.
Press "c" to configure, "g" to generate project (makefile etc. will be created). In "metacentrum_opencv_demo_build" directory execute:
This will compile the project. In case no error was thrown, the resulting files (binary executable and sample videos) will be installed to "metacentrum_opencv_demo_install" directory.
To test, in "metacentrum_opencv_demo_install/bin" directory, execute:
This will output a set of points (one point per frame from input video).
BSD license (free for both academic and commercial use)
Linux (in metacentrum environment), generally works with Windows and MacOS too