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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s