CodeVis.com SourceForge.net Logo

Example.cpp File Reference


Detailed Description

Test and sample program for CodeVis VidCapture.

This program is a feature test of the CVVidCapture code. It shows how to perform simple image capture tasks for WebCams with the DirectShow interface from Microsoft.

You'll need the DirectX SDK installed and a WebCamera. I'm using DirectX 9.0, but it should work on some previous versions.

Compiled and tested with Visual C++ 6.0 and a Creative Labs WebCam.

RCSfile
Example.cpp,v
Date
2004/02/18 09:40:39
Revision
1.2
Author
mikeellison

Definition in file Example.cpp.

#include <stdio.h>
#include "VidCapture.h"
#include "CVUtil.h"

Go to the source code of this file.

Defines

Functions

Variables


Define Documentation

#define EXIT_MACRO
 

Definition at line 75 of file Example.cpp.

Referenced by main().


Function Documentation

bool capCallback CVRES  status,
CVImage image,
void *  userParam
 

capCallback is the main image capture callback function for continuous capture runs.

We play with the image a bit inside to test out CVImage's functions.

See also:
CVVidCapture::CVVIDCAP_CALLBACK

Definition at line 446 of file Example.cpp.

References CVImage::CreateSub(), CVAssert, CVFAILED, CVSUCCESS, gFrameNum, CVImage::Height(), CVImage::ReleaseImage(), CVImage::Save(), SlowNegateImage(), and CVImage::Width().

Referenced by TestIt().

bool enumCallback const char *  devname,
void *  userParam
 

Callback for enumeration of capture devices.

We're just saving the first one that comes by into gDeviceName[] and using it.

See also:
CVVidCapture::CVVIDCAP_ENUMCB

Definition at line 424 of file Example.cpp.

References gDeviceName, and gDevNum.

void main  ) 
 

Example program entry point.

This program shows the base capabilities of VidCapture and how to use them.

Definition at line 137 of file Example.cpp.

References EXIT_MACRO, gDeviceName, gDevNum, gFrameNum, kVIDCAPTURE_STRING, and TestIt().

void SlowNegateImage CVImage image  ) 
 

SlowNegateImage() is a slow routine to negate an image.

Works on any image type where the pixel values are 0-255, but it recalculates each pixel location in addition to having 2 subroutine calls per pixel - lots of overhead. Good for testing CVImage::GetPixel() and CVImage::SetPixel() though.

Definition at line 566 of file Example.cpp.

References CVFAILED, CVImage::GetPixel(), CVImage::Height(), CVImage::SetPixel(), and CVImage::Width().

Referenced by capCallback().

bool TestIt  ) 
 

Primary test function.

Returns:
bool - true on successful run. may return false for a variety of reasons - check prints and traces for errors.

Definition at line 177 of file Example.cpp.

References CVPlatform::AcquireVideoCapture(), CVVidCapture::CAMERAPROP_BRIGHT, CVVidCapture::CAMERAPROP_CONTRAST, capCallback(), CVVidCapture::Connect(), CVFAILED, CVImage::CVIMAGE_GREY, CVImage::CVIMAGE_RGB24, CVSUCCESS, CVVidCapture::VIDCAP_DEVICE::DeviceString, CVVidCapture::Disconnect(), CVVidCapture::VIDCAP_MODE::EstFrameRate, gDeviceName, CVVidCapture::GetCurrentMode(), CVVidCapture::GetDeviceInfo(), CVVidCapture::GetDeviceName(), CVVidCapture::GetFormatModeName(), CVVidCapture::GetModeInfo(), CVVidCapture::GetNumDevices(), CVVidCapture::GetNumSupportedModes(), CVPlatform::GetPlatform(), CVVidCapture::GetPropertyInfo(), CVVidCapture::Grab(), CVVidCapture::Init(), CVVidCapture::VIDCAP_MODE::InputFormat, CVPlatform::Release(), CVImage::ReleaseImage(), CVImage::Save(), CVVidCapture::SetMode(), CVVidCapture::SetProperty(), CVVidCapture::StartImageCap(), CVVidCapture::Stop(), CVVidCapture::Uninit(), CVVidCapture::VIDCAP_MODE::XRes, and CVVidCapture::VIDCAP_MODE::YRes.

Referenced by main().


Variable Documentation

char gDeviceName[256]
 

Definition at line 123 of file Example.cpp.

Referenced by enumCallback(), main(), and TestIt().

int gDevNum = 0
 

Definition at line 129 of file Example.cpp.

Referenced by enumCallback(), and main().

int gFrameNum = 0
 

Definition at line 126 of file Example.cpp.

Referenced by capCallback(), and main().


Generated on Mon Mar 1 13:27:13 2004 for VidCapture Library by doxygen 1.3.3
CodeVis VidCapture 0.2 Copyright © 2003-2004 by Michael Ellison.