Installing OpenCV on Linux (Ubuntu Version)

OpenCV is an excellent library for Computer Vision. I have just learned it from my lecture about 30 minutes, and it was quite fun. But, he was using windows xp and microsoft visual studio 2008 enterprise edition that night. Oh no… I’m totally stuck. Because I’m using Linux for my laptop.

How to install it on Linux?

It was a piece of cake. If you’re using ubuntu, you can type this command line into your terminal (Applications > Accessories > Terminal):

$ sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev

Next step is to get the OpenCV:
$ wget

Unpack it:
$ tar -xvf OpenCV-2.1.0.tar.bz2

Enter its directory:
$ cd OpenCV-2.1.0

Now, you’re ready to install:
$ cmake .

Hopefully you will not getting error after run that command.

Compile and install the OpenCV:
$ make && sudo make install && sudo ldconfig

That’s it. Now you have installed into your computer.

Let’s check some demos here:
$ cd OpenCV-2.1.0/samples/c
$ chmod +x
$ ./

Some of the training data for object detection is stored in /usr/local/share/opencv/haarcascades. You need to tell OpenCV which training data to use. Let’s see the examples.

$ ./facedetect --cascade="/usr/local/share/opencv/haarcascades/haarcascades_frontalface_alt.xml" putra.jpg

Have fun, dude… 😀

Lucky Borneo

Lucky is lucky, just lucky.