Frequently Asked Questions / Troubleshootings / HOWTOs

General Questions

How to install OpenCV properly?

Read installation guide

How can I get acquainted with OpenCV fast?

  1. Look at samples.
  2. Within Visual Studio you may load OpenCV workspace: select cvsample project, build it and run. Look into the code and modify it as you wish.
  3. Also, scan through reference manuals - they contain some example code as well.
  4. Search OpenCV archives at for the topic you are interesting in.
  5. Create a new project from scratch or modify existing cvsample. There are application wizards for Microsoft Visual Studio that create OpenCV-aware projects; look for them at (Files section - you have to be registered user)

Where do I submit Bug reports for the computer vision library?

Send email to  Subject: BUG <....your title...>

How do I send bug reports on the Intel® Integrated Performance Primitives

Send email to

How do I join the OpenCV forum?

Send email to, after you are a member and select your login, you can read the web group at

How do I modify the web group so that I don't receive tons of email's?

To get the messages real time, or once a day as a daily digest, you can go to and choose your setting from the pull down list to the right of OpenCV.;

Ok, I found the group completely useless for me. How can I unsubscribe?

Mail to with subject [OpenCV] and arbitrary message contents.

When using OpenCV and IPL simultaneously, I get compiler errors. How to resolve this problem?

To be completely independent from IPL, OpenCV duplicates declarations of IplImage and few other structures and constants if it is not told explicitly that IPL is present. Defining HAVE_IPL before including OpenCV headers or putting "#include <ipl.h>" before OpenCV headers resolves the conflict.

Does OpenCV work on other processors?

Yes, OpenCV itself is open source and it is quite portable, especially across 32-bit platforms. On the other hand, OpenCV can run much faster on Intel processors because of IPP.

Windows® OS related Qs:

When I try to build one of the apps, I get an error, streams.h not found.

You need install and setup DirectShow SDK that is now a part of Platform SDK (Windows Server 2003 SP1 SDK or later). Here is the procedure:

  1. Download the Platform SDK from
    and DirectX SDK from (They are huge, but you can download and install them by parts).
    If it doesn't work for you, consider HighGUI that can capture video via VFW or MIL
  2. Install Platform SDK together with DirectShow SDK.
    Install DirectX SDK (with or without sample code).
  3. Build baseclasses. See <PlatformSDKInstallFolder>\samples\multimedia\directshow\readme.txt.
  4. Copy the built libraries (called strmbase.lib and strmbasd.lib in Release and Debug versions, respectively) to <PlatformSDKInstallFolder>\lib.
  5. In Developer Studio add the following paths:
    to the includes' search path (at Tools->Options->Directories->Include files in case of Visual Studio 6.0,
    at Tools->Options->Projects and Solutions->VC++ Directories->Include files in case of Visual Studio 2005)
    to the libraries' search path (in the same dialog, ...->"Library files" page)

    NOTE: PUT THE ADDED LINES ON THE VERY TOP OF THE LISTS, OTHERWISE YOU MAY STILL GET COMPILER OR LINKER ERRORS. This is necessary, because Visual Studio may include older versions of the same headers and libraries.

  6. Now you can build OpenCV DirectShow filters.

After installing DirectX SDK I'm still getting linker error about undefined or redefined "TransInPlace" filter class constructors etc.

Put the paths to the SDKs' include and lib folders on the top of the search lists.

When I use try to use cvcam, it just crashes

Make sure, you registered and

How to register *.ax (DirectShow filter)?

Open the file (within explorer) using regsvr32.exe (under Win2000 it is done by Open with->Choose Program...->Browse...->c:\windows\system32\regsvr32.exe (path may be different). You may remember association to save clicks later.

Filter couldn't be registered (regsvr32 reports an error)

The most probable reason is that the filter requires some DLLs that are not in the path. In case of OpenCV make sure <OpenInstallFolder>\bin is in the path

cxcore096d.dll or cxcored.lib seem to be missing

cxcore096d.dll means debug version of cxcore DLL and cxcored.lib is the import library for cxcore096d.dll. Open OpenCV workspace, select "cxcore" as active project and select "Win32 Debug" configuration. Build the library and you will get bin\cxcore096d.dll and lib\cxcored.lib files. The same should be repeat for all the other OpenCV components - name of binary, ending with d means Debug version that are not shipped.

When compiling HighGUI I get the error message "mil.h is not found"

mil.h is a part of Matrox Imaging Library (MIL) that is usually supplied with Matrox (or compatible) framegrabbers, such as Meteor, Meteor II etc.

How can I debug DirectShow filter?

How can I create Developer Studio project to start playing with OpenCV

(note: this is a lengthy answer)

To create your own OpenCV-based project in Developer Studio from scratch do the following:

  1. Within Developer Studio create new application:
    1. select from menu "File"->"New..."->"Projects" tab. Choose "Win32 Application" or "Win32 console application" - the latter is the easier variant and the both sample projects have this type.
    2. type the project name and choose location
    3. you may create own workspace for the project ("Create new workspace") or include the new project into the currently loaded workspace ("Add to current workspace").
    4. click "next" button
    5. choose "An empty project", click "Finish", "OK".
    After the above steps done Developer Studio will create the project folder (by default it has the same name as the project), <project name>.dsp file and, optionally, <project name>.dsw,.ncb ... files if you create own workspace.
  2. Add a file to the project:
  3. Customize project settings:
  4. Add dependency projects into workspace:
  5. That's it. Now compile and run everything.

Linux Related Qs:


Technical Questions on Library use:

How to access image pixels

(The coordinates are 0-based and counted from image origin, either top-left (img->origin=IPL_ORIGIN_TL) or bottom-left (img->origin=IPL_ORIGIN_BL)

There are functions that work with arbitrary (up to 4-channel) images and matrices (cvGet2D, cvSet2D), but they are pretty slow.

How to access matrix elements?

The technique is very similar. (In the samples below i - 0-based row index, j - 0-based column index)

How to process my data with OpenCV

Suppose, you have 300x200 32-bit floating point image/array, that resides in 60000-element array.

int cols = 300, rows = 200;
float* myarr = new float[rows*cols];

// step 1) initializing CvMat header
CvMat mat = cvMat( rows, cols,
                   CV_32FC1, // 32-bit floating-point, single channel type
                   myarr // user data pointer (no data is copied)
// step 2) using cv functions, e.g. calculating l2 (Frobenius) norm
double norm = cvNorm( &mat, 0, CV_L2 );

delete myarr;
Other scenaria are described in the reference manual. See cvCreateMatHeader, cvInitMatHeader, cvCreateImageHeader, cvSetData etc.

How to load and display image

/* usage: prog <image_name> */
#include "cv.h"
#include "highgui.h"

int main( int argc, char** argv )
    IplImage* img;
    if( argc == 2 && (img = cvLoadImage( argv[1], 1)) != 0 )
        cvNamedWindow( "Image view", 1 );
        cvShowImage( "Image view", img );
        cvWaitKey(0); // very important, contains event processing loop inside
        cvDestroyWindow( "Image view" );
        cvReleaseImage( &img );
        return 0;
    return -1;

How to find and process contours

Look at squares demo

How to calibrate camera using OpenCV