DirectShow with OpenCV


Tutorial: (old)

Using OpenCV with Visual C++ 6 and Microsoft's DirectShow (external non-wiki link)


Where to download DirectShow?

The DirectShow development tools and documentation are distributed as part of the Microsoft Platform SDK.

The Platform SDK can be downloaded here.

After you download the Platform SDK, go to the Samples\Multimedia\DirectShow\BaseClasses folder and compile the BaseClasses solution to generate the lib files, which you need in order to use DirectShow in your application.

(After you compile, strmbasd.lib will be generated inside the Debug folder, which you can use in your applications... Note that the lib file is the debug version only..)

Direct X (may also be needed)

Go to Microsoft DirectX Downloads, and download the most recent DirectX SDK (currently June 2006)

Microsoft DirectShow Documentation:

Microsoft Developer Network: DirectShow

Library providing simple frame grab interface:

You can use the video input library at http://muonics.net/school/spring05/videoInput/ to avoid the messiness of dealing with DirectShow. It even works for direct capture to the imageData field of an IPL image, though I found that the result was upsidedown and had red and blue switched.

NOTE: To view a sample of the functions available to VideoInput, please view the VideoInput.h file under

C:\Program Files\OpenCV\otherlibs\_graphics\include\videoInput.h

Sample Code:

#include "videoInput.h"

videoInput VI;

int numDevices = VI.listDevices();

VI.setupDevice(0);

unsigned char* yourBuffer = new unsigned char[VI.getSize()];

VI.getPixels(0, yourBuffer, false, false);

cvConvertImage(img1, img2, CV_CVTIMG_FLIP);

===========================================

Regards, {OK} Paramesh.


OpenCV OS

OpenCVWiki: DirectShow (last edited 2011-06-01 13:55:11 by Robert Laganiere)