{"id":220,"date":"2012-12-01T18:48:07","date_gmt":"2012-12-01T21:48:07","guid":{"rendered":"http:\/\/www.samontab.com\/web\/?p=220"},"modified":"2021-03-03T09:15:37","modified_gmt":"2021-03-02T22:15:37","slug":"installing-opencv-in-the-nokia-n900-maemo","status":"publish","type":"post","link":"https:\/\/www.samontab.com\/web\/2012\/12\/installing-opencv-in-the-nokia-n900-maemo\/","title":{"rendered":"Installing OpenCV in the Nokia N900 (maemo)"},"content":{"rendered":"<p>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.<\/p>\n<p><a href=\"http:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/10\/opencv-in-the-nokia-n900.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-223 alignleft\" title=\"opencv-in-the-nokia-n900\" src=\"http:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/10\/opencv-in-the-nokia-n900-300x200.jpg\" alt=\"\" width=\"300\" height=\"200\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/10\/opencv-in-the-nokia-n900-300x200.jpg 300w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/10\/opencv-in-the-nokia-n900.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>First of all make sure that you <strong>back up all your N900 data<\/strong>. No kidding. We are going to make some changes that could possibly <strong>brick your phone<\/strong>. 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.<\/p>\n<p>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 (<a href=\"http:\/\/opencv.org\/\">OpenCV<\/a>), which is the library we are going to install on the N900.<\/p>\n<p>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.<\/p>\n<p>To manage your repositories on your N900, go to the <em>App. Manager<\/em> and click on the menu on top (where it says <em>Application manager<\/em>). There, select <em>Application Catalogs<\/em>.<\/p>\n<p>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.<\/p>\n<p>Now, let&#8217;s add some catalogs. Click on the <em>New<\/em> button and fill in the information provided for the three following catalogs:<\/p>\n<p><strong>Maemo SDK<\/strong>: This catalog provides core system utilities that we will need to build programs.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nCatalog Name: Maemo SDK\nWeb address: http:\/\/repository.maemo.org\/\nDistribution: fremantle\/sdk\nComponents: free non-free\nDisabled: Unchecked\n<\/pre>\n<p><strong>Maemo tools<\/strong>: This catalog provides tools that are very useful, like nano or wget.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nCatalog Name: Maemo tools\nWeb address: http:\/\/repository.maemo.org\/\nDistribution: fremantle\/tools\nComponents: free non-free\nDisabled: Unchecked\n<\/pre>\n<p><strong>Maemo extras-testing<\/strong>: This catalog provides more applications than the ones in the default Maemo catalog (extras), although they are not as thoroughly tested.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nCatalog Name: Maemo extras-testing\nWeb address: http:\/\/repository.maemo.org\/extras-testing\/\nDistribution: fremantle\nComponents: free non-free\nDisabled: Unchecked\n<\/pre>\n<p>These catalogs provide different applications that we will need later. Enable all of them.<\/p>\n<p>Now exit the <em>Application Catalogs<\/em> screen. The N900 will automatically update the list of applications after you changed the repositories. If you didn&#8217;t see any update, click on the <em>Update<\/em> button just to be sure. Now click on <em>Download-&gt;All<\/em> to see the list of applications available to install. You should install the following apps:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">openssh client and server\nrootsh\nsudser\nPersonal IP Address<\/pre>\n<p>When you install OpenSSH, you will be asked for a password. This is the <em>root<\/em> password, so keep it safe.<\/p>\n<p>Now close the application manager and open the console (<em>X Terminal<\/em>). In there, you will setup a password for the default user, which is <em>user<\/em>. Write this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo passwd user\n<\/pre>\n<p>And write a password for the user <em>user<\/em>, which is the default user (non root privileges). Close the console or write <em>exit<\/em> to exit.<\/p>\n<p><a href=\"http:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/01\/n900.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-200 alignleft\" title=\"n900\" src=\"http:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/01\/n900-300x234.jpg\" alt=\"\" width=\"300\" height=\"234\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/01\/n900-300x234.jpg 300w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/01\/n900.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>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 <em>root<\/em> or <em>user<\/em> using the passwords you just set for them. If you don&#8217;t have Linux installed on your computer, you can use <em><a href=\"http:\/\/filezilla-project.org\/\">Filezilla<\/a><\/em> for FTP and <em><a href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/\">PuTTy<\/a><\/em> for SSH. Make sure that you can connect to your N900 with the <em>user<\/em> account.<\/p>\n<p>Now we will be working with the command line only, so I suggest you to connect from your computer via SSH (as <em>user<\/em>) for easier writing (or copy pasting). Make sure that the <em>App. Manager<\/em> is closed before continuing.<\/p>\n<p>On the console, write the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo apt-get install build-essential wget grep-gnu libglibmm-2.4-dev nano libpng12-dev libjpeg62-dev libtiff4-dev libgtk2.0-dev unzip\n<\/pre>\n<p>It should install all these packages without a problem. If it asks &#8220;<em>Install these packages without verification?<\/em>&#8221; Answer <strong>yes<\/strong>.<\/p>\n<p>OK, your N900 is ready to compile software. We are now going to get and install <em>OpenCV<\/em> by writing the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">sudo apt-get install libcv4 libhighgui4 libcvaux4 opencv-doc libcv-dev libhighgui-dev libcvaux-dev<\/pre>\n<p>Once it is finished installing the packages, go to the <em>App. Manager<\/em> and <strong>disable all of the three repositories we used<\/strong> (<em>Maemo SDK<\/em>, <em>Maemo Tools<\/em>, <em>Maemo extras-testing<\/em>).<\/p>\n<p>Now let&#8217;s check that everything is correctly installed. Run this command:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npkg-config --libs --cflags opencv\n<\/pre>\n<p>You should see something similar to:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">-I\/usr\/include\/opencv  -lcv -lhighgui -lcvaux -lml -lcxcore<\/pre>\n<p>Now you have OpenCV correctly installed in your N900. Great!, now what?.<\/p>\n<p>Let&#8217;s compile something. First, download this example that I prepared:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nwget http:\/\/www.samontab.com\/web\/files\/opencv-n900-test.zip\nunzip opencv-n900-test.zip\n<\/pre>\n<p>Compile the project with this line:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">g++ -o test main.c `pkg-config --libs --cflags opencv`<\/pre>\n<p>And now you can run it with this command:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">.\/test lena.jpg<\/pre>\n<p>It will read an image (<em>lena.jpg<\/em> by default if none is given in the command line), invert the value of the pixels, and save the processed image as <em>processedImage.png<\/em>.<\/p>\n<p>You should see something like this:<\/p>\n<p><a href=\"http:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/10\/opencv-test.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-222\" title=\"opencv-test\" src=\"http:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/10\/opencv-test-300x200.jpg\" alt=\"\" width=\"300\" height=\"200\" srcset=\"https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/10\/opencv-test-300x200.jpg 300w, https:\/\/www.samontab.com\/web\/wp-content\/uploads\/2012\/10\/opencv-test.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>And that&#8217;s it. Now you can use OpenCV in your Nokia N900!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,30,4],"tags":[],"class_list":["post-220","post","type-post","status-publish","format-standard","hentry","category-open-source","category-opencv","category-programming"],"_links":{"self":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/posts\/220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/comments?post=220"}],"version-history":[{"count":0,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/posts\/220\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/media?parent=220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/categories?post=220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/tags?post=220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}