firevision::Bumblebee2Camera Class Reference

Bumblebee2 camera. More...

#include <cams/bumblebee2.h>

Inheritance diagram for firevision::Bumblebee2Camera:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Bumblebee2Camera (const CameraArgumentParser *cap)
 PTGrey image data format: PGR-specific (little endian) mode.
virtual ~Bumblebee2Camera ()
 Destructor.
virtual void open ()
 Open the camera.
virtual void close ()
 Close camera.
virtual void capture ()
 Capture an image.
virtual unsigned char * buffer ()
 Get access to current image buffer.
virtual void set_image_number (unsigned int image_num)
 Set image number to retrieve.
bool is_bumblebee2 ()
 Check if connected camera is a Bumblebee2.
void write_triclops_config_from_camera_to_file (const char *filename)
 Retrieve config from camera.
void deinterlace_stereo ()
 De-interlace the 16 bit data into 2 bayer tile pattern images.
void decode_bayer ()
 Extract RGB color image from the bayer tile image.
virtual void print_info ()
 Print out camera information.
virtual uint32_t serial_no () const
 Get BB2 serial no.
virtual bool verify_guid (uint64_t ver_guid) const
 Verify GUID validity.

Static Public Member Functions

static void deinterlace_stereo (unsigned char *raw16, unsigned char *deinterlaced, unsigned int width, unsigned int height)
 De-interlace the 16 bit data into 2 bayer tile pattern images.
static void decode_bayer (unsigned char *deinterlaced, unsigned char *rgb, unsigned int width, unsigned int height, bayer_pattern_t bayer_pattern)
 Extract RGB color image from the bayer tile image.

Static Public Attributes

static const unsigned int ORIGINAL = 0
 Original image in RAW16.
static const unsigned int DEINTERLACED = 1
 Deinterlaced image.
static const unsigned int RGB_IMAGE = 2
 From bayer tile decoded RGB image.

Detailed Description

Bumblebee2 camera.

Camera implementation that allows fo access to the PointGrey Research Bumblebee2 camera. It uses libdc1394 to access the camera for fast image transfers (as recommended by PTGrey) and can be used in conjunction with the TriclopsStereoProcessor in the stereo utilities library.

and the Triclops SDK by PTGrey for calculation of the stereo image. This implementation is based on the Firewire implementation and extends it. The capture() method implicitly does all the stereo processing needed. This cannot be turned off. The video modes is appropriately configured for the camera. You can get access to the left and right images where necessary using the set_image_number() method and the constants LEFT_ORIGINAL and RIGHT_ORIGINAL. The disparity image buffer can be retrieved via buffer_disparity().

Currently only the low resolution version (640x480) of the Bumblebee2 is supported, an extension for the hires version may follow if we get one of these cameras.

This class also encapsulates a coordinate system transformation that you can use to transform the coordinates from the camera system to another right-handed system like the robot system.

The camera coordinate system has the X-axis pointing to the right, Y-axis to the floor and Z-axis forward, if the camera is placed parallel to the ground and you look in the direction of the camera. The origin of the system is in the right lens system of the Bumblebee.

Author:
Tim Niemueller

Definition at line 37 of file bumblebee2.h.


Constructor & Destructor Documentation

firevision::Bumblebee2Camera::Bumblebee2Camera ( const CameraArgumentParser cap  ) 

PTGrey image data format: PGR-specific (little endian) mode.

Constructor. Initialize and take parameters from camera argument parser. The following arguments are supported:

  • nbufs=NBUFS, number of DMA buffers, integer, 0 < n <= 32
  • width=WIDTH, width in pixels of Format7 ROI
  • height=HEIGHT, height in pixels of Format7 ROI
  • startx=STARTX, X start of Format7 ROI
  • starty=STARTY, Y start of Format7 ROI
    Parameters:
    cap camera argument parser

Definition at line 129 of file bumblebee2.cpp.

