Fawkes API  Fawkes Development Version
firevision::Bumblebee2Camera Class Reference

Bumblebee2 camera. More...

#include <>>

Inheritance diagram for firevision::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

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:
    capcamera argument parser

Definition at line 131 of file bumblebee2.cpp.

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

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

Destructor.

Definition at line 177 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 322 of file bumblebee2.cpp.

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

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

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

References firevision::FirewireCamera::_opened.

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

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

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:
deinterlacedin-buffer with deinterlaced image
rgbupon return contains RGB image
widthwidth of image in pixels
heightheight of image in pixels
bayer_patternbayer pattern, one of
  • 0x59595959 (YYYY, no pattern)
  • 0x52474742 (RGGB)
  • 0x47524247 (GRBG)
  • 0x42474752 (BGGR) This depends on the used camera.

Definition at line 409 of file bumblebee2.cpp.

void firevision::Bumblebee2Camera::deinterlace_stereo ( )

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

Definition at line 354 of file bumblebee2.cpp.

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

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:
raw16In-buffer RAW16-encoded
deinterlacedupon return contains the deinterlaced image
widthwidth of image in pixels
heightheight of image in pixels

Definition at line 386 of file bumblebee2.cpp.

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

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

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

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

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

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

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

Get BB2 serial no.

Returns:
BB2 serial number.

Definition at line 188 of file bumblebee2.cpp.

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

Referenced by verify_guid(), and print_info().

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:
nimage number to set

Reimplemented from firevision::FirewireCamera.

Definition at line 329 of file bumblebee2.cpp.

References DEINTERLACED, and RGB_IMAGE.

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_guidGUID to verify
Returns:
true if the given GUID matches the current camera, false otherwise

Definition at line 212 of file bumblebee2.cpp.

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

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:
filenamefilename to write the config to
Exceptions:
Exceptionthrown if there is an error when trying to retrieve the config or writing it to a file.

Definition at line 482 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().


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