Install OpenCV-Python in Fedora

Install OpenCV-Python in Fedora
Note: Please prefer binaries distributed with PyPI, if possible. See Install OpenCV with pip for details.
Goals
We will learn to setup OpenCV-Python in your Fedora system. Below steps are tested for Fedora 18 (64-bit) and Fedora 19 (32-bit).
Method 1: Install from Pre-built Binaries
Install all packages with following command in terminal as root:
yum install numpy opencv*Open Python IDLE (or IPython) and type following codes in Python terminal:
import cv2 as cv
print(cv.__version__)Note: Yum repositories may not contain the latest version of OpenCV always. There may also be issues with camera support and video playback depending on ffmpeg/gstreamer packages present.
Method 2: Building OpenCV from Source
Compulsory Dependencies
yum install cmake
yum install python-devel numpy
yum install gcc gcc-c++
# GTK and media support:
yum install gtk2-devel
yum install libdc1394-devel
yum install ffmpeg-devel
yum install gstreamer-plugins-base-develOptional Dependencies
yum install libpng-devel
yum install libjpeg-turbo-devel
yum install jasper-devel
yum install openexr-devel
yum install libtiff-devel
yum install libwebp-devel
# For TBB support:
yum install tbb-devel
# For Eigen support:
yum install eigen3-devel
# For documentation generation:
yum install doxygenDownloading OpenCV
yum install git
git clone https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd buildConfiguring and Installing
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
# With TBB and Eigen support:
cmake -D WITH_TBB=ON -D WITH_EIGEN=ON ..
# Without tests and examples:
cmake -D BUILD_DOCS=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF ..
make
su
make installInstallation goes to /usr/local/. To make Python find the OpenCV module, add to ~/.bashrc:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packagesThen test with import cv2 as cv.
Hakan Çelik