Posted by: sirivy | October 11, 2012

Just a note for OpenCV 2.4.2 installation on Ubuntu 12.04

I just got a new computer for my project. I have to install everything from a fresh Ubuntu. : ) Let’s start

1. Download OpenCV2.4.2 from http://opencv.org/downloads.html

2. Extract the file OpenCV-2.4.2.tar.bz2. We will get a folder OpenCV-2.4.2.

3. Move to the directory that you need. In my case, i will move it to my /home/myusername/INSTALLERS/.

NOTE: I create a folder INSTALLERS to keep the library that i download the source code and install it manually.

4. Go to your OpenCV-2.4.2 directory by using

  •  cd /home/myusername/INSTALLERS/OpenCV-2.4.2

    or

  • cd ~/INSTALLERS/OpenCV-2.4.2

    Then, I create a folder named “release” in this directory to store our compiled library which will be copied to /usr/local/lib (for the libraries) and /usr/local/include (for the header files).

    After you create a folder named “release”, you have to go to that directory by using

  • cd release

5. Inside the “release” folder, we will run cmake to configure the library and setup the libraries that we would like to use for compiling OpenCV’s source code by using

  • cmake-gui ..

    A command “cmake-gui ..” means that you’re using cmake-gui to look for the CMakeLists.txt in the /home/myusername/INSTALLERS/OpenCV-2.4.2 directory.

NOTE: If you haven’t installed cmake-qt-gui, you will get the error message like this

“The program ‘cmake-gui’ is currently not installed.  You can install it by typing:
sudo apt-get install cmake-qt-gui”

We just follow the suggestion by running “sudo apt-get install cmake-qt-gui”.

6. Install the required libraries which are as follows:

  1. ffmpeg
  2. libavcodec-dev
  3. libavformat-dev
  4. libxine2-dev
  5. libgtk-3-dev
  6. libqt4-dev
  7. libqt4-opengl (optional)
  8. libtiff4-dev
  9. libpng12-dev
  10. libboost-all-dev
  11. libswscale-dev
  12. libjasper-dev
  13. libxine-dev
  14. libeigen3-dev
  15. libtbb-dev

To install these libraries, you can install by using a command

  • sudo apt-get install libraryname

or using synaptic package manager.

NOTE: I installed another libraries for RTSP streaming for my project which are

  1. libvlccore-dev and libvlc-dev
  2. livemedia-dev and livemedia-utils

7. After running a command “cmake-gui ..”, you will see a window as shown below

You have to click at “configure” button to check the dependency libraries and then you click a “generate” button. The result of configuration on my computer is as follows:

************************************************************************************************

Detected version of GNU GCC: 46 (406)

Extracting svn version, please wait…

SVNVERSION: exported

Performing Test HAVE_CXX_PG_G

Performing Test HAVE_CXX_PG_G – Failed

Performing Test HAVE_C_PG_G

Performing Test HAVE_C_PG_G – Failed

checking for module ‘libdc1394-2’

package ‘libdc1394-2’ not found

checking for module ‘libdc1394’

package ‘libdc1394’ not found

checking for module ‘libxine’

found libxine, version 1.2.0

Looking for linux/videodev.h

Looking for linux/videodev.h – not found

Looking for linux/videodev2.h

Looking for linux/videodev2.h – found

Looking for libavformat/avformat.h

Looking for libavformat/avformat.h – found

Looking for ffmpeg/avformat.h

Looking for ffmpeg/avformat.h – not found

checking for module ‘tbb’

found tbb, version 3.0+r018

General configuration for OpenCV 2.4.2 =====================================

Platform:

Host: Linux 3.2.0-31-generic-pae i686

CMake: 2.8.7

CMake generator: Unix Makefiles

CMake build tool: /usr/bin/make

Configuration: Release

C/C++:

Built as dynamic libs?: YES

C++ Compiler: /usr/bin/c++ (ver 4.6.3)

C++ flags (Release): -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -march=i686 -msse -msse2 -mfpmath=sse -O3 -DNDEBUG -DNDEBUG

C++ flags (Debug): -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -march=i686 -msse -msse2 -mfpmath=sse -g -O0 -DDEBUG -D_DEBUG -ggdb3

C Compiler: /usr/bin/gcc

C flags (Release): -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -march=i686 -msse -msse2 -mfpmath=sse -O3 -DNDEBUG -DNDEBUG

C flags (Debug): -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -march=i686 -msse -msse2 -mfpmath=sse -g -O0 -DDEBUG -D_DEBUG -ggdb3

Linker flags (Release):

Linker flags (Debug):

Precompiled headers: NO

OpenCV modules:

To be built: core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree gpu legacy photo stitching ts videostab

Disabled: –

Disabled by dependency: –

Unavailable: androidcamera java python world

GUI:

QT 4.x: YES (ver 4.8.1 EDITION = OpenSource)

QT OpenGL support: YES (/usr/lib/i386-linux-gnu/libQtOpenGL.so)

OpenGL support: YES (/usr/lib/i386-linux-gnu/libGLU.so /usr/lib/i386-linux-gnu/libGL.so /usr/lib/i386-linux-gnu/libSM.so /usr/lib/i386-linux-gnu/libICE.so /usr/lib/i386-linux-gnu/libX11.so /usr/lib/i386-linux-gnu/libXext.so)

Media I/O:

ZLib: /usr/lib/i386-linux-gnu/libz.so (ver 1.2.3.4)

JPEG: build (ver 62)

PNG: build (ver 1.5.9)

TIFF: build (ver 42 – 4.0.1)

JPEG 2000: build (ver 1.900.1)

OpenEXR: NO

Video I/O:

DC1394 1.x: NO

DC1394 2.x: NO

FFMPEG: YES

codec: YES (ver 53.35.0)

format: YES (ver 53.21.0)

util: YES (ver 51.22.1)

swscale: YES (ver 2.1.0)

gentoo-style: YES

GStreamer: NO

OpenNI: NO

OpenNI PrimeSensor Modules: NO

PvAPI: NO

UniCap: NO

UniCap ucil: NO

V4L/V4L2: Using libv4l (ver 0.8.6)

XIMEA: NO

Xine: YES (ver 1.2.0)

Other third-party libraries:

Use IPP: NO

Use TBB: YES (ver 4.0 interface 6000)

Use Cuda: NO

Use Eigen: YES (ver 3.0.5)

Python:

Interpreter: /usr/bin/python (ver 2.7.3)

Documentation:

Build Documentation: NO

Sphinx: NO

PdfLaTeX compiler: NO

Tests and samples:

Tests: YES

Performance tests: YES

Examples: YES

Install path: /usr/local

cvconfig.h is in: /home/policeeyes/INSTALLERS/OpenCV-2.4.2/release

—————————————————————–

Configuring done

************************************************************************************************

8. If configuring is done, you can close the CMake-gui window and go back to terminal. In “release” folder, you have to run a command line to compile the source code by running this command

  • make

If OpenCV’s source code and dependency libraries is compiled successfully, you can install the OpenCV-2.4.2 library to Ubuntu system by using a command

  • sudo make install

If you would like to uninstall OpenCV-2.4.2, you have to come to this directory (“/home/myusername/INSTALLERS/OpenCV-2.4.2/release”) and run the following command

  • sudo make uninstall

That’s all. Enjoy OpenCV.🙂


Responses

  1. Thank youuuuuuuuuuuuuuuuuuuuuu

  2. thank you


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Categories

%d bloggers like this: