Sunday, April 14, 2013

How to install opencv(cv2) with python bindings in Linux - Ubuntu/Fedora

  1. Install gcc, g++/gcc-c++, cmake (apt-get or yum, in case of yum use gcc-c++)#apt-get install gcc, g++, cmake
  2. Downlaod latest opencv from openCV's website (
  3. Untar it #tar - xvf opencv-*
  4. Inside the untarred folder make a new folder called "release" (or any folder name) and run this command in it
    #"cmake -D

    the ".." will pull files from the parents folder and will get the system ready for installation for your specific platform.
  5. in the release folder  (#cd release) run #make
  6. After about 3-4 mins (obviously could be faster on your machine) of make processing when its finished run #make install
That's it, now go to python and try ">>> import cv2" you should not get any error message.
I've tested it on python 2.7, should be virtually similar to python 3.x.

Friday, January 4, 2013

Microsoft Office works flawlessly in Linux

Microsoft Office 2007 on Linux (Ubuntu 12.10 and Fedora)
Microsoft Office 2007 on Linux (Ubuntu 12.10 and Fedora 17)

Thanks to PlayOnLinux all Microsoft office products including Office 2007 and Office 2010 work flawlessly on Linux desktops. I tested my -purchased- version of Office 2007 on Fedora 17 and Ubuntu 12.10. Finally I can delete Windows (especially after the Windows 8 Metro confusion) and keep my laptop fast and efficient with couple of Linux Flavours.

The PlayOnLinux is based on Wine. But don’t fret, it's a much refined version compared to the manual hacks and cracks that use of Wine brings to mind. During the installation the software automatically downloads all the libraries and dll’s that Microsoft products require. The downloads are on the fly from their pre-set repositories. The process is surprisingly totally seamless and in no time your Office products will pop-up in the Ubuntu Unity Launch bar.

They also promise that all the Windows based games are playable in Linux. I still need to try my Mass Effect 3 DVD, if it manages to pull our decent FPS, then Hallelujah!

NOTE: If you like the product PlayOnLinux please consider donating to the developers, they have done an awesome job.

Thursday, January 5, 2012

How to change the boot sequence in Grub2 (Gnome3, Fedora 16 and Ubuntu 11.10/10.00)

The new Gnome3 based Linux distributions (Fedora 16 and Ubuntu 12.04) are now coming with gurub2 boot loader package. The GRUB2 is rather different and a tad bit complex than the legacy GRUB loader. For example among other feature in GRUB2 the boot menu is created by reading multiple scripts present in /etc/grub.d/ directory and the /etc/default/grub file.

To make windows as a default operating system I've compressed the lengthy boot sequence changing procedure into these three simple steps.
  • Login in as root
  • Edit  /etc/default/grub
    Change GRUB_DEFAULT= (sequence number your OS of choice- 1)
    i.e. if windows7 is the 4th option, change the value to 3.

    For example, on my machine to make windows 7 as default OS I changed “GRUB_DEFAULT=saved” to “GRUB_DEFAULT=4

    GRUB_TIMEOUT can also be changed to a lower value, like 1 or 2 seconds to make boot process faster.
  • After changing save the file and run the following script, (exactly as it is) to regenerate the grub boot file with new parameters.
    #grub2-mkconfig -o /boot/grub2/grub.cfg
  • #reboot (Reboot to confirm if it works all right)

Make sure the default menu option is selected correctly, if not count the windows 7 entry and retry the above procedure.

The method has been tested on Fedora-16 + gnome-3. It should also work in Ubuntu/Kubuntu.

If you simply want to update grub2, and you are able to boot into Linux, then you can run the command:
#sudo update-grub
It will rebuild your grub config, finding all the available bootable partitions.

Please comment if you run into issue.


Thursday, August 25, 2011

Example for a threaded code in C++ using Boost (part 1).

My title Nowadays it seems universities only teach Java and students are oblivious to the complex but efficient world of unmanaged programming languages –programming languages which run natively on the hardware and are not dependent on CLR or JVM to run– such as C/C++. Recently I had the honour to tutor two new members in our team about multithreading capabilities of C++. I was not surprised when my students did not know that C++ standard does not include any specifications and built in support for multi-threading (C++ 0x will support natively but that’s more of an adaptation of Boost threads to C++'s standard). Boost is one of the more popular libraries which support threads (concurrent programming).
Since I’ve a strong belief that “doing it yourself is the best way to learn” so without going into the theory of multithreading (that I am sure you can learn elsewhere), I would like to put down steps to use boost library and make your first “threads” in C++.
For this article I am using visual studio 2010 (express), other multiplatform IDE’s such as code::blocks and eclipse for C++ can also be used following similar steps.
The desired output of this exercise is to setup the boost environment, setup a project in visual studio with the boost dependencies and most importantly to make a couple of threads in C++.
  1. Download the latest version of Boot library from
  2. Install Boost, I have installed it to “C:\boost_1_46_1”, which looks a like figure-1.
  3. Assuming that visual studio 2010 (express) is already installed, make a new Win32 console application and create an empty project. I’ve named my project as simpleBoostThreads.
  4. Now to setup the Boost library’s include paths right click on the project name and click on properties. On the property page click on “Configuration Properties” ->”C/C++” ->”General”. In the additional Include Directories field add the path of the library in my case it is “C:\boost_1_46_1\”. It should look like as in figure-2
  5. The last step in setting up the boost library is to add the library to the linker. To do that go to “Configuration Properties” ->”Linker” ->”General”. In the “Additional Library Directories” field add the path of the library in my case it is “C:\boost_1_46_1\lib”. It should look like as in figure-3
  6. Now add a new file main.cpp file in your project and write the following code snippet. It should look like in figure-4.

  7. #include < iostream >
    #include < boost/thread.hpp >
    using namespace boost;
    using std::cout;//adding the ostream's cout object from the std namespace

    void thread1()
    cout<<"This is the first thread\n";

    void thread2()
    cout<<"This is the second thread\n";

    int main()
    thread th1(&thread1), th2(&thread2);
  8. Now execute the program, and voila you have your first thread’s duo.
Download the project (open it up in Visual Studio 2010 and compile, make sure the boost paths are changed according to your PC)
This is my first article about multithreading using Boost library. I am hoping to contribute more by writing about more practical issues while using boost library in real projects.

Wednesday, August 24, 2011

Nook Color a great tablet.

Nook color a great tablet..... It’s cheap but it’s not a dud. Handier than an ipad with 7” screen, it has better pixel density, brighter screen optimized for reading and has generally good build quality. Also, it uses the same processor as an ipad which can be overclocked to 1.2 GHz. But most importantly it’s totally hackable, I have tried gingerbread 2.3.3 and honeycomb 3.0 works perfectly. It even allows dual boot which is good if someone wants to have a go at writing android apps. On the down side it doesn’t have any cameras or 3G only wifi and Bluetooth.

Thursday, January 28, 2010

Apple & McGraw Hill's row

@ McGraw Hill's row with apple, It’s amazing to see how much hype-power Apple has.

Personally, I think iPad is a crap device, without any innovation and real use. But as a marketer Steve Jobs/Apple is genius. Last night the iPad’s launch was literary showing up live on all the news channels…. If nothing else, arrogant stunts like this McGraw Hill one, gives them free pass to millions of $$’s of air time.

As for the tablets and slates… if anyone can create a market for them, its Apple. Let’s see how the sales figures go, it will be interesting.

Wednesday, October 7, 2009

Making firefox browsing faster

To really enhance the browsing speeds in firefox do the following. After this small hack I feel its faster than Chrome, you can do and check for yourself.

1. Type “about:config” into the address bar and press enter (yeah its there!). Scroll down and look for the following entries:


Normally the browser will make one request to a web page at a time. When you enable pipelining it will make several at once, which really speeds up page loading.

2. Alter the entries by double clicking on them

Set “network.http.pipelining” to “true”
Set “network.http.proxy.pipelining” to “true”
Set “network.http.pipelining.maxrequests” to 30.

This means it will make 30 connection requests at once.

3. Lastly right-click anywhere and select New-> Integer

Copy-paste the variable “nglayout.initialpaint.delay” and set its value to “0″.

This value is the amount of time the browser waits before it acts on information it receives.

voila!!, the firefox is faster now, try opening a really heavy page with images etc. (like yahoo music), you will notice the browsing is much faster now.