Base_firei
[Firei]

This module handles low level firewire communication with unibrain firei cameras. More...

Collaboration diagram for Base_firei:

Data Structures

class  base_firei_control

Files

file  base_firei.cpp
 

Defines the class's main methods.


file  base_firei.h
 

Defines the base_firei class.


file  conversions.cpp
 

Defines the base_firei conversions. Copied directly from Coriander, and added conversions to bgr (backwards rgb).


file  conversions.h
 

Defines the base_firei conversions. Copied directly from Coriander, and added conversions to bgr (backwards rgb).


file  setsandgets.cpp
 

Defines the base_firei sets and gets. Methods for settting or getting advanced camera parameters like brightness etc.


Defines

#define TRUE   1
#define FALSE   0
#define AUTO   1
#define MANUAL   0
#define SET1_BRIGHTNESS   350
#define SET1_EXPOSURE   500
#define SET1_SHARPNESS   70
#define SET1_SATURATION   130
#define SET1_GAMMA   1
#define SET1_SHUTTER   7
#define SET1_GAIN   60
#define SET2_BRIGHTNESS   379
#define SET2_EXPOSURE   500
#define SET2_SHARPNESS   70
#define SET2_SATURATION   130
#define SET2_GAMMA   0
#define SET2_SHUTTER   7
#define SET2_GAIN   235
#define YUYV
#define YUV2RGB(y, u, v, r, g, b)
#define RGB2YUV(r, g, b, y, u, v)
#define CLIP(in, out)
#define OPENCV_CONVERSIONS

Enumerations

enum  bayer_decoding_t { NO_BAYER_DECODING, BAYER_DECODING_NEAREST, BAYER_DECODING_EDGE_SENSE, BAYER_DECODING_DOWNSAMPLE }
enum  stereo_decoding_t { NO_STEREO_DECODING, STEREO_DECODING }
enum  bayer_pattern_t { BAYER_PATTERN_BGGR, BAYER_PATTERN_GRBG, BAYER_PATTERN_RGGB, BAYER_PATTERN_GBRG }

Functions

void yuyv2uyvy (unsigned char *, unsigned char *, int)
void uyvy2yuyv (unsigned char *, unsigned char *, int)
void uyyvyy2uyvy (unsigned char *src, unsigned char *dest, int NumPixels)
void uyv2uyvy (unsigned char *src, unsigned char *dest, int NumPixels)
void y2uyvy (unsigned char *src, unsigned char *dest, int NumPixels)
void y162uyvy (unsigned char *src, unsigned char *dest, int NumPixels, int bits)
void y162y (unsigned char *src, unsigned char *dest, int NumPixels, int bits)
void rgb2uyvy (unsigned char *src, unsigned char *dest, int NumPixels)
void rgb482uyvy (unsigned char *src, unsigned char *dest, int NumPixels)
void rgb482rgb (unsigned char *src, unsigned char *dest, int NumPixels)
void uyv2rgb (unsigned char *src, unsigned char *dest, int NumPixels)
void uyv2bgr (unsigned char *src, unsigned char *dest, int NumPixels)
void uyvy2rgb (unsigned char *src, unsigned char *dest, int NumPixels)
void uyvy2bgr (unsigned char *src, unsigned char *dest, int NumPixels)
void uyyvyy2rgb (unsigned char *src, unsigned char *dest, int NumPixels)
void uyyvyy2bgr (unsigned char *src, unsigned char *dest, int NumPixels)
void y2rgb (unsigned char *src, unsigned char *dest, int NumPixels)
void y162rgb (unsigned char *src, unsigned char *dest, int NumPixels, int bits)
void BayerNearestNeighbor (unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type)
void BayerEdgeSense (unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type)
void BayerDownsample (unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type)
void StereoDecode (unsigned char *src, unsigned char *dest, int NumPixels)
void convert_to_rgb (unsigned char *src, unsigned char *dest, int mode, int width, int height, int f7_colormode, int bayer, int bits)
void convert_to_bgr (unsigned char *src, unsigned char *dest, int mode, int width, int height, int, int bayer, int)
 base_firei_control::base_firei_control ()
 Class constructor.
 base_firei_control::base_firei_control (char *devicefile, int HN, int NN, int CF, int FR)
 Overloaded class constructor.
 base_firei_control::~base_firei_control ()
 Class destructor.
int base_firei_control::SetPredefinedParams (int paramsset)
int base_firei_control::SetColorFormat (int cm)
 Sets the camera color format.
int base_firei_control::OpenHandle (void)
 Opens the raw1394 handle with the num HandleNum.
int base_firei_control::TurnOffCamera (void)
 Turns off the camera in handle handlenum and node nodenum.
