Old: Ver.1 - 3: Compiling OpenCV on Ubuntu 10.04.1

Japanese, Casper Cartridges, kameda-lab.org 2010/11/22b, (2012/10/10)

Latest Version

New Casper Cartridge (newer than Ver.3) is ready now.
Access the page from this link.
[Casper Cartridge Top]


Ver.1-3 overview cartridge list why casper? internal set-up OpenCV samples ARToolKit PTAM OpenCV/svn

Abstract

You are assumed to have a bootable USB memory stick of Ubuntu 10.04.1 LTS.


Basic Setup

  1. Time zone
    [Menu] System - Administration - Time and Date
    Then, Time zone : Asia/Tokyo (or where you live).

  2. System clock
    If you set your local time to PC's system clock and you want to use that on Ubuntu too, turn off the UTC flag.
    $ sudo gedit /etc/default/rcS
    And then change "UTC=yes" to "UTC=no".

  3. Emacs
    If you are going to install emacs, you can suppress error messages by:
    $ sudo gedit /usr/share/themes/Ambiance/gtk-2.0/gtkrc
    And then change "GtkRange::trough-under-steppers = 0" to "GtkRange::trough-under-steppers = 1".


Compile OpenCV 2.1.0

  1. Preparation
    Some (freeglut3, dc1394, emacs) are not mandatory, but I recommend you to have these.
    (If you seem to fail installing some packages, try "apt-get update" to catch up recent changes.)
    $ sudo apt-get install freeglut3-dev
    $ sudo apt-get install libdc1394-22-dev
    $ sudo apt-get install cmake g++ libavformat-dev libswscale-dev
    $ sudo apt-get update
    $ sudo apt-get install libgtk2.0-dev
    $ sudo apt-get install emacs
  2. Download OpenCV
    From OpenCV web site, download OpenCV-2.1.0.tar.bz2 .
    Suppose you put that at your home, "/home/ubuntu".

  3. Exract OpenCV
    $ cd
    $ tar xvfj OpenCV-2.1.0.tar.bz2

  4. Quick-fix of SURF-zero-bug
    SURF of OpenCV 2.1.0 sometims fails (dump) when there is few textures. It is reported as a bug, so fix that in quick way.
    $ cd
    [Download SURF-BUG-fixed cvsurf.cpp (cvsurf-by-kameda.cpp)]
    $ mv OpenCV-2.1.0/src/cv/cvsurf.cpp OpenCV-2.1.0/src/cv/cvsurf.cpp-zerobug
    $ cp cvsurf-by-kameda.cpp OpenCV-2.1.0/src/cv/cvsurf.cpp
    [Ref : surf-crash.diff]

  5. Prepare building-directory of OpenCV
    You can compile OpenCV source tree at different directoy by using cmake.
    $ cd
    $ mkdir OpenCV-2.1.0-build
    $ cd OpenCV-2.1.0-build

  6. Compile OpenCV
    Now it sholuld be easy.
    $ cd
    $ cd OpenCV-2.1.0-build
    $ cmake ../OpenCV-2.1.0
    $ make
    $ sudo make install
    $ sudo ldconfig

  7. All set!
    You may reboot the system and enjoy!


Next

Let's go to OpenCV sample programs.


(KAMEDA, Yoshinari) kameda[at]iit.tsukuba.ac.jp, kameda[at]ieee.org