What are the prerequisites to start with OpenCV in C++?

by dlpsankhla   Last Updated June 13, 2016 08:02 AM

I'm an intermediate C++ programmer. Do I need any math knowledge in order to build computer applications using openCV?

Tags : c++ tracking

Answers 2

I did some tracking with openCV, this doesn't really require a high mathematics skill. However you will have to get some basics knowledge about performance and techniques like :


Usually you store datas from hardware in a buffer which is updated asynchronously from the rest of your application. This is because the hardware usually sent data at a fixed rate.

For instance a Kinect will send 30 time their data per seconds max. So that means you can already lose almost up to 30ms waiting for data from your hardware if you do it synchronously, because the driver was implemented as a synchronous read. Copy a buffer of data with openCV is less than 1ms.

Furthermore if you want to build an UI upon your application, you will want to have that UI running in a different thread than the image processing. This mean you will have to use something to share the data between those two threads. A simple mutual exclusion should be enough still.

Image processing

  • Buffering : process computation on a buffer (aka double/triple buffering).

  • Image representation : some algorithm will work better on RGB/TLS/Greyscale/Binary image, a quick read can help you understand why.

  • Background substraction : if your background is stable, you should use this. Basically you substract pixel by pixel the mean of the last pixel values. It is possible that openCV or some 3rd party lib already give you that now.

  • Distinction between capture and tracking : capture is way heavier than tracking, that's why you're using it when you're searching for something and once you have it, you use tracking algorithm which perform faster.Note that for sample capture like face detection, OpenCV have already that implemented.

Machine learning

Recognition of patterns always start with a learning phase. If you need to have your computer to learn something you must already :

  • Built a decent database of image on which the algorithm used can learned
  • Find somes algorithms implementation and benchmarks them.
  • If you need/want to implements your own algorithm like convolution network. You will need specific lecture or specific question here.

As i said in Image processing section openCV has already a face detection algorithm ready to be used. That means that openCV already embedded a database of faces to learn on.

June 13, 2016 09:44 AM

no, you don't need any maths to use the OpenCV library. As long as you're familiar with C++ you can build programs using it, it comes with various sample applications you can easily build that demonstrate much of its functionality.

The one area I'd be wary of is the documentation, its a reference rather than a tutorial and many results from web searches do not hold your hand in developing openCV code. So you need some patience and a dogged determination to figure a few things out when you stray a little from the beaten path.

June 13, 2016 10:50 AM

Related Questions

Using commit messages for time tracking

Updated May 03, 2018 02:05 AM

Database History Table / Tracking Table

Updated June 26, 2015 17:02 PM