Bumblebee2Camera Class Reference

Bumblebee2 camera. More...

#include <cams/bumblebee2.h>

Inheritance diagram for Bumblebee2Camera:

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 32 of file bumblebee2.h.


Constructor & Destructor Documentation

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 121 of file bumblebee2.cpp.

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

Bumblebee2Camera::~Bumblebee2Camera (  )  [virtual]

Destructor.

Definition at line 167 of file bumblebee2.cpp.


Member Function Documentation

unsigned char * 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 FirewireCamera.

Definition at line 310 of file bumblebee2.cpp.

Referenced by TriclopsStereoProcessor::TriclopsStereoProcessor().

void 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 FirewireCamera.

Definition at line 294 of file bumblebee2.cpp.

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

void Bumblebee2Camera::close (  )  [virtual]

Close camera.

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

Reimplemented from FirewireCamera.

Definition at line 278 of file bumblebee2.cpp.

References FirewireCamera::_opened.

void 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 397 of file bumblebee2.cpp.

void 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 355 of file bumblebee2.cpp.

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

Referenced by TriclopsStereoProcessor::preprocess_stereo().

void 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 374 of file bumblebee2.cpp.

void Bumblebee2Camera::deinterlace_stereo (  ) 

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

Definition at line 342 of file bumblebee2.cpp.

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

Referenced by TriclopsStereoProcessor::preprocess_stereo().

bool Bumblebee2Camera::is_bumblebee2 (  ) 

Check if connected camera is a Bumblebee2.

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

Definition at line 332 of file bumblebee2.cpp.

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

Referenced by TriclopsStereoProcessor::TriclopsStereoProcessor().

void 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 FirewireCamera.

Definition at line 233 of file bumblebee2.cpp.

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

void Bumblebee2Camera::print_info (  )  [virtual]

Print out camera information.

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

Reimplemented from FirewireCamera.

Definition at line 220 of file bumblebee2.cpp.

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

uint32_t Bumblebee2Camera::serial_no (  )  const [virtual]

Get BB2 serial no.

Returns:
BB2 serial number.

Definition at line 178 of file bumblebee2.cpp.

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

Referenced by print_info(), and verify_guid().

void 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 FirewireCamera.

Definition at line 317 of file bumblebee2.cpp.

References DEINTERLACED, and RGB_IMAGE.

Referenced by TriclopsStereoProcessor::TriclopsStereoProcessor().

bool 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 202 of file bumblebee2.cpp.

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

Referenced by TriclopsStereoProcessor::verify_rectification_lut().

void 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 470 of file bumblebee2.cpp.

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


Member Data Documentation

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

Deinterlaced image.

Definition at line 37 of file bumblebee2.h.

Referenced by set_image_number().

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

Original image in RAW16.

Definition at line 36 of file bumblebee2.h.

Referenced by capture().

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

From bayer tile decoded RGB image.

Definition at line 38 of file bumblebee2.h.

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


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