Why OpenCV?

Okay. You’ve landed on this page means you’re interested in image processing. You probably have some ideas about image processing and probably even some experience. If you’ve used Matlab, you might hate this sudden change from the relatively easy Matlab to the tough C/C++. There are a couple of why to prefer OpenCV over Matlab.



OpenCV was made for image processing. Each function and data structure was designed with the Image Processing coder in mind. Matlab, on the other hand, is quite generic. You get almost anything in the world in the form of toolboxes. All the way from financial toolboxes to highly specialized DNA toolboxes.


Matlab is just way too slow. Matlab itself is built upon 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.

If you use C/C++ you don’t waste all that time. You directly provide machine language code to the computer, and it gets executed. So ultimately you get more image processing, and not more interpreting.

I’ve tried doing some real time image processing with both Matlab and OpenCV. I usually got very low speeds, a maximum of about 4-5 frames being processed per second. With OpenCV, I get actual real time processing at around 30 frames being processed per second.

Sure you pay the price for speed – a more cryptic language to deal with, but its definitely worth it… You can do a lot more… you could do some really complex mathematics on images with C and still get away with good enough speeds for your application.



Matlab uses just way too much system resources. With OpenCV, you can get away with as little as 10mb RAM for a realtime application. But with today’s computers, the RAM factor isn’t a big thing to be worried about. You do need to take care about memory leaks, but it isn’t that difficult. You can read this article about Memory Management in OpenCV if you want.

But if you can get your application to run on a 10 year old computer too, you’re a genius!

Next Parts

This post is a part of an article series on OpenCV for Beginners

  1. Why OpenCV?
  2. Installing and getting OpenCV running
  3. Hello, World! With Images!
  4. Filtering Images
  5. Capturing Images
  6. HighGUI: Creating Interfaces

Issues? Suggestions? Visit the Github issue tracker for AI Shack

Back to top


  1. Said RAHMANI
    Posted July 29, 2010 at 11:19 pm | Permalink

    Hello, superbe article thanks for the clarifications.
    Keep 4e; co;in4 ;)

  2. yu zhao
    Posted April 18, 2011 at 1:19 pm | Permalink

    Fully agree. :)

  3. Posted September 18, 2011 at 6:06 pm | Permalink

    I don’t like matlab any more

  4. Giridhar
    Posted September 18, 2011 at 10:06 pm | Permalink

    Hi utkarsh
    i am Giridhar finaly year engineering student cs stream……..
    i am an newbie to the opencv……but your projects on opencv excited me to start with it……..I started it with your tutorial thanks you……..

One Trackback

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>