… corat – coret …

Installing OpenCV on Linux (Ubuntu Version)

Posted in Linux, Tricky, Ubuntu by luckyborneo on October 6, 2010

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 http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.1/OpenCV-2.1.0.tar.bz2

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 build_all.sh
$ ./build_all.sh

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… πŸ˜€

Tagged with: , , ,

4 Responses

Subscribe to comments with RSS.

  1. Utkarsh said, on October 10, 2010 at 10:22 am

    OpenCV is one real good library! It’s used almost everywhere – cars, computers, android, iphone, whatever you can think of πŸ™‚ In fact, I’ve put up a comparison of OpenCV against other libraries: http://www.aishack.in/2010/07/opencv-vs-vxl-vs-lti-performance-test/ this might interest you!

    • luckyborneo said, on October 10, 2010 at 7:35 pm

      Wow.. what a nice information there! Your blog is awesome… πŸ˜‰
      But.. can those libraries be installed on Linux? I still newbie here. Thank you very much about the information, Utkarsh. I will learn more from you.

  2. tychuot101 said, on October 24, 2013 at 7:17 pm

    To install OpenCV using the terminal on Ubuntu:
    $ su –
    # apt-get update
    # apt-get install build-essential
    # apt-get install libavformat-dev
    # apt-get install x264 v4l-utils ffmpeg
    # apt-get install libcv2.3 libcvaux2.3 libhighgui2.3 python-opencv opencv-doc libcv-dev libcvaux-dev libhighgui-dev


    • luckyborneo said, on July 30, 2014 at 4:54 pm

      Thank you, Tychuot101
      Another way to install OpenCV. This step is very easy for beginner. By the way, nice blog that you have… *wink*

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

%d bloggers like this: