Using OpenCV 2.4.2 with Visual Studio 2012 on Windows 7 (64-bit)

EDIT: I have not updated this article since Nov 21, 2012. There might have been a lot of changes since then. If anyone is interested in updating it, shoot me a mail and I’ll give you the editing rights to this article.

So before starting you’ll need to make sure you have these in your computer:

  1. Visual Studio 2012 (You can download the 90-day trial version from here)
  2. OpenCV 2.4.2 (You can download it from here)

Extract OpenCV in a folder named OpenCV-2.4.2 in C drive. [Note: You can change the path and folder name but then you wont be able to use the instructions as they are and you’ll have to make modifications]

There are five simple steps that we have to make sure that we follow to get OpenCV up and running smoothly: (Click on the images to enlarge them) Continue reading


What is OpenCV? OpenCV vs. MATLAB — An insight

What is OpenCV?

OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision. It is developed by Willow Garage, which is also the organization behind the famous Robot Operating System (ROS). Now you’d say MATLAB also can do Image Processing, then why OpenCV? Stated below are some diferences between both. Once you go through them, you can decide for yourself.

Advantages of OpenCV over MATLAB (Collected from various blogs/forums. See references below)

  • Speed: Matlab is built on Java, and Java is built upon C. So when you run a Matlab program, your computer is busy trying to interpret all that Matlab code. Then it turns it into Java, and then finally executes the code. OpenCV, on the other hand,  is basically a library of functions written in C/C++.  You are closer to directly provide machine language code to the computer to get executed. So ultimately you get more image processing done for your computers processing cycles, and not more interpreting. As a result of this, programs written in OpenCV run much faster than similar programs written in Matlab. So, conclusion? OpenCV is damn fast when it comes to speed of execution. For example, we might write a small program to detect peoples smiles in a sequence of video frames. In Matlab, we would typically get 3-4 frames analysed per second. In OpenCV, we would get at least 30 frames per second, resulting in real-time detection.
  • Resources needed: Due to the high level nature of Matlab, it uses a lot of your systems resources. And I mean A LOT! Matlab code requires over a gig of RAM to run through video. In comparison, typical OpenCV programs only require ~70mb of RAM to run in real-time. The difference as you can easily see is HUGE!
  • Cost: List price for the base (no toolboxes) MATLAB (commercial, single user License) is around USD 2150.  OpenCV (BSD license) is free! Now, how do you beat that? Huh? huh? huh?
  • Portability: MATLAB and OpenCV run equally well on Windows, Linux and MacOS. However, when it comes to OpenCV, any device that can run C, can, in all probability, run OpenCV.

Continue reading