Install OpenCV 2.3 with video support in Fedora 15

Much has changed since OpenCV 2.0.. android support, CUDA support, etc are up and running. So is the change in the method of installing OpenCV. So, i though to quickly jot down the steps to follow for a painless install.

I must add, due to changes in gcc, removal of libv4l support from linux kernel, etc.. OpenCV 2.1 and 2.2 give loads of issues during install. I just couldnt manage installing v2.1, though v2.2 needed few hacks as mentioned in the link : https://code.ros.org/trac/opencv/ticket/324 . So, for people wanting to install v2.2, can follow exactly same steps mentioned below after making the above hack. Note that, even UVC-webcams dont work with v2.2. So, if you’re like me, needing lots of webcam feed for vision-based tasks, its best to avoid v2.2. Moral of the story : Go for v2.3..

1. Install the following :

sudo yum install eigen2-devel, CTL, CTL-devel, OpenEXR_CTL-libs, tbb, yasm, yasm-devel, tbb-devel, OpenEXR CTL-devel, OpenEXR CTL, perl-URI, perl-Compress-Raw-Zlib, perl-Compress-Raw-Bzip2, perl-l0-Compress, libucil-clevel, perl-HTML-Tagset, perl-HTML-Parser, perl-Iibwww-perl, perl-XML-Parser, gstreamer-plugins-base-devel, libsigc++20-devel, glibmm24-devel, libxml++-devel, gstreamermm, xine-lib, libunicapgtk-devel, xine-lib-devel, gstreamermm-devel, python-devel, sip-macros, sip, vamp-plugin-sdk, audacity, sip-devel

sudo yum install libXext-clevel, glib2-devel, libXrender-devel, libXfixes-devel, Iibunicap, freetype-devel, boost-system, fontconfig-devel, libpng-devel, boost-filesystem, boost-serialization, boost-thread, boost-date-time, boost-regex, libXt-devel, libXdamage-devel, libXcomposite-devel, libXcursor-devel, libXrandr-devel, atk-devel, libXinerama-devel, libXxf86vm-devel, libXi-devel, libxml2-devel, blas-devel, libjpeg-turbo-devel, pixman-clevel, cairo-devel, pango-devel, libdrm-devel, mesa-libGL-devel, boost-graph, boost-wave, libucil, boost-signals, boost-python, boost-iostreams, boost-program-options, boost-random, boost-test, boost, mesa-libGLU-devel, ilmbase-devel, libunicapgtk, gdk-pixbuf2-devel, libibverbs, libmlx4, librdmacm, check, check-devel, boost-jam, rarian, rarian-compat, cmake, plpa-libs, numactl, environment-modules, boost-devel, boost-build, OpenEXR-devel, jasper-devel, lapack-devel, libunicap-devel, libtifl-devel, atlas-devel, openmpi, boost-openmpi, ucview, gstreamer-devel, gtk2-devel, jasper, 0penEXR

sudo yum install xorg-x11-proto-devel, libXau-devel, Iibxcb-devel, libX11-devel, libram1394-devel, automake, libogg-devel, libtheora-devel, libvorbis-devel, libdc1394-devel, x264-devel, faac-devel, xvidcore-devel, dirac-devel, gsm-devel, zlib-devel, faad2-devel, speex-devel, lame-devel, orc-compiler, orc-devel, libvdpau, cppunit, libvdpau-devel, schroedinger-devel, dirac, x264, lame, faad2, amrwb-devel, opencore-amr-devel, amrnb, amrnb-devel

(i have tried copying the package names via OCR software and some editing as much as could be possible from the screenshot below)

OR

Install from Add/Remove Programs (PackageKit)

List of Packages to install for OpenCV dependency resolution

2. Now, download and Install FFMPEG

  • Eventhough FFMPEG is at v0.8.. its best to go for v0.7.. thats coz of several dependency issues. Many things like VLC, etc are based on ffmpeg v0.69 code, and v0.8 MAY give lots of issues..
  • Download ffmpeg 0.7 from : http://ffmpeg.org/releases/ffmpeg-0.7.1.tar.bz2
  • extract the above file (say files get extracted to /home/user/ffmpeg)
  • Open terminal and cd to above location.. i.e. : cd /home/user/ffmpeg
  • Now type the following :

./configure –enable-gpl –enable-version3 –enable-nonfree –enable-postproc –enable-libfaac –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libtheora –enable-libvorbis –enable-libxvid –enable-x11grab –enable-swscale –enable-shared

make

sudo make install

  • And you are done.. FFMPEG is ready to be integrated with OpenCV.

3. Download OpenCV 2.3 . Extract to a folder (say /home/user/Opencv-2.3)

  • There still are a few packages of ffmpeg like libavcodec-dev, libavutil-dev, etc which need to be present in /usr/local/ffmpeg/ . But, the above  install of ffmpeg doesnt create this. So, open Add/Remove Programs and install following or install using yum:

sudo yum -y install ffmpeg ffmpeg-devel ffmpeg-libs

  • Now, the requisite libraries are all present in the location OpenCV can find them. Open terminal and cd to the OpenCV folder.. i.e.

cd /home/user/OpenCV-2.3

  • Create a folder called Release

mkdir Release

  • cd to the Release folder and type the following to install OpenCV

cd Release/

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_CUDA=OFF -D WITH_V4L=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_FFMPEG_BUILD=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_IPP=OFF -D BUILD_EXAMPLES=ON ..

make -j 2

sudo make install

  • Few more steps need to be done to ensure flawless build.

sudo gedit /etc/ld.so.conf.d/opencv.conf

(Type the following and save-close the file) : /usr/local/lib

sudo ldconfig

sudo gedit /etc/bashrc

(Type the following and save-close the file) :

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

And you are done !!! 🙂 OpenCV 2.3 with ffmpeg support is ready to be used on Fedora 15 with full webcam support.. ENJOY !!

NOTE : due to requests for Ubuntu specific steps, i’ll put the changed steps in this post itself in a few days

Advertisements

4 thoughts on “Install OpenCV 2.3 with video support in Fedora 15

  1. i cannot see the option WITH_V4L in cmake-gui and when I add it manually it doesn’t seem to change anything. do you have any idea of what this could be?

  2. Its a package in the distros repos, libv4l (video for linux).. Its needed for handling webcam live stream. Certain changes in kernel have taken place recently because of which webcams had stopped working in OpenCV. With libv4l installed and this option supplied, it worked fine for me. just test for your system if webcam streams are working fine or not..

  3. hi, im quite new to fedora and i want to know if there is a faster way to download the packages or i have to add them manually, also when i tried to use cmake the terminal says it’s not a valid command. thanks in advance for any help

  4. you can try doing:

    yum install “Development Tools”

    This will install most of the dev packages needed..
    As for cmake, it might not be available in your system..do a :

    yum install cmake

    And that should solve your problem..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s