Skip to content


Installing OpenCV in the Nokia N900 (maemo)

In this post, I will describe the entire procedure needed to install OpenCV and compile your computer vision applications in the Nokia N900 from scratch. This means that you can make advanced computer vision processing on the go.

First of all make sure that you back up all your N900 data. No kidding. We are going to make some changes that could possibly brick your phone. This means that you may need to re flash your firmware if anything goes wrong. If you are not OK with this, stop reading. I will not be held responsible for any problems you may encounter. You have been warned.

The N900 is an awesome device, it is a Linux computer in the form of a smartphone. Because of that, you can do pretty much anything you could do on a regular Linux computer and more, since you have all the extra features of a smartphone like sensors and a battery. One of the things a regular Linux computer can do is to use an advanced computer vision library (OpenCV), which is the library we are going to install on the N900.

The first step is to configure the repositories. A repository is a place where programs are stored. You can have different repositories available on your system. Each repository that you have enabled in your system allows you to install different sets of programs. Note that on the N900, repositories are called catalogs.

To manage your repositories on your N900, go to the App. Manager and click on the menu on top (where it says Application manager). There, select Application Catalogs.

Here (maybe after waiting a little) you will see the current list of enabled and disabled catalogs. Disabled catalogs are not considered by the system, so all the applications you can install come from the enabled catalogs. Write down which catalogs are enabled and which ones are disabled as this is your original configuration and you may want to go back to it after we are finished.

Now, let’s add some catalogs. Click on the New button and fill in the information provided for the three following catalogs:

Maemo SDK: This catalog provides core system utilities that we will need to build programs.

Catalog Name: Maemo SDK
Web address: http://repository.maemo.org/
Distribution: fremantle/sdk
Components: free non-free
Disabled: Unchecked

Maemo tools: This catalog provides tools that are very useful, like nano or wget.

Catalog Name: Maemo tools
Web address: http://repository.maemo.org/
Distribution: fremantle/tools
Components: free non-free
Disabled: Unchecked

Maemo extras-testing: This catalog provides more applications than the ones in the default Maemo catalog (extras), although they are not as thoroughly tested.

Catalog Name: Maemo extras-testing
Web address: http://repository.maemo.org/extras-testing/
Distribution: fremantle
Components: free non-free
Disabled: Unchecked

These catalogs provide different applications that we will need later. Enable all of them.

Now exit the Application Catalogs screen. The N900 will automatically update the list of applications after you changed the repositories. If you didn’t see any update, click on the Update button just to be sure. Now click on Download->All to see the list of applications available to install. You should install the following apps:

openssh client and server
rootsh
sudser
Personal IP Address

When you install OpenSSH, you will be asked for a password. This is the root password, so keep it safe.

Now close the application manager and open the console (X Terminal). In there, you will setup a password for the default user, which is user. Write this:

sudo passwd user

And write a password for the user user, which is the default user (non root privileges). Close the console or write exit to exit.

OK, on the N900 desktop you now should be able to see your current IP address. You can use that IP to connect via SSH or FTP to your N900 with either root or user using the passwords you just set for them. If you don’t have Linux installed on your computer, you can use Filezilla for FTP and PuTTy for SSH. Make sure that you can connect to your N900 with the user account.

Now we will be working with the command line only, so I suggest you to connect from your computer via SSH (as user) for easier writing (or copy pasting). Make sure that the App. Manager is closed before continuing.

On the console, write the following:

sudo apt-get install build-essential wget grep-gnu libglibmm-2.4-dev nano libpng12-dev libjpeg62-dev libtiff4-dev libgtk2.0-dev unzip

It should install all these packages without a problem. If it asks “Install these packages without verification?” Answer yes.

OK, your N900 is ready to compile software. We are now going to get and install OpenCV by writing the following:

sudo apt-get install libcv4 libhighgui4 libcvaux4 opencv-doc libcv-dev libhighgui-dev libcvaux-dev

Once it is finished installing the packages, go to the App. Manager and disable all of the three repositories we used (Maemo SDK, Maemo Tools, Maemo extras-testing).

Now let’s check that everything is correctly installed. Run this command:

pkg-config --libs --cflags opencv

You should see something similar to:

-I/usr/include/opencv  -lcv -lhighgui -lcvaux -lml -lcxcore

Now you have OpenCV correctly installed in your N900. Great!, now what?.

Let’s compile something. First, download this example that I prepared:

wget http://www.samontab.com/web/files/opencv-n900-test.zip
unzip opencv-n900-test.zip

Compile the project with this line:

g++ -o test main.c `pkg-config --libs --cflags opencv`

And now you can run it with this command:

./test lena.jpg

It will read an image (lena.jpg by default if none is given in the command line), invert the value of the pixels, and save the processed image as processedImage.png.

You should see something like this:

And that’s it. Now you can use OpenCV in your Nokia N900!

Posted in Open Source, OpenCV, Programming.


8 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. a.k. says

    thanks :-)

  2. a.k. says

    I suggest writing
    “sudo apt-get update && sudo aptitude install build-essential”
    before
    “sudo apt-get install build-essential wget grep-gnu libglibmm-2.4-dev nano libpng12-dev libjpeg62-dev libtiff4-dev libgtk2.0-dev unzip”

  3. samontab says

    You are welcome a.k.

  4. samontab says

    Thanks for the suggestion a.k, but does it make any difference?
    If you follow the post, you will run update from the GUI, and build-essential is already listed in the libraries to install, so I do not see why or how adding that line will give you any different result.

  5. Salma says

    Hi, is it possible to install opencv on a windows phone device, like the nokia lumia?

  6. samontab says

    Hello Salma,

    Currently, I do not think it is possible to do a full install of OpenCV on a WP7.
    Nonetheless, there is a C# port of the object detection code of OpenCV that can be run on the phone, so you can for example detect faces.
    Here is the link:
    http://www.codingbeta.com/finally-face-detection-for-windows-phone/

    Just curious, want do you want to do in the phone?

  7. Piyush says

    Can I install other libraries of open CV like imgproc,objdetect to carry out face recognition in the maemo device..??
    And how..??

  8. samontab says

    Hello Piyush,

    In the tutorial I teach how to install the full OpenCV libraries in the maemo device. Any program that works with OpenCV should now compile and work on the N900 as well. All the libraries that you mention are already installed, you just need the program itself.



Some HTML is OK

or, reply to this post via trackback.