What is OpenCV
OpenCV means Intel® Open Source Computer Vision Library. It is a collection of C functions and few C++ classes that implement some popular algorithms of Image Processing and Computer Vision.
The key features
OpenCV is cross-platform middle-to-high level API that consists of a few hundreds (>300) C functions.
It does not rely on external numerical libraries, though it can make use of some of them (see below) at runtime, if they are available.
OpenCV is free for both non-commercial and commercial use (see the license for details).
OpenCV provides transparent for user interface to Intel® Integrated Performance Primitives (IPP) (only ippcv for now).
That is, it loads automatically IPP libraries optimized for specific processor at runtime, if they are available.
More information about IPP can be retrieved at http://www.intel.com/software/products/ipp/ippvm20/index.htm
There are interfaces to OpenCV for some other languages/environments (more to come):
- EiC - ANSI C interpreter written by Ed Breen. AFAIK, it is now abandoned.
Hawk and CvEnv are the interactive environments (written in MFC and TCL,respectively) that embedd EiC interpteter.
- Ch - ANSI C/C++ interpreter with some scripting capabilities,
created and supported by SoftIntegration® company (http://www.softintegration.com) W
rappers for Ch are located at opencv/interfaces/ch.
- MATLAB® - great environment for numerical and symbolic computing by Mathworks.
MATLAB® interface for some of OpenCV functions can be found at opencv/interfaces/matlab/toolbox
Firstly the Yahoo group list is very useful for all questions, the last innovation, and all delcared users' contacts.
Return
SourceForge download
Retour
Above all, you have to download this library.
SourceForge web site provides the last update (personally, I'm using the
beta3.1, it's the last at the present time).
Downloaded once, this library has to be installed.
Return
Windows Installation
Retour
Normally, for the windows installation, there isn't any troubles, so 'ok', 'next', 'next', 'ok', etc...










In the 'start' menu, now, we can see :
We can also see in the OpenCV installation directory (in my example :
c:\Program Files\OpenCV)
Now, OpenCV is installed. But you have to compile it before use it. To compile the libraries (cv.lib, cv.dll, highgui.lib, highgui.dll, cvaux.lib, cvaux.dll, etc..), I'm going to use Visual C++. Opening the file OpenCV.dsp (which is in
_dsw or
start -> Programs -> OpenCV -> OpenCV Workspace), you can find :
Those are all the OpenCV project, start compiling :
CV Files
HighGUI files
cvaux files
Now, to be able to compile a code source with visual using OpenCV, you have to copy dll files into your work directory (it depends of your needs), as usual :
- cv.dll
- highgui.dll
- cvaux.dll
Those files are using for the execution.
-
To compile your program with Visual C++, you have to add OpenCV headers directories, such as :
in Tools -> Options
In 'Include files'
c:\PROGRAM FILES\OPENCV\CV\INCLUDE for cv.h
c:\PROGRAM FILES\OPENCV\OTHERLIBS\HIGHGUI for highgui.h
To avoid those errors : fatal error C1083: Cannot open include file: 'cv.h': No such file or directory
In 'Library files'
c:\PROGRAM FILES\OPENCV\LIB for cv.lib, highgui.lib, cvaux.lib, etc..
To avoid those errors : LINK : fatal error LNK1104: cannot open file "cv.lib"
-
To link your program with Visual C++,you have to add OpenCV statics libs, such as:
in Project->Settings, Link
in 'Object/library modules'
- cv.lib, highgui.lib (optional cvaux.lib)
To avoid this kind of errors : File.obj : error LNK2001: unresolved external symbol _cvFlip... _cvRectangle... _cvCircle... _cvFindCornerSubPix... _cvCopy for cv.lib
or File.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CvvImage::~CvvImage(void)" (??1CvvImage@@UAE@XZ) for highgui.lib
Now you're ready to play with OpenCV
Return
Linux Installation
Retour
Debian Installation
Pakages list :
|
libcvaux-dev
|
- development files for libcvaux
|
|
libcvaux0.9-5
|
- computer vision extension library
|
|
libcvcam-dev
|
- development files for libcvcam
|
|
libcvcam0.9-5
|
- computer vision camera support library
|
|
libhighgui-dev
|
- development files for libhighgui
|
|
libhighgui0.9-5
|
- computer vision GUI library
|
|
libopencv-dev
|
- development files for libopencv
|
|
libopencv-doc
|
- OpenCV documentation and examples
|
|
libopencv0.9-5
|
- computer vision library
|
Installation (thx zam):
apt-get install libcvaux-dev libcvaux0.9-5 libcvcam-dev libcvcam0.9-5 libhighgui-dev libhighgui0.9-5 libopencv-dev libopencv-doc libopencv0.9-5
|
TAR installation
Archive extraction
gunzip opencv-0.9.5.tar.gz
|
tar -xvf opencv-0.9.5.tar
|
or
tar -xzvf opencv-0.9.5.tar.gz
|
Pre-necessary :
- motif (LessTif or openMotif) with files developpement
- libpng, libjpeg, libtiff with files developpement
- libavcodec de ffmpeg with the headers
- fltk 1.1.x with files developpement
- TCL/TK 8.3.x et BWidgets with files developpement
Library installation :
./configure
|
make
|
make install # as root
|
ldconfig # as root
|
NB : Personaly, I had troubles with the
configure file : the X11 library directory wasn't the good ... so, to check before look for during two weeks...
Return
Installation test
Retour
Compilation test with this small example :
/*
* foo.c
*/
#include <cv.h>
#include <highgui.h>
int main(int argc,char *argv[])
{
IplImage *image;
int x,y;
image = cvCreateImage(cvSize(300,300),8,1);
cvSetZero(image);
for(y=0 ; y < image->height ; y++)
{
for(x=0; x < image->width ; x++)
{
(image->imageData+image->widthStep*y)[x] = (x*y)%256
}
}
cvNamedWindow("Image",1)
cvShowImage("Image",image);
cvWaitKey(0);
return 0;
}
|
Compilation line (under debian) :
gcc opencv-config --cflags --libs highgui foo.c -o foo
|
|
Resultat of this source code :
|
Return
Documentation
Retour
Actually, OpenCV help are declared. There are three, actually, more two and half than three :
On line, help aren't a lot.
Return
Windows examples
Retour
Under Windows, it exists few examples :
|
|
Stereovision manipulation example
using the camera intrinseqs parameters
|
|
|
Corner Tracker example, very powerfully
using optic flow
|
|
|
Morphing example
using epipolar lines
|
|
|
Face recognition example
empirical method learning
|
Return
Linux examples
Retour
The first example that can check the good installation with the following script
opencv-config :
Usage: opencv-config [OPTIONS]
|
Options:
|
[--prefix]
|
[--cflags]
|
[--cxxflags]
|
[--libs [opencv] [highgui] [cvcam] [cvaux]]
|
[--version]
|
|
opencv-config --prefix
opencv-config --cflags
opencv-config --cxxflags
opencv-config --libs opencv highgui cvcam cvaux
-lopencv -lopencv -lhighgui -lcvcam -lcvaux
|
opencv-config --version
|