The installation has been tested under OS X EL CAPITAN and UBUNTU.
First we need to download the sources from github and the contrib You can git clone or get the archive, it’s your choice.

EDIT : as suggested in the comment by Tam you should check the releases available !

So now we have two directories ‘opencv’ and ‘opencv_contrib’. Go in the opencv one and create a new directory called build.

Now open the cmake interface (cmake-gui with ubuntu) and fill the source and build directory.Then click on Configure. A window appears, the default configuration is good, see below: capture-decran-2016-10-06-a-7-22-40-pmClick ‘Done’. Now search ‘extra_modules’ and fill with the path of opencv_contrib/modules:


If you have gst.h not found, disable WITH_GSTREAMER. One last thing, if you don’t want cuda or to avoid some troubleshootings, disable WITH_CUDA like in the picture:


Now you can ‘Generate’. The cmake part is done!

Open a terminal and go in the opencv/build directory.

The -j is to set the number of CPU cores, in my case 4. The make command will take a while.

It’s done! OpenCV is installed on your computer.
Now clone the example project from

If you want to create a new OpenCV project, just generate a new project with Clion and add the three lines in the CMakeLists.txt:

I hope it helped, have fun!

Hits: 15599


  1. Tam
    Avr 19, 2017

    Hello Zhajor, that was helpful! However, a small detail that can impact the ease of installing. For the opencv_contrib download from github, you should specify that the user should download the right package. For instance, I unknowingly downloaded the default master branch of the opencv_contrib, which caused me some trouble that I could have easily avoided!