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

Advertisements