Using OpenCV 3.0.0alpha with CMake in Windows 7

Hi all,
I was just curious about how much effort would take to download, install and try the OpenCV 3.0.0alpha version that has been around for a little while ( The motivation is that it looks that we will have soon a beta version, and perhaps a release version somewhere at the end of 2014 or beginning of 2015. I will definitely like to have acostumed myself to whatever changes OpenCV 3.0 implies compared to OpenCV 2.X.

Downloading OpenCV from git repository
So the first thing is downloading this version, and the suggested way to do it is with the git repository. So you need to install the git tool if you do not have it already. You can download it from here:
During installation I left everything default and created an user and password. Once done, you have a Git bash application from which you can type the download commands. Actually, the first time, in git, this is called “cloning” the repository. You can do it from here:

I also downloaded the extras path: git://
And the contrib folder, which contains the contributions from external contributors (appart from itseez):

Building OpenCV with CMake
With CMake you can very easily build OpenCV in your system. You can follow any previous tutorial to do so (like the one I did some time ago). If you are unfamiliar with CMake, please consider it a must if you are interested in programming computer vision applications.

Using OpenCV 3.0.0alpha in your projects

First thing, is that the name of the CMake list variable that holds the paths to the include directories has changed from ${OPENCV_INCLUDE_DIRS} to ${OpenCV_INCLUDE_DIRS}. Yes, well, not a big change, but here I had my first problem until I realised what was happening.

The second problem was that some OpenCV macros has been moved to new files so I had to search for them and #include the files. For instance, you would probably need to include the following:

#include "opencv2/imgproc/imgproc_c.h" // for CV_RGB
#include "opencv2/videoio/videoio_c.h" // for CV_CAP_PROP_FRAME_WIDTH, etc. when capturing a video

I also got the strange problem that the ippicv.lib library was not found, even if there were no warnings nor problems at config time. This is something I will investigate later. Just removed this ippicv.lib from the Linker menu in Visual Studio and everything worked just fine.

Excited about discovering the new features of OpenCV 3.0.0alpha!



Posted in CMake, Computer vision, OpenCV | Tagged , , | Leave a comment

ITS World Conference – Detroit 6-11 Septembre, 2014


EDIT: I’ve just come back, and everything was incredible there. Many big OEMs showed their vision on future vehicles, and demonstrated some autonomous driving capabilities. We had a booth were we demonstrated our capabilities in computer vision applied to ADAS, ITS, etc.

Marcos Nieto at ITSWC2014

Marcos Nieto at Vicomtech’s booth in ITSWC Detroit 2014

I will attend the Intelligent Transport System World Conference in Detroit next 6-11 Septembre (ITSWC2014). We will have a booth there presenting some works about ADAS (Advanced Driver Assistance Systems) and our computer vision technology in general.

There, I will give a short talk about the methodology we follow when creating computer vision algorithms for embedded platforms for automotive applications.

Here you are a preview of the slides I will use there:

And the reference of the paper I am authoring.

  • G. Velez, O. Senderos, M. Nieto, O. Otaegui, and G. Van Cutsem, “Implementation of a computer vision based advanced driver assistance system in Tizen IVI,” in Proc. 21st ITS World Congress, Detroit, U.S., 7-11 September 2014 (accepted).
  • M. Nieto, J. D. Ortega, O. Otaegui, and A. Cortés, “Optimization of Computer Vision Algorithms in Codesign Methodologies,” in Proc. 21st ITS World Congress, Detroit, U.S., 7-11 September 2014 (accepted).

I will update this post when I come back.


Posted in ADAS, Computer vision | Tagged , , , , | Leave a comment

Creating mosaic of videos using ffmpeg command line

Hi all,

I’ve been looking for a simple solution to create a mosaic of videos more time that I would like to admit. One can do it using OpenCV, or special video editing tools, like Adobe Premier, but I wanted something really specific and simple.

Somebody told me “Maybe ffmpeg can do the job”. Of course!, and it is really straightforward. Here you are an example I just tried, creating a mosaic of two videos of the same size, putting them side by side.

So we have left and right videos:

left  right

And we want to have a single video like this (which can be really useful in Power Point presentations or alike when you want to compare the output of two methods or two videos simultaneously):


So the code I used is:

C:\ffmpeg\bin\ffmpeg -i left.avi -i right.avi -filter_complex "nullsrc=size=720x288 [base]; [0:v] setpts=PTS-STARTPTS, scale=360x288 [left]; [1:v] setpts=PTS-STARTPTS, scale=360x288 [right]; [base][left] overlay=shortest=1 [tmp1]; [tmp1][right] overlay=shortest=1:x=360:y=0" -c:v libx264 mosaic.avi

You can download the latest binaries of ffmpeg here.

And you can find more details on this topic in the wiki page.


Posted in Computer vision | Tagged , , | Leave a comment

FP7 TAXISAT project – Driverless car using stereo visual odometry

Hi all,

Recently we have concluded an FP7 project, called the TAXISAT project, in which we worked for building a driverless car which uses GNSS, stereo visual odometry and laser obstacle detection for driving in any kind of environment.

Its main use is the “last mile problem”, such as moving persons in a taxi airport area, entertainment parks, from parkings to stadiums and so on.

We are proud of the results achieved here in Vicomtech-IK4, and willing to continue working on this kind of technologies, especially in stereo vision.

There has been many people involved in this project, but I would like to metion my colleague Leonardo de Maeztu, who has leaded the optimization of the algorithms and the integration and testing stages.

Hope you like it!

Posted in ADAS, Computer vision, FP7 | Tagged , , , , | 1 Comment

Source code Inverse Perspective Mapping C++, OpenCV

Hi all,

Today I bring a very simple code that might be of interest for some of you. It is a C++ class to compute Inverse Perspective Mappings (IPM), or sometimes called bird’s-eye views of a planar surface.

The link to the code:

(I am providing here a CMakeLists.txt and some c++ files, so you need to create a solution with CMake, and the a C++ compiler).


It is nothing else than a plane-to-plane homography, but in my experience it is not that easy to compute. I am using here OpenCV remap functions.

In the example I have hard-coded the necessary four-point correspondences required to compute the homography, but you can compute then as you want. You might use vanishing points, camera calibration information, or any other source.

Of course this type of classes can get really useful when you add them information about the camera calibration.

Hope it is useful!

Kind regards,

Posted in ADAS, Computer vision, OpenCV | Tagged , , , , , | 43 Comments

Mastering OpenCV with Practical Computer Vision Projects [eBook]

Hi all!

OpenCV is a must when talking about computer vision, rapid prototyping, and open source solutions. Many people is interested in learning OpenCV, but sometimes it is a little bit tricky to find the correct way to use the primitives that OpenCV offers.

A great help can be found in the OpenCV documentation and tutorials, but it is more difficult to find good larger examples on the many features OpenCV provides.

An excellent way is to take a look to Mastering OpenCV with Practical Computer Vision Projects by Daniel Lélis. I’ve found this book really amazing. It does not only cover the hot topics around OpenCV (Android, iOS, structure from motion, face modeling, etc.) but it also comes with the source code available, which you can use and see all this cool stuff running in your own PC or smartphone. I really recommend to read this book. The authors and reviewers of the book are first class computer vision and OpenCV experts, not mentioning the high quality of the coding itself, which can be used as a guide on how to fully exploit C++ with OpenCV.


In summary: if you are learning OpenCV, you have tried some of the examples and you want to give the next step building your own large projects (especially in Android or iOS), you need this book!

Hope you enjoy it!

Posted in OpenCV | Tagged , , , , | Leave a comment

(Faster) Line segment detection OpenCV C++ source code

Hi guys!
I’ve been working on enhancing the LSWMS line segment detector. You can find the new version in the trunk of the repository at sourceforige (
It is now really fast, and still quite accurate. The idea behind is that I profiled the performance of LSWMS and realized that the Mean-Shift part took most of the computational power, and in some cases, it added not that much accuracy.

Here you are some results:

Prado: 448 x 336,
LSWMS:      63 ms, 193 segments
LS:                 0 ms, 243 segments
PPHT:         109 ms, 228 segments

Road:  360 x 288
LSWMS:    62 ms, 137 segments
LS:            16 ms, 173 segments
PPHT:        31 ms, 110 segments

Church: 600 x 400
LSWMS:    124 ms, 258 segments
LS:            15 ms, 410 segments
PPHT:        78 ms, 469 segments

Station: 600 x 450
LSWMS:    156 ms, 469 segments
LS:             32 ms, 48 segments
PPHT:        125 ms, 679 segments


lswmsON_prado lswmsOFF_prado


lswmsON_road lswmsOFF_road


lswmsON_station lswmsOFF_station


lswmsON_church lswmsOFF_church

And the corresponding results using the PPHT algorithm from OpenCV 2.4.7.

ppht_prado ppht_road
ppht_station ppht_church

The results of LSWMS with and without weighted Mean-Shift are pretty similar. And better than PPHT. Also now LSWMS is faster than PPHT disabling Mean-Shift, so I would say that LSWMS is my preferred option for detecting line segments in real-time applications.

I must admit LSWMS generates noisy results, sometimes erroneous, but when I have used LSWMS in application like vanishing point detection it was the best option because it provided enough accuracy and great speed.

Hope you can find it useful too! (and in case so, please add a cite to my paper about it! Thanks!).

Posted in Computer vision | Tagged , , , , , , , | 10 Comments