OpenCV Configuration and Optimization Notes


The default package for OpenCV on Fedora 20 (f20) is


The performance of such algorithms as Classifier::detectMultiScale and opencv_traincascade can be optimized via the installation of additional packages, and then enabling them when rebuilding OpenCV with various build flags.

Looking through the opencv.spec SRPM file, various enable flags are provided for configuration tweaking and tuning purposes when rebuilding with rpmbuild.

The most relevant for optimization:

--with eigen3
--with sse3

The most relevant for extending capabilities:

--with ffmpeg
--with openni

The default package can be rebuilt with these optimizations using syntax like:

rpmbuild -ba opencv.spec --with ffmpeg --with openni --with eigen3 --with sse3

However, even when using these flags on f20, the output provided by cmake at configuration time as per doesn’t enthuse. So, rebuild upstream sources without RPM to master the package configuration, and then bring this knowledge back into the RPM package. Old school, yo.

Looking at the upstream source repository, and then rebasing the f20 sources to the latest release of OpenCV (2.4.9) starts off the SRPM hacking. To get a cmake build going, build the opencv sources as specified in the link, to get dependency tracking working.

The file CMakeLists.txt has the build-time configure options.

A list of the most interesting:





Setup, Install Prerequisites.

A couple of these are easy to enable, with dependencies already pre-packaged.

For development, you’ll need the following dependencies:

yum install -y gtk2-devel libtheora-devel libvorbis-devel libraw1394-devel libdc1394-devel jasper-devel libpng-devel libjpeg-devel libtiff-devel libv4l-devel libGL-devel gtkglext-devel OpenEXR-devel zlib-devel python2-devel swig python-sphinx gstreamer-devel gstreamer-plugins-base-devel opencl-headers gstreamer-plugins-bad-free-devel gstreamer-python-devel gstreamer-devel gstreamer-plugins-bad-free-devel-docs gstreamer-plugins-base-devel-docs gstreamer-plugins-ugly-devel-docs libpng12-devel mesa-libGLES-devel

To execute binaries that have been compiled with this optimized version of opencv, one will need to install the OpenCL runtime.


yum install -y openni openni-devel openni-doc


yum install -y ffmpeg ffmpeg-devel


yum install -y tbb tbb-devel tbb-doc


yum install -y eigen3-devel eigen3-doc


To enable WITH_IPP, more elaborate configuration is required. First, install Intel Performance Primitives (aka IPP). From the User’s Guide: Note that opencv_traincascade application can use TBB for multi-threading. To use it in multicore mode OpenCV must be built with TBB.

After IPP is installed, the system must be configured to use it easily. To fixup PATHs, pick one of two options.

One: add the following to LD_LIBRARY_PATH and LD_RUN_PATH:


Two: edit /etc/ldso.conf.d and add



Furthermore, for OpenCV configuration to find the installed IPP at SRPM build time, the environment variable IPPROOT must be set, as follows:

setenv IPPROOT /opt/intel/ipp

Build SRPM

Build the modified opencv package with the following custom SPEC file. No configuration options are necessary: WITH_IPP, WITH_TBB, WITH_EIGEN are all enabled.

Then, force install it over the default libs as follows:

rpm -Uvh --nodeps opencv-2.4.9-3 etc etc.

Recompile the opencv app in question, and volia. Optimized. Speedups may vary, seeing ~ 2.3x speedups in processing times.

Fedora 20 Notes


San Francisco, California USA

yum install -y fedup
fedup --network 20

This chugs for a bit, and then on restart the screen may go black or appear hung on firstboot for
some time before booting into a desktop splash screen. One may need to wait for as long as 45 minutes here, so be chill. Grab a cocktail or go to lunch.

For the mac, you’ll need to create the usual EFI boot disk (netinst and use –efi in iso-usb-to-disk).


Install KDE and MATE

yum install -y @mate-desktop @kde-desktop

Install GNOME classic and tweak tool.

yum install -y gnome-classic-session gnome-tweak-tool

Google earth install via this answer. YMMV.

For USB microscope, software choice is GXSM, GNOME X Scanning Microscopy. Hardware recommends GTK+ UVC Viewer.

yum install -y guvcview

For rdate, install openrdate

yum install -y openrdate

Running openframeworks.080.

Get FaceTracker library. See video explaining it. Get ofxFaceTracker addon for openframeworks.

Things that Don’t Work:

  • bluetooth broken or missing when using MATE desktop. Frankly, bluetooth in *any* desktop is pretty flaky on current linux, but when using MATE it’s missing. This is a known issue with the bluez-libs upgrade to the 5.x version. In ye old days of previous Fedora’s, one could download the srpm for bluetooth-mate and rebuild it, solving everything. This approach doesn’t work with f20, and the suggestion to install bluedevil requires the invocation of the following as root to connect to the previously paired keyboard.

    And then selecting the bluetooth device in the GUI and explicitly connecting.

    Other issues are 1) booting with encrypted drive renders decryption with bluetooth keyboard impossible (Bug 863883) 2) booting to GNOME login screen with bluetooth keyboard impossible (Bug 1056682)
    . Another solution: try KDE.

  • awful default font rendering. See known issues, and switch to a decent default font for system typography.

Previously broken things that may now be fixed, at least on first inspection:

  • high-resolution printing from large format Epson printers. Broken post Fedora 14, initial testing shows progress. But is it now fixed? More as this develops.
  • yum install -y libbdplus
  • wget ~/.config/aacs/

Previous install: Fedora 19

wizard hear me