References firevision::FirewireCamera::_format7_coding, firevision::FirewireCamera::_format7_height, firevision::FirewireCamera::_format7_startx, firevision::FirewireCamera::_format7_starty, firevision::FirewireCamera::_format7_width, firevision::FirewireCamera::_model, firevision::FirewireCamera::_num_buffers, firevision::CameraArgumentParser::cam_id(), firevision::CameraArgumentParser::get(), firevision::CameraArgumentParser::has(), firevision::FirewireCamera::parse_set_focus(), firevision::FirewireCamera::parse_set_shutter(), and firevision::FirewireCamera::parse_set_white_balance().

firevision::Bumblebee2Camera::~Bumblebee2Camera (  )  [virtual]

Destructor.

Definition at line 175 of file bumblebee2.cpp.


Member Function Documentation

unsigned char * firevision::Bumblebee2Camera::buffer (  )  [virtual]

Get access to current image buffer.

This will return a pointer to the current buffer. The buffer contains an image of the given colorspace, width and height.

Returns:
pointer to image buffer

Reimplemented from firevision::FirewireCamera.

Definition at line 320 of file bumblebee2.cpp.

Referenced by firevision::TriclopsStereoProcessor::TriclopsStereoProcessor().

void firevision::Bumblebee2Camera::capture (  )  [virtual]

Capture an image.

Although cameras shall operate with a continuous image flow where possible sometimes capturing an image means copying a buffer or advancing a buffer list pointer. This shall be done in this method. For a camera-using application it is mandatory to call capture() just before accessing the image buffer.

Reimplemented from firevision::FirewireCamera.

Definition at line 304 of file bumblebee2.cpp.

References firevision::FirewireCamera::_frame, fawkes::Exception::append(), and ORIGINAL.

void firevision::Bumblebee2Camera::close (  )  [virtual]

Close camera.

This closes the camera device. The camera must have been stopped before calling close().

Reimplemented from firevision::FirewireCamera.

Definition at line 288 of file bumblebee2.cpp.

References firevision::FirewireCamera::_opened.

void firevision::Bumblebee2Camera::decode_bayer ( unsigned char *  deinterlaced,
unsigned char *  rgb,
unsigned int  width,
unsigned int  height,
bayer_pattern_t  bayer_pattern 
) [static]

Extract RGB color image from the bayer tile image.

This will transform the bayer tile image to an RGB image using the nearest neighbour method. Note: this will alias colors on the top and bottom rows

Parameters:
deinterlaced in-buffer with deinterlaced image
rgb upon return contains RGB image
width width of image in pixels
height height of image in pixels
bayer_pattern bayer pattern, one of

  • 0x59595959 (YYYY, no pattern)
  • 0x52474742 (RGGB)
  • 0x47524247 (GRBG)
  • 0x42474752 (BGGR) This depends on the used camera.

Definition at line 407 of file bumblebee2.cpp.

void firevision::Bumblebee2Camera::decode_bayer (  ) 

Extract RGB color image from the bayer tile image.

This will transform the bayer tile image to an RGB image using the nearest neighbour method. Note: this will alias colors on the top and bottom rows

Definition at line 365 of file bumblebee2.cpp.

References firevision::FirewireCamera::pixel_height(), and firevision::FirewireCamera::pixel_width().

Referenced by firevision::TriclopsStereoProcessor::preprocess_stereo().

void firevision::Bumblebee2Camera::deinterlace_stereo ( unsigned char *  raw16,
unsigned char *  deinterlaced,
unsigned int  width,
unsigned int  height 
) [static]

De-interlace the 16 bit data into 2 bayer tile pattern images.

Can be used for offline de-interlacing.

Parameters:
raw16 In-buffer RAW16-encoded
deinterlaced upon return contains the deinterlaced image
width width of image in pixels
height height of image in pixels

Definition at line 384 of file bumblebee2.cpp.

void firevision::Bumblebee2Camera::deinterlace_stereo (  ) 

De-interlace the 16 bit data into 2 bayer tile pattern images.

Definition at line 352 of file bumblebee2.cpp.

References firevision::FirewireCamera::_frame, firevision::FirewireCamera::pixel_height(), and firevision::FirewireCamera::pixel_width().

Referenced by firevision::TriclopsStereoProcessor::preprocess_stereo().

bool firevision::Bumblebee2Camera::is_bumblebee2 (  ) 

Check if connected camera is a Bumblebee2.

Returns:
true, if the connected camera is a Bumblebee2, false otherwise

Definition at line 342 of file bumblebee2.cpp.

References firevision::FirewireCamera::_camera, and firevision::FirewireCamera::_opened.

Referenced by firevision::TriclopsStereoProcessor::TriclopsStereoProcessor().

void firevision::Bumblebee2Camera::open (  )  [virtual]

Open the camera.

The camera is opened, but image transfer not yet started. This can be used to detect general problems with the camera while delaying the real transfer startup until it is needed.

Reimplemented from firevision::FirewireCamera.

Definition at line 241 of file bumblebee2.cpp.

References firevision::FirewireCamera::_camera, firevision::FirewireCamera::_opened, firevision::FirewireCamera::pixel_height(), and firevision::FirewireCamera::pixel_width().

void firevision::Bumblebee2Camera::print_info (  )  [virtual]

Print out camera information.

Shall print out camera information and current setup information on stdout.

Reimplemented from firevision::FirewireCamera.

Definition at line 228 of file bumblebee2.cpp.

References firevision::FirewireCamera::guid(), and serial_no().

uint32_t firevision::Bumblebee2Camera::serial_no (  )  const [virtual]

Get BB2 serial no.

Returns:
BB2 serial number.

Definition at line 186 of file bumblebee2.cpp.

References firevision::FirewireCamera::_camera, and firevision::FirewireCamera::_opened.

Referenced by print_info(), and verify_guid().

void firevision::Bumblebee2Camera::set_image_number ( unsigned int  n  )  [virtual]

Set image number to retrieve.

If a camera is able to retrieve several images this method can be used to select the image to be retrieved with the next call to capture().

Parameters:
n image number to set

Reimplemented from firevision::FirewireCamera.

Definition at line 327 of file bumblebee2.cpp.

References DEINTERLACED, and RGB_IMAGE.

Referenced by firevision::TriclopsStereoProcessor::TriclopsStereoProcessor().

bool firevision::Bumblebee2Camera::verify_guid ( uint64_t  ver_guid  )  const [virtual]

Verify GUID validity.

Compares the given GUID with the GUID of the camera. The GUID may be of two forms. If the first four bytes are all 0xFF then it is assumed that the GUID was created from the BB2-specific serial number. For example if a rectification LUT was generated with the context file only but without access to the real camera. Otherwise the GUID is matched against the Firewire GUID.

Parameters:
ver_guid GUID to verify
Returns:
true if the given GUID matches the current camera, false otherwise

Definition at line 210 of file bumblebee2.cpp.

References firevision::FirewireCamera::_opened, firevision::FirewireCamera::guid(), and serial_no().

Referenced by firevision::TriclopsStereoProcessor::verify_rectification_lut().

void firevision::Bumblebee2Camera::write_triclops_config_from_camera_to_file ( const char *  filename  ) 

Retrieve config from camera.

This method retrieves the config from the camera and writes it to a file such that the Triclops SDK can use it for context initialization.

Parameters:
filename filename to write the config to
Exceptions:
Exception thrown if there is an error when trying to retrieve the config or writing it to a file.

Definition at line 480 of file bumblebee2.cpp.

References firevision::FirewireCamera::_camera, and fawkes::Exception::append().


Member Data Documentation

const unsigned int firevision::Bumblebee2Camera::DEINTERLACED = 1 [static]

Deinterlaced image.

Definition at line 42 of file bumblebee2.h.

Referenced by set_image_number().

const unsigned int firevision::Bumblebee2Camera::ORIGINAL = 0 [static]

Original image in RAW16.

Definition at line 41 of file bumblebee2.h.

Referenced by capture().

const unsigned int firevision::Bumblebee2Camera::RGB_IMAGE = 2 [static]

From bayer tile decoded RGB image.

Definition at line 43 of file bumblebee2.h.

Referenced by set_image_number(), and firevision::TriclopsStereoProcessor::TriclopsStereoProcessor().


The documentation for this class was generated from the following files:

Generated on 1 Mar 2011 for Fawkes API by  doxygen 1.6.1