Thursday, July 29, 2010

Install OpenCV in Ubuntu 10.04

I found this great tutorial on

OpenCV is an excellent library for Computer Vision. I have been using it for years and it helped me a lot during my master thesis.

OpenCV 1.0 can be easily installed in Ubuntu via the repositories. You can install OpenCV 2.0 by following one of my previous posts

Unfortunately, the newer version of OpenCV, 2.1, which was released on April has a slightly different installation procedure. Since it contains many bug fixes and some nice new additions, I will show you how to install it.

Here are the steps that I used to successfully install OpenCV 2.1 in Ubuntu 9.10. I have used this procedure for previous versions of Ubuntu as well with minor modifications (if any).

First, you need to install many dependencies, such as support for reading and writing jpg files, movies, etc… This step is very easy, you only need to write the following command in the Terminal

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

The next step is to get the OpenCV 2.1 code:

cd ~
tar -xvf OpenCV-2.1.0.tar.bz2
cd OpenCV-2.1.0/

In this version of OpenCV, the configure utility has been removed. Therefore you need to use Cmake to generate the makefile. Just execute the following line at the console. Note that there is a dot at the end of the line, it is an argument for the cmake program and it means current directory.

cmake .

Check that the above command produces no error and that in particular it reports FFMPEG as 1. If this is not the case you will not be able to read or write videos.

configuring opencv2.1

Now, you are ready to compile and install OpenCV 2.1:

sudo make install

Now you have to configure the library. First, open the opencv.conf file with the following code:

sudo gedit /etc/

Add the following line at the end of the file(it may be an empty file, that is ok) and then save it:


Run the following code to configure the library:

sudo ldconfig

Now you have to open another file:

sudo gedit /etc/bash.bashrc

Add these two lines at the end of the file and save it:


Finally, open a new console, restart the computer or logout and then login again. OpenCV will not work correctly until you do this.

Now you have OpenCV 2.1 installed in your computer.

Let’s check some demos included in OpenCV:

cd ~
mkdir openCV_samples
cp OpenCV-2.1.0/samples/c/* openCV_samples
cd openCV_samples/
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. I will use one of the frontal face detectors available. Let’s find a face:

./facedetect --cascade="/usr/local/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg

Note the scale parameter. It allows you to increase or decrease the size of the smallest object found in the image (faces in this case). Smaller numbers allows OpenCV to find smaller faces, which may lead to increasing the number of false detections. Also, the computation time needed gets larger when searching for smaller objects.

In OpenCV 2.1, the grabcut algorithm is provided in the samples. This is a very nice segmentation algorithm that needs very little user input to segment  the objects in the image. For using the demo, you need to select a rectangle of the area you want to segment. Then, hold the Control key and left click to select the background (in Blue). After that, hold the Shift key and left click to select the foreground (in Red). Then press the n key to generate the segmentation. You can press n again to continue to the next iteration of the algorithm.

./grabcut lena.jpg

This image shows the initial rectangle for defining the object that I want to segment.

Now I roughly set the foreground (red) and background (blue).

When you are ready, press the n key to run the grabcut algorithm. This image shows the result of the first iteration of the algorithm.

Now let’s see some background subtraction from a video. The original video shows a hand moving in front of some trees. OpenCV allows you to separate the foreground (hand) from the background (trees).

./bgfg_segm tree.avi

There are many other samples that you can try.

Sunday, July 25, 2010

5 Cool Sites for buying Computers Preinstalled with Linux

Dell has all but bowed to pressure from Microsoft to torpedo its Ubuntuline of computers. Add that to the relative success of Windows 7 among Redmond's user base and you get a clearer picture of what is going on.
In case you are wondering, there are still lots of other vendors that offer a choosy range of machines preinstalled with Linux for your convenience. The following 5 are just a sample of the lot
This site has a respectable array of desktop and laptop computers fitted with Ubuntu Linux ready for use. Prices start from $399 and you can also customize each machine to fit your hardware specification tastes at an extra price. They also other Linux peripherals like audio players (another name for iPod), cameras, printers among others.
Linux Certified
This site also has a range of laptops that ship with either of six distros namely Ubuntu, RedHat, Centos, OpenSuse, Fedora and Oracle Linux.
All the machines are also customizable to your taste for extra bucks. They also offer an optional dual-boot configuration with Windows for those who need the latter for special reasons.
One of the most popular Ubuntu centric OEMs out there, ZaReason stocks a wide array of machines; desktops, laptops and servers to suit various needs and specifications.They also stock some peripherals to add some spice to your machine.
Emperor Linux
According to this company
"EmperorLinux provides Linux laptops with full hardware support under Linux. Since 1999, we have supplied systems to a wide range of customers, including engineers, physicists, mathematicians, and astronomers at over 50 different government labs and over 200 universities. We have supplied hundreds of corporate clients, as well. If you use Linux in these environments, EmperorLinux is your sole source."
Another of the well known Ubuntu centric manufacturers, System76 has some of the widest assortment of Linux machines out there. Their flagship machine, the Serval Professional is a machine that will make any geek go green with envy.
There are a lot more niche manufacturers that gladly ship computers preloaded with Linux. They may not have the clout of Dell, but they do a good job of giving you value for money and from what I have read, unparalleled support in your use of their machines.  If you ever think of buying a Linux machine, you might want to give any of these a try!

via []

Portable Apps for Linux

Portable Apps for Windows and Mac have been around for a long time, but are less common in the Linux world. Due to the complexity of Linux dependencies, and the different way different distributions locate these dependencies, the portable Linux application long seemed like a pipe dream.

Until now.

New website PortableLinuxApps features a number of portable Linux applications, which will work on any Linux distribution. These can run off your flash drive or from a folder in your home directory; it doesn’t matter. Best of all, there’s documentation out there to help you make your own program, should you not be able to find what you’re looking for.

How It Works

Like portable applications for other operating systems, portable Linux apps bundle each and every dependency a program has within a single executable. This has downsides: applications with redundent dependencies will take up more hard drive space, for example. For many the convinence of portable applications outweight this negative, particularly in our present age of cheap hard drives.

Because every dependency of each program is bundled in the program itself, these portable Linux apps can run on practically any Linux distro (although I’m certain someone in the comments will manage to prove this wrong). Ubuntu, Fedora and SuSe are all confirmed to work with these apps, which is a solid start.

Just remember: once you download such an app, remember that you’ll need to change the permission to allow executing the file as a program. If you’re not sure how to do this the simplest way is to right-click the file, then click “Properties” followed by the “Permissions” tab. You’ll find the option to allow execution at the bottom of the window:

portable linux

One Online Collection

It would seem that, for now, is the place to find…well…portable Linux apps.

portable linux apps

The collection currently is quite small but features many MakeUseOf favourites, including:

  • DosBox, a DOS emulator for playing old games.
  • Handbrake, the best way to convert video.
  • Transmission, the light BitTorrent program.
  • Pidgin, the universal IM program.

Just download the software, set the permissions and you’re good to go!

Rolling Your Own

Can’t find a particular program you’re looking for? You can bundle it yourself! The process is relatively easy, if not a little convoluted. The good folks at OMG Ubuntu recently wrote a post explaining how to convert an Ubuntu .deb file into a portable app, so check that out for more information.

Here’s hoping that in the future creating a portable app from a .deb file will be a two-click affair!


portable linux apps

Package management is perhaps what makes Linux great, but it’s also one of the most common complaints newcomers to Linux have. Being used to simply Googling and downloading any program needed, the average new users are a little confused by what they find: .tar.gz files or worse.

This is made worse by the sheer number of different Linux distros on the market, and the fact that they all have different ways of managing packages. The best thing to do, of course, is to learn to use your distro’s package manager. But portable apps are cool, and certainly have their place.

Can you think of cool uses for such technology? Have any apps you’ve bundled yourself that you’d like to share? Let us know in the comments below!


Saturday, July 24, 2010

KeePassX: Password Manager for Ubuntu

KeePassX Password Safe is a free, open-source, light-weight and easy-to-use password manager for Linux, Windows and Mac OSX. Originally KeePassX was called KeePass/L for Linux since it was a port of Windows password manager Keepass Password Safe. After KeePass/L became a cross platform application, it changed it's name to KeePassX
KeePassX offers a little utility for secure password generation. The password generator is very customizable, fast and easy to use. Especially someone who generates passwords frequently will appreciate this feature.

The complete database is always encrypted either with AES (alias Rijndael) or Twofish encryption algorithm using a 256 bit key. Therefore the saved information can be considered as quite safe. KeePassX uses a database format that is compatible with KeePass Password Safe. This makes the use of that application even more favourable.
Ubuntu users: the application is available in the Ubuntu repositories, but if you want to install the latest version (which was released yesterday), you can either add the KeePassX PPA, or direct download of .deb files (see below).
Download KeePassX / KeePass (Windows, Ubuntu repository, openSUSE, Fedora 10 & 11 and Mac OSX) |

 Download Ubuntu .deb

Ubuntu Tweak 0.5.5 Released

A new version of Ubuntu Tweak has been released today: 0.5.5. There's no official announcement yet, but the new version is now available in the Ubuntu Tweak stable PPA.

Looking and the BZR changelog, there's only one new major feature in Ubuntu Tweak 0.5.5:PPA Purge (which was also available in the WebUpd8 PPA by the way), which you can now use from within Ubuntu Tweak.

PPA Purge can remove a PPA and downgrade all the packages you've installed from that PPA to the official version in the Ubuntu repositories. An example: suppose you add the c-korn/vlc PPA and install VLC 1.1.1 but you want to go back to VLC 1.0.6 which is available in the Ubuntu official repositories. Using PPA Purge, the c-korn/vlc PPA will be removed and VLC 1.1.1 will be downgraded to version 1.0.6 (there's one catch though: make sure you don't have any other PPAs with VLC 1.1.1 or 1.1.0 and so on).

PPA Purge can be found in Ubuntu Tweak under Applications > Package Cleaner.

ubuntu tweak purge ppa

Ubuntu Tweak 0.5.5 also brings support for Ubuntu 10.10 Maverick Meerkat and also, itcan now detect if you're using Ubuntu Netbook Edition or Lubuntu.

Install Ubuntu Tweak 0.5.5:

sudo add-apt-repository ppa:tualatrix/ppa 
sudo apt-get update
sudo apt-get install ubuntu-tweak

Note: The Ubuntu Tweak "About" dialog currently says "" instead of "0.5.5". That's a display bug, if you have the Ubuntu Tweak PPA added and upgrade, you'll have version 0.5.5.

Friday, July 16, 2010

5 Ubuntu power tips

The masses seem to think that Ubuntu is reserved for the newer users. Although it is true that this Linux distribution is ideal for new users, that doesn’t mean that’s the only market for Ubuntu. In fact, Ubuntu is perfectly suited for all levels of users.

Since most tips you see for Ubuntu are geared toward new user, we’re going to take it up a notch and offer some tips for the Ubuntu power users. These tips will vary in scope and level of expertise but all will improve your Ubuntu Linux experience.

1: Decrease your boot time

Did you know that you can profile your Ubuntu boot process to streamline it? This tool has been available since Ubuntu 6.04, and with the increased speed of 10.04, it can now bring your boot process to an incredibly low time. To do this all you need to do is edit your /etc/default/grub file and change the line:



GRUB_CMDLINE_LINUX_DEFAULT="quiet splash profile"

Now issue the command:

sudo update-grub2

and reboot your machine. This next boot will take a bit longer than the standard period because the profiling is occurring. After this boot, remove the “profile” option from your grub file (which you just added above), issue the update-grub2 command again, and you will notice much faster boot times.

2: Launch applications with keyboard shortcuts

Removing your fingers from the keyboard is inefficient computing. Any good programmer will tell you this. But to make this as efficient as possible, you need to create keyboard shortcuts. To do this in the GNOME desktop, you have to visit your old pal gconf-editor. When you have that open, navigate to apps > metacity > global_keybindings, where you can edit any of the 12 run_command_X (where X is a number between 1 and 12) to be used to launch your favorite application or command.

3: Update without an Internet connection

With the help of a one-time Internet connection, you can create a CD that will help you update all your other Ubuntu machines. The tool you need is called APTonCD. This tool creates a CD/DVD of all the necessary updates for your Ubuntu machine. You can then take that disc to each of your machines, insert it, and update with the help ofdpkg. The APTonCD has an outstanding GUI that will walk you through the process of creating a usable CD/DVD.

4: Speed up your popup menus

If you’re like me, the delay between clicking on a menu and the appearance of a menu can be annoying — even though we’re talking milliseconds. I prefer to remove that delay so that as soon as I click, the menu appears. This is a simple trick for the GNOME desktop. Open up the file ~/.gtkrc-2.0 and add the line:

gtk-menu-popup-delay = 0

to the bottom of that file. Save the file, log out, and log back in. Your menus should now appear as soon as the thought crosses your mind.

5: Create Nautilus actions

The ability to right-click a file and run an action makes the desktop life so much easier. The GNOME desktop, along with the Nautilus file manager, offers a great feature that many do not even know exists: the Nautilus Actions Configuration Tool. You will find this tool in System > Preferences > Nautilus Actions Configuration. From within this window, you can roll your own actions, which will then be added to the right-click context menu from within Nautilus. You will need to set up five tabs of information: Action, Command, Folders, Conditions, and Advanced Conditions. This tool also allows you to import actions that others have created. Say you want to create a mailto action using Thunderbird. This one is simple. The only challenging section will be the command. For the command section (in the Command tab) enter:

Path: /usr/bin/thunderbird
Parameters: -compose 'attachment=file://%f'

The rest of the options should be fairly obvious to complete. Issue the command killall nautilus. After Nautilus restarts, you should have a new right-click content menu entry for the mailto.

Tap into the power

These are just a few samples of what you can do with a Ubuntu desktop (and/or server, in some instances). Ubuntu is a user-friendly AND powerful operating system. We’ll share more of these power tips in the future.


Sunday, July 4, 2010

Transmission 2 for Ubuntu

Transmission is the default bit torrent client in Ubuntu. It is one of my favorite bit torrent clients. Its simple interface is the thing I like the most about Transmission. Although it many seem inferior compared to some other bit torrent clients, it is still a very good client and has all the features most people would need.

With the release of Transmission 2.0, it has just become a lot better. Transmission 2.0 has a number of improvements/changes from the previous version. These includes:

  • More lightweight and faster startup time.
  • “Local peer discovery” to discover peers in the local network.
  • Better tracker announcement.
  • Use of IEC standards.

If you are using Ubuntu, here is how you can install it:

Open the Terminal.

Add the PPA ppa:transmissionbt/ppa with the command:

$ sudo add-apt-repository ppa:transmissionbt/ppa

Then update the software list with

$ sudo apt-get update

Finally upgrade with the command

$ sudo apt-get upgrade

Or, if you want to upgrade only Transmission execute (the above command will update the whole system)

$ sudo apt-get install transmission

Related Content

Related Posts with Thumbnails