int base_firei_control::TurnOnCamera (void)
 Turns on the camera in handle handlenum and node nodenum.
int base_firei_control::GetCameraNodes (void)
 Gets all the cameras and their nodes in the predefined handlenum.
int base_firei_control::PrintPossibleModes (void)
 Prints to shell all the camera possible modes.
int base_firei_control::PrintPossibleFrameRates (void)
 Prints to shell all the camera possible frame rates.
int base_firei_control::StartIsoTransmission (void)
 Starts iso transmission.
int base_firei_control::GetFrame_dma (IplImage *img, int64 *ts)
int base_firei_control::GetFrame_dma (IplImage *img)
 Gets an image from the camera at handle handlenum and node nodenum.
int base_firei_control::GetFrame (IplImage *img, double *ts)
int base_firei_control::GetFrame_dma (IplImage *img, double *ts)
int base_firei_control::SetFeatureToManualAuto (unsigned int f, unsigned int val)
 Sets a camera feature to manual or auto control.
int base_firei_control::GetBrightness (void)
int base_firei_control::GetExposure (void)
int base_firei_control::GetSharpness (void)
int base_firei_control::GetWhiteBalance (void)
int base_firei_control::GetHue (void)
int base_firei_control::GetSaturation (void)
int base_firei_control::GetGamma (void)
int base_firei_control::GetShutter (void)
int base_firei_control::GetGain (void)
int base_firei_control::GetFrameRate (void)
int base_firei_control::GetIris (void)
int base_firei_control::SetBrightness (unsigned int b, unsigned char manual)
int base_firei_control::SetSaturation (unsigned int s, unsigned char manual)
int base_firei_control::SetFrameRate (int fr)
int base_firei_control::SetExposure (unsigned int e, unsigned char manual)
int base_firei_control::SetSharpness (unsigned int s, unsigned char manual)
int base_firei_control::SetWhiteBalance (unsigned int ub, unsigned int vr, unsigned char manual)
int base_firei_control::SetHue (unsigned int h, unsigned char manual)
int base_firei_control::SetGamma (unsigned int g, unsigned char manual)
int base_firei_control::SetShutter (unsigned int s, unsigned char manual)
int base_firei_control::SetGain (unsigned int g, unsigned char manual)

Detailed Description

This module handles low level firewire communication with unibrain firei cameras.


Define Documentation

#define AUTO   1
#define CLIP ( in,
out   ) 
Value:
{\
   in = in < 0 ? 0 : in;\
   in = in > 255 ? 255 : in;\
   out=in;\
}
#define FALSE   0
#define MANUAL   0
#define OPENCV_CONVERSIONS
#define RGB2YUV ( r,
g,
b,
y,
u,
v   ) 
Value:
y = (306*r + 601*g + 117*b)  >> 10;\
  u = ((-172*r - 340*g + 512*b) >> 10)  + 128;\
  v = ((512*r - 429*g - 83*b) >> 10) + 128;\
  y = y < 0 ? 0 : y;\
  u = u < 0 ? 0 : u;\
  v = v < 0 ? 0 : v;\
  y = y > 255 ? 255 : y;\
  u = u > 255 ? 255 : u;\
  v = v > 255 ? 255 : v
#define SET1_BRIGHTNESS   350
#define SET1_EXPOSURE   500
#define SET1_GAIN   60
#define SET1_GAMMA   1
#define SET1_SATURATION   130
#define SET1_SHARPNESS   70
#define SET1_SHUTTER   7
#define SET2_BRIGHTNESS   379
#define SET2_EXPOSURE   500
#define SET2_GAIN   235
#define SET2_GAMMA   0
#define SET2_SATURATION   130
#define SET2_SHARPNESS   70
#define SET2_SHUTTER   7
#define TRUE   1
#define YUV2RGB ( y,
u,
v,
r,
g,
 ) 
Value:
r = y + ((v*1436) >>10);\
  g = y - ((u*352 + v*731) >> 10);\
  b = y + ((u*1814) >> 10);\
  r = r < 0 ? 0 : r;\
  g = g < 0 ? 0 : g;\
  b = b < 0 ? 0 : b;\
  r = r > 255 ? 255 : r;\
  g = g > 255 ? 255 : g;\
  b = b > 255 ? 255 : b

Referenced by uyv2bgr(), and uyyvyy2bgr().

#define YUYV

Enumeration Type Documentation

Enumerator:
NO_BAYER_DECODING 
BAYER_DECODING_NEAREST 
BAYER_DECODING_EDGE_SENSE 
BAYER_DECODING_DOWNSAMPLE 
Enumerator:
BAYER_PATTERN_BGGR 
BAYER_PATTERN_GRBG 
BAYER_PATTERN_RGGB 
BAYER_PATTERN_GBRG 
Enumerator:
NO_STEREO_DECODING 
STEREO_DECODING 

Function Documentation

base_firei_control::base_firei_control ( char *  devicefile,
int  HN,
int  NN,
int  CF,
int  FR 
) [inherited]
base_firei_control::base_firei_control (  )  [inherited]

Class constructor.

void BayerDownsample ( unsigned char *  src,
unsigned char *  dest,
int  sx,
int  sy,
bayer_pattern_t  type 
)
void BayerEdgeSense ( unsigned char *  src,
unsigned char *  dest,
int  sx,
int  sy,
bayer_pattern_t  type 
)
void BayerNearestNeighbor ( unsigned char *  src,
unsigned char *  dest,
int  sx,
int  sy,
bayer_pattern_t  type 
)
void convert_to_bgr ( unsigned char *  src,
unsigned char *  dest,
int  mode,
int  width,
int  height,
int  ,
int  bayer,
int   
)

Referenced by base_firei_control::GetFrame(), and base_firei_control::GetFrame_dma().

Here is the caller graph for this function:

void convert_to_rgb ( unsigned char *  src,
unsigned char *  dest,
int  mode,
int  width,
int  height,
int  f7_colormode,
int  bayer,
int  bits 
)
int base_firei_control::GetBrightness ( void   )  [inherited]
int base_firei_control::GetCameraNodes ( void   )  [inherited]

Gets all the cameras and their nodes in the predefined handlenum.

Returns:
function result. 1 is OK 0 is NOK

References base_firei_control::camera_nodes, base_firei_control::handle, and base_firei_control::numCameras.

int base_firei_control::GetExposure ( void   )  [inherited]
int base_firei_control::GetFrame ( IplImage *  img,
double *  ts 
) [inherited]
int base_firei_control::GetFrame_dma ( IplImage *  img,
double *  ts 
) [inherited]
int base_firei_control::GetFrame_dma ( IplImage *  img  )  [inherited]

Gets an image from the camera at handle handlenum and node nodenum.

The img data will be filled with the captured frame information. If testimgparams flag is set (it's set by default) the function first checks if the img properties are the same as the capture ones avoiding a runtime crash. Of course this test will take a bit longer if performed.

Parameters:
img Pointer to the user image.
Returns:
function return the value of the current framerate stored in captureparams.FrameRate

References base_firei_control::camera, base_firei_control::captureparams, convert_to_bgr(), FALSE, base_firei_control::handle, base_firei_control::mode, NO_BAYER_DECODING, and TRUE.

Referenced by base_firei_control::GetFrame_dma().

Here is the call graph for this function:

Here is the caller graph for this function:

int base_firei_control::GetFrame_dma ( IplImage *  img,
int64 *  ts 
) [inherited]

References base_firei_control::GetFrame_dma(), and tmp.

Here is the call graph for this function:

int base_firei_control::GetFrameRate ( void   )  [inherited]
int base_firei_control::GetGain ( void   )  [inherited]
int base_firei_control::GetGamma ( void   )  [inherited]
int base_firei_control::GetHue ( void   )  [inherited]
int base_firei_control::GetIris ( void   )  [inherited]
int base_firei_control::GetSaturation ( void   )  [inherited]
int base_firei_control::GetSharpness ( void   )  [inherited]
int base_firei_control::GetShutter ( void   )  [inherited]
int base_firei_control::GetWhiteBalance ( void   )  [inherited]
int base_firei_control::OpenHandle ( void   )  [inherited]

Opens the raw1394 handle with the num HandleNum.

Returns:
function result. 1 is OK 0 is NOK

References FALSE, base_firei_control::handle, base_firei_control::handlenum, and TRUE.

int base_firei_control::PrintPossibleFrameRates ( void   )  [inherited]

Prints to shell all the camera possible frame rates.

Returns:
function result. 1 is OK 0 is NOK

Referenced by base_firei_control::SetFrameRate().

Here is the caller graph for this function:

int base_firei_control::PrintPossibleModes ( void   )  [inherited]

Prints to shell all the camera possible modes.

Returns:
function result. 1 is OK 0 is NOK

Referenced by base_firei_control::SetColorFormat().

Here is the caller graph for this function:

void rgb2uyvy ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void rgb482rgb ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void rgb482uyvy ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
int base_firei_control::SetBrightness ( unsigned int  b,
unsigned char  manual 
) [inherited]
int base_firei_control::SetColorFormat ( int  cm  )  [inherited]

Sets the camera color format.

The color format is defined in an enum declared in dc1394_control.h
The supported modes are:

  • MODE_160x120_YUV444 = 64 (WARNING: TESTS FAILED WITH THIS OPTION)
  • MODE_320x240_YUV422
  • MODE_640x480_YUV411
  • MODE_640x480_YUV422 (WARNING: TESTS FAILED WITH THIS OPTION)
  • MODE_640x480_RGB (WARNING: TESTS FAILED WITH THIS OPTION)
  • MODE_640x480_MONO (WARNING: TESTS FAILED WITH THIS OPTION)
  • MODE_640x480_MONO16 (WARNING: TESTS FAILED WITH THIS OPTION)

If none of this modes is selected the default mode MODE_320x240_YUV422 is selected

Parameters:
cm Color format reference given by an enum defined in dc1394_control.h
Returns:
function result. 1 is OK 0 is NOK

References base_firei_control::captureparams, and base_firei_control::PrintPossibleModes().

Here is the call graph for this function:

int base_firei_control::SetExposure ( unsigned int  e,
unsigned char  manual 
) [inherited]
int base_firei_control::SetFeatureToManualAuto ( unsigned int  f,
unsigned int  val 
) [inherited]

Sets a camera feature to manual or auto control.

The available features are defined in a enum of dc1394_control.h
These are:

  • FEATURE_BRIGHTNESS = 416
  • FEATURE_EXPOSURE
  • FEATURE_SHARPNESS
  • FEATURE_WHITE_BALANCE
  • FEATURE_HUE
  • FEATURE_SATURATION
  • FEATURE_GAMMA
  • FEATURE_SHUTTER
  • FEATURE_GAIN
  • FEATURE_IRIS
  • FEATURE_FOCUS
  • FEATURE_TEMPERATURE
  • FEATURE_TRIGGER
  • FEATURE_TRIGGER_DELAY
  • FEATURE_WHITE_SHADING
  • FEATURE_FRAME_RATE
    Parameters:
    f feature to change
    val 1 is auto and 0 for manual
    Returns:
    function result. 1 is OK 0 is NOK

References base_firei_control::camera_nodes, base_firei_control::handle, and base_firei_control::nodenum.

int base_firei_control::SetFrameRate ( int  fr  )  [inherited]
int base_firei_control::SetGain ( unsigned int  g,
unsigned char  manual 
) [inherited]
int base_firei_control::SetGamma ( unsigned int  g,
unsigned char  manual 
) [inherited]
int base_firei_control::SetHue ( unsigned int  h,
unsigned char  manual 
) [inherited]
int base_firei_control::SetPredefinedParams ( int  paramsset  )  [inherited]
int base_firei_control::SetSaturation ( unsigned int  s,
unsigned char  manual 
) [inherited]
int base_firei_control::SetSharpness ( unsigned int  s,
unsigned char  manual 
) [inherited]
int base_firei_control::SetShutter ( unsigned int  s,
unsigned char  manual 
) [inherited]
int base_firei_control::SetWhiteBalance ( unsigned int  ub,
unsigned int  vr,
unsigned char  manual 
) [inherited]
int base_firei_control::StartIsoTransmission ( void   )  [inherited]

Starts iso transmission.

Returns:
function result. 1 is OK 0 is NOK

References base_firei_control::camera, and base_firei_control::handle.

void StereoDecode ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
int base_firei_control::TurnOffCamera ( void   )  [inherited]

Turns off the camera in handle handlenum and node nodenum.

Returns:
function result. 1 is OK 0 is NOK

References base_firei_control::handle, base_firei_control::nodenum, and ret.

int base_firei_control::TurnOnCamera ( void   )  [inherited]

Turns on the camera in handle handlenum and node nodenum.

Returns:
function result. 1 is OK 0 is NOK

References base_firei_control::handle, base_firei_control::nodenum, and ret.

void uyv2bgr ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)

References YUV2RGB.

void uyv2rgb ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void uyv2uyvy ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void uyvy2bgr ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void uyvy2rgb ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void uyvy2yuyv ( unsigned char *  ,
unsigned char *  ,
int   
)
void uyyvyy2bgr ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)

References YUV2RGB.

void uyyvyy2rgb ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void uyyvyy2uyvy ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void y162rgb ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels,
int  bits 
)
void y162uyvy ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels,
int  bits 
)
void y162y ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels,
int  bits 
)
void y2rgb ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void y2uyvy ( unsigned char *  src,
unsigned char *  dest,
int  NumPixels 
)
void yuyv2uyvy ( unsigned char *  ,
unsigned char *  ,
int   
)
base_firei_control::~base_firei_control (  )  [inherited]

Class destructor.

References base_firei_control::camera, and base_firei_control::handle.

Generated on Wed Jun 2 12:43:24 2010 for LAR Atlas by  doxygen 1.6.3