Installing OpenCV on Ubuntu Desktop and Beagleboard-XM

Requirements:
  • Ubuntu Linux already installed on a PC or on Beagleboard-XM


To install Ubuntu on Beagleboard-XM, you can find instructions here.

First and foremost, to make sure that all packages are up to date, open terminal and type:


Installing OpenCV consists of setting up quite a bit of installations that would be painstaking to install package by package. To handle this I used a script. I do not claim this script as my own although I can't seem to locate the website that I got it from. I've modified it to my needs and it works nicely. You can learn about simple scripts at www.linuxcommand.org/wss0010.php. To begin, open gedit in terminal:


You can name the script as anything you choose with the extension ".sh". For this example, I will save it as OpenCV2.4.3.sh into my home folder. In gedit, copy and paste this script then save it and close the gedit window:



You should now have a file called OpenCV2.4.3.sh in your home folder. We now have to give the file permission to execute. In terminal type:


We are now ready to run the script. This script includes the installations ffmpeg, x264 codecs,v4L video files for usb camera capabilities, OpenCV and all it's dependencies. To execute the script, in terminal type:



During the execution of these tasks, answer any prompts that may come up in the affirmative. This process can take up to a few hours for a PC computer and longer for the Beagleboard. By the end of the script however, OpenCV should be ready to be used fully.

You can test the operation of OpenCV by running the "build_all" script that should be found in the install OpenCV folder at /usr/local/share/OpenCV/samples/c. To test, in terminal type the following instructions one after the other:


You should then see all the files in that folder compiling. If they all compile without errors then you are good to go!!

You can also see a program in action after compiling by typing in terminal: 



You may demo any of the files in that folder with the same methods. After running the build_all script, they should all be compiled and ready to run. Enjoy!!

6 comments:

  1. are u absolutely sure this will work on my beaglexm running quantal?

    if the same script goes for both PC and beagle, how will the compilers be different?

    ReplyDelete
  2. Yes, I am sure this will work being that this script installs everything you need including the files needed for compiling such as the cmake, python and C compilers. This process should work as long as you are using Ubuntu for either PC or Beagleboard. Using this script the compilers will be similar.

    ReplyDelete
  3. i have memory card on which i have boot ubuntu 12.04 console. its working on beagle boardxm. now im try to install open cv on it but m getting problems with installing packages....error im getting is libtbb-dev has no installation candidate.i have corrected with editing sources list bt im still having same problem. if i go through ur method but gedit is also not there

    ReplyDelete
    Replies
    1. If you don't have gedit, then install by typing: sudo apt-get install gedit. That should install gedit. As for libtbb-dev, it should be part of the 12.04 packages. It hasn't changed on the ubuntu package website so it should work. You can also try the libtbb2 package. http://packages.ubuntu.com/search?keywords=libtbb-dev&searchon=names&suite=precise&section=all

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. i have memory card on which i have boot ubuntu 12.04 console. its working on beagle boardxm. now im try to enable SPI on it.what are the steps?

    ReplyDelete