How to check for openCV on Ubuntu 9.10

A proper answer to my own question !

pkg-config --modversion opencv


With OpenCV 2.4.x:

You can use "CV_VERSION" or "CV_MAJOR_VERSION", "CV_MINOR_VERSION", "CV_SUBMINOR_VERSION" from a C/C++ simple program.

Example of 'main.c':

#include <stdio.h>
#include <cv.h>

int main(void)
{
    printf("%s\r\n", CV_VERSION);
    printf("%u.%u.%u\r\n", CV_MAJOR_VERSION, CV_MINOR_VERSION, CV_SUBMINOR_VERSION);
}

Here is the compilation line:

g++ `pkg-config --cflags opencv` main.c `pkg-config --libs opencv` -o main

Here's an easy way to check. Assuming you installed using the default configuration.

In /usr/local/lib you should have the following libraries

libcvaux.so -> libcvaux.so.2.0
libcvaux.so.2.0 -> libcvaux.so.2.0.0
libcvaux.so.2.0.0
libcv.so -> libcv.so.2.0
libcv.so.2.0 -> libcv.so.2.0.0
libcv.so.2.0.0
libcxcore.so -> libcxcore.so.2.0
libcxcore.so.2.0 -> libcxcore.so.2.0.0
libcxcore.so.2.0.0
libhighgui.so -> libhighgui.so.2.0
libhighgui.so.2.0 -> libhighgui.so.2.0.0
libhighgui.so.2.0.0
libml.so -> libml.so.2.0
libml.so.2.0 -> libml.so.2.0.0
libml.so.2.0.0

And in /usr/local/include/opencv you should have the following header files.

cvaux.h, cvcompat.h, cv.hpp, cvver.h, cvwimage.h, cxcore.hpp, cxflann.h, 
cxmisc.h, cxtypes.h, highgui.hpp, cvaux.hpp, cv.h, cvtypes.h, cvvidsurv.hpp, 
cxcore.h, cxerror.h, cxmat.hpp, cxoperations.hpp, highgui.h, ml.h

I'm assuming that you using the latest version which is 2.0.