C:/dev/CMUCameraGrab/CMUCameraGrab/CMUGrab.cpp File Reference

#include "stdafx.h"
#include "CMUCameraGrab.h"

Include dependency graph for CMUGrab.cpp:

Functions

int getFrameRateCode (float fps)
 Converts frames per second into DCAM frame rate code.
float getFrameRate (int frameRateCode)
 Converts DCAM frame rate code into frames per second.
int setupFWCamera (int width, int height, float fps, enum ColourSpace col)
 set up camera given width, height, fps and colour space
int setupFWCamera (int format, int mode, int frameRate)
 set up camera given a DCAM format, mode, and frame rate code
int setupFWCamera (void)
 sets up camera with 640x480 RGB and 15fps
int startImageAcquisition ()
 starts the camera acquisition process
int getFWImage (IplImage *img)
 gets an image off the acquisition buffer. NB IplImage img is always unsigned 8 bit 3 channel RGB no matter what the camera settings are
int stopFWCamera ()
 stops the acquisition
int getColourString (enum ColourSpace col, char *name)
 Converts colour space enum into human readable string.
int getWidthHeight (int format, int mode, int *width, int *height, enum ColourSpace *col)
 Get the width, height and colour space for a given mode and format.
int getModeFormat (int *format, int *mode, int width, int height, enum ColourSpace *col)
 Gets the mode and format given a video width, height and colour space.
void BRG2RGB (IplImage *img)
 Convert a colour BRG image to RGB.
int getCurrentCameraFormat (int *format, int *mode)
 Returns the current camera format and mode.
int listSupportedModes ()
 Prints supported modes to the console.

Variables

C1394Camera Camera
 CMU camera class.

Function Documentation

void BRG2RGB ( IplImage *  img  ) 

Convert a colour BRG image to RGB.

Parameters:
img IplImage to covert colour order. This must be 8 bit unsigned and 3 channel. No checking is done for speed.
Convert a colour BRG image to RGB. Colour from the camera is in BRG, even though Microsoft lie call it RGB. They do that a lot.

int getColourString ( enum ColourSpace  col,
char *  name 
)

Converts colour space enum into human readable string.

Parameters:
col Colour space
name Pre-allocated char array, must be at least 7 bytes long
Returns:
0
Helper function

int getCurrentCameraFormat ( int *  format,
int *  mode 
)

Returns the current camera format and mode.

Parameters:
format output format.
mode output mode.
Returns:
0 if okay, -1 otherwise

float getFrameRate ( int  frameRateCode  ) 

Converts DCAM frame rate code into frames per second.

Parameters:
frameRateCode DCAM frame rate code 0-7.
Returns:
fps or -1 if frame rate code is not between 0 and 7

int getFrameRateCode ( float  fps  ) 

Converts frames per second into DCAM frame rate code.

Parameters:
fps input desired fps.
Returns:
DCAM frame rate code or -1 if input parameter is not supported
This function converts a real floating point frames per second into the correct DCAM frame rate code. The supported rates are 1.875,3.75,7.5,15,30,60,120,240 frames per second. The function uses rounding in converting floats to integers to take into account machine errors. Note it does not test to see if the camera supports the mode.

int getFWImage ( IplImage *  img  ) 

gets an image off the acquisition buffer. NB IplImage img is always unsigned 8 bit 3 channel RGB no matter what the camera settings are

int getModeFormat ( int *  format,
int *  mode,
int  width,
int  height,
enum ColourSpace col 
)

Gets the mode and format given a video width, height and colour space.

Parameters:
format DCAM format to be returned
mode DCAM mode to be returned
width input desired video width
height input desired video height
col input desired video colour model
Returns:
-1 if width and height are not DCAM supported, -2 if the colour space is not supported for the selected width and height. In this case mode, format and col are set to RGB. 0 if sucessfull
This is a help function to find a mode and format for a given width, height and colour space. It does not test to see if the camera supports the mode.

int getWidthHeight ( int  format,
int  mode,
int *  width,
int *  height,
enum ColourSpace col 
)

Get the width, height and colour space for a given mode and format.

Parameters:
format DCAM format.
mode DCAM mode.
width Outputs the width.
height Outputs the height.
col Outputs the colour space.
Returns:
-1 on error, 0 otherwise
Helper function

int listSupportedModes (  ) 

Prints supported modes to the console.

Returns:
0

int setupFWCamera ( void   ) 

sets up camera with 640x480 RGB and 15fps

int setupFWCamera ( int  format,
int  mode,
int  frameRate 
)

set up camera given a DCAM format, mode, and frame rate code

int setupFWCamera ( int  width,
int  height,
float  fps,
enum ColourSpace  col 
)

set up camera given width, height, fps and colour space

Sets up the camera

Parameters:
width Video width.
height Video height
fps Frames per second.
col Colour space
Returns:
0 if okay, or else -1

int startImageAcquisition ( void   ) 

starts the camera acquisition process

Returns:
0 if okay or else -1

int stopFWCamera ( void   ) 

stops the acquisition

Returns:
0


Variable Documentation

C1394Camera Camera

CMU camera class.

Simple quick and dirty wrapper functions for the CMU1394 library

Copyright (c) 2008 by <Philip Birch/University of Sussex> Version 0.1


Generated on Tue Sep 2 15:16:17 2008 for Quick and dirty firewire to Iplimage library by  doxygen 1.5.6