Getting Started With OpenCV

I happened to mention at the end of my previous post that I had started tinkering around with OpenCV and C++ over the past few weeks. In this write-up, I plan to prep you through the on-boarding process of installing the OpenCV library and getting started with the bare-essential and ubiquitous “Hello OpenCV” C++ program.

Before I get started, some customary declarations are in order. This installation method has been tried and tested on my quad-core, 2.20 GHz Intel i3-2330M processor running Ubuntu 14.04.1 LTS (codename: trusty). Ubuntu’s latest release, 14.10 (Utopic Unicorn) ships with a new version of libav and unfortunately, OpenCV fails to build with the newer version!

The installation process for OpenCV is as simple as downloading and running a shell script.

Step 1: Download this shell script by typing in the following command from your terminal:

 wget https://raw.githubusercontent.com/samyak-268/dotfiles/master/opencv2_4_10.sh 

Step 2: Run the following command in from your terminal:

 chmod +x opencv2_4_10.sh 

The purpose of this command is to make your shell script executable. Alternatively, you could right-click on the file, click on Properties, go to the Permissions tab and check the box for “Allow executing file as program”.

Step 3: Run the script by typing

 ./opencv2_4_10.sh 

Running the script will install all dependencies, download and extract the ZIP containing the source files, compile and build the source code to generate all binaries in their proper directories within the repository.

That is pretty much it! After the success message is displayed on your terminal screen, you are all set to dive in! The next post will describe a basic “Hello OpenCV” C++ program that would test your OpenCV installation and also give you a glimpse of what is in store as we explore the C++ library in our subsequent posts!

Advertisements

Back With Some Vision

Just a few posts into the realm of blogging and I have demonstrated all the qualities of a terrible blogger! And that was partly due to the work pressures of the last semester and a busy summer in Mumbai which flew past me before I could take cognizance of what was happening around me! But, now I am back with all guns blazing and a well-charted plan to combat any future instances of writer’s block!

I am doing my Masters dissertation in the field of Computer Vision and under the guidance of Prof. R. Balasubramanian. Like some of my batch-mates, I had the option of continuing my research in the area where I worked during my 2 month internship i.e. Natural Language Processing. But, I went ahead with Vision because first, I wanted to step out of my comfort zone and try a completely new domain, second, the mathematics and Machine Learning that powers the most sophisticated Vision systems today intrigues me and third, my seniors had very strongly recommended Prof. Balasubramanian for any Image Processing/Computer Vision related guidance!

Over the last few months, I have done a fair amount of literature survey for my research work. I am currently working on the problem of emotion classification from facial expressions. What excites me about my work is the varied application domains where this problem may be applied to (robotics, helping people on the Autism spectrum, enhancing H.C.I.) and the fact that Vision offers a well-calibrated blend of theory and practical application.

Speaking of practical application, the last few weeks has also marked the beginning of, well, a lot of things! I started using OpenCV to write some cool Image Processing hacks. Everytime I tinker around with OpenCV and C++, I am amazed by the sheer power and abstraction that the library offers. The elegance with which OpenCV handles the most complex Image Processing tasks leaves you in awe! Over the next few posts, I hope to talk more about OpenCV and Vision, in general.