Fawkes API  Fawkes Development Version
firevision::Bumblebee2Camera Class Reference

Bumblebee2 camera. More...

#include <>>

Inheritance diagram for firevision::Bumblebee2Camera:

Public Member Functions

 Bumblebee2Camera (const CameraArgumentParser *cap)
 PTGrey image data format: PGR-specific (little endian) mode. More...
 
 Bumblebee2Camera ()
 Constructor. More...
 
virtual ~Bumblebee2Camera ()
 Destructor. More...
 
virtual void open_device ()
 Open the desired device. More...
 
virtual void open ()
 Open the camera. More...
 
virtual void close ()
 Close camera. More...
 
virtual void capture ()
 Capture an image. More...
 
virtual unsigned char * buffer ()
 Get access to current image buffer. More...
 
virtual void set_image_number (unsigned int image_num)
 Set image number to retrieve. More...
 
bool is_bumblebee2 ()
 Check if connected camera is a Bumblebee2. More...
 
void write_triclops_config_from_camera_to_file (const char *filename)
 Retrieve config from camera. More...
 
void deinterlace_stereo ()
 De-interlace the 16 bit data into 2 bayer tile pattern images. More...
 
void decode_bayer ()
 Extract RGB color image from the bayer tile image. More...
 
virtual void print_info ()
 Print out camera information. More...
 
virtual uint32_t serial_no () const
 Get BB2 serial no. More...
 
virtual bool verify_guid (uint64_t ver_guid) const
 Verify GUID validity. More...
 
- Public Member Functions inherited from firevision::FirewireCamera
 FirewireCamera (dc1394framerate_t framerate=DC1394_FRAMERATE_30, dc1394video_mode_t mode=DC1394_VIDEO_MODE_640x480_YUV422, dc1394speed_t speed=DC1394_ISO_SPEED_400, int num_buffers=8)
 Constructor. More...
 
 FirewireCamera (const CameraArgumentParser *cap)
 Constructor. More...
 
virtual ~FirewireCamera ()
 Empty destructor. More...
 
virtual void start ()
 Start image transfer from the camera. More...
 
virtual void stop ()
 Stop image transfer from the camera. More...
 
virtual void flush ()
 Flush image queue. More...
 
virtual bool ready ()
 Camera is ready for taking pictures. More...
 
virtual unsigned int buffer_size ()
 Size of buffer. More...
 
virtual void dispose_buffer ()
 Dispose current buffer. More...
 
virtual unsigned int pixel_width ()
 Width of image in pixels. More...
 
virtual unsigned int pixel_height ()
 Height of image in pixels. More...
 
virtual colorspace_t colorspace ()
 Colorspace of returned image. More...
 
bool iso_mode_enabled ()
 Check if ISO mode is enabled. More...
 
virtual bool auto_focus ()
 Check if auto focus is enabled. More...
 
virtual void set_auto_focus (bool enabled)
 Enable or disable auto focus. More...
 
virtual unsigned int focus ()
 Get current focus value. More...
 
virtual void set_focus (unsigned int focus)
 Set new focus value. More...
 
virtual unsigned int focus_min ()
 Get minimum focus value. More...
 
virtual unsigned int focus_max ()
 Get maximum focus value. More...
 
virtual bool auto_shutter ()
 Get status of auto shutter. More...
 
virtual void set_auto_shutter (bool enabled)
 Set status of auto shutter. More...
 
virtual unsigned int shutter ()
 Get shutter value. More...
 
virtual void set_shutter (unsigned int shutter)
 Set shutter value. More...
 
virtual bool auto_white_balance ()
 Get status of auto white balance. More...
 
virtual void set_auto_white_balance (bool enabled)
 Set status of auto white balance. More...
 
virtual void white_balance (unsigned int *ub, unsigned int *vr)
 Get white balance values. More...
 
virtual void set_white_balance (unsigned int ub, unsigned int vr)
 Set white balance values. More...
 
virtual void set_gain (unsigned int gain)
 Set the gain. More...
 
virtual void parse_set_focus (const char *focus)
 Parse focus and set value. More...
 
virtual void parse_set_white_balance (const char *white_balance)
 Parse white balance and set value. More...
 
virtual void parse_set_shutter (const char *shutter)
 Parse shutter and set value. More...
 
virtual uint64_t guid () const
 Get Firewire GUID of camera. More...
 
virtual const char * model () const
 Get camera model. More...
 
dc1394_t * cobj () const
 Get underlying libdc1394 C handle. More...
 
dc1394camera_t * camera_cobj () const
 Get underlying libdc1394 camera C handle. More...
 
- Public Member Functions inherited from firevision::Camera
virtual ~Camera ()
 Virtual empty destructor. More...
 
virtual fawkes::Timecapture_time ()
 Get the Time of the last successfully captured image. More...
 
- Public Member Functions inherited from firevision::CameraControlFocus
virtual ~CameraControlFocus ()
 Empty virtual destructor. More...
 
- Public Member Functions inherited from firevision::CameraControl
virtual ~CameraControl ()
 Virtual empty destructor. More...
 

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. More...
 
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. More...
 
- Static Public Member Functions inherited from firevision::FirewireCamera
static void print_available_fwcams ()
 Print list of cameras. More...
 

Static Public Attributes

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

Additional Inherited Members

- Protected Attributes inherited from firevision::FirewireCamera
int _num_buffers
 Number of DMA buffers. More...
 
bool _device_opened
 true if device has been opened, false otherwise More...
 
bool _opened
 true if camera has been opened, false otherwise More...
 
bool _started
 true if camera has been started, false otherwise More...
 
bool _auto_focus
 true if auto focus is enabled, false if disabled More...
 
bool _auto_shutter
 true if auto shutter is enabled, false if disabled More...
 
bool _auto_white_balance
 true if auto white balance is enabled, false if disabled More...
 
bool _valid_frame_received
 true, if a valid frame has been received, false otherwise More...
 
bool _do_set_shutter
 true if the shutter should actually be set, false otherwise More...
 
bool _do_set_white_balance
 true if the white balance should actually be set, false otherwise More...
 
bool _do_set_focus
 true if the focus should actually be set, false otherwise More...
 
dc1394_t * _dc1394
 DC1394 main context. More...
 
dc1394video_mode_t _mode
 DC1394 video mode. More...
 
bool _format7_mode_enabled
 Indicator of Format7 status. More...
 
dc1394speed_t _speed
 DC1394 speed. More...
 
dc1394framerate_t _framerate
 DC1394 framerate. More...
 
dc1394camera_t * _camera
 DC1394 camera handle. More...
 
dc1394video_frame_t * _frame
 Last captured DC1394 video frame. More...
 
dc1394color_coding_t _format7_coding
 Format7 color coding. More...
 
int _format7_bpp
 Format7 bytes per packet. More...
 
int _format7_width
 Format7 width. More...
 
int _format7_height
 Format7 height. More...
 
int _format7_startx
 Format7 ROI Start X coordinate. More...
 
int _format7_starty
 Format7 ROI Start Y coordinate. More...
 
unsigned int _white_balance_ub
 White balance U/B value. More...
 
unsigned int _white_balance_vr
 White balance V/R value. More...
 
unsigned int _shutter
 Shutter value. More...
 
unsigned int _focus
 Focus value. More...
 
unsigned int _gain
 Gain value. More...
 
bool _auto_gain
 True, if gain is set automatically. More...
 
char * _model
 Camera model, used in open to identify the camera, if empty first found camera is used. More...
 

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

◆ Bumblebee2Camera() [1/2]

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 133 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().

◆ Bumblebee2Camera() [2/2]

firevision::Bumblebee2Camera::Bumblebee2Camera ( )

◆ ~Bumblebee2Camera()

firevision::Bumblebee2Camera::~Bumblebee2Camera ( )
virtual

Destructor.

Definition at line 201 of file bumblebee2.cpp.

Member Function Documentation

◆ buffer()

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

◆ capture()

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

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

Referenced by Bumblebee2Thread::loop().

◆ close()

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

References firevision::FirewireCamera::_opened, and firevision::FirewireCamera::close().

Referenced by Bumblebee2Thread::finalize().

◆ decode_bayer() [1/2]

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

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

Referenced by Bumblebee2Thread::loop().

◆ decode_bayer() [2/2]

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

References firevision::FirewireCamera::_camera.

◆ deinterlace_stereo() [1/2]

void firevision::Bumblebee2Camera::deinterlace_stereo ( )

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

Definition at line 464 of file bumblebee2.cpp.

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

Referenced by Bumblebee2Thread::loop().

◆ deinterlace_stereo() [2/2]

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

◆ is_bumblebee2()

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

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

◆ open()

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

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

◆ open_device()

void firevision::Bumblebee2Camera::open_device ( )
virtual

Open the desired device.

This only opens the device but does not do any initialization.

Reimplemented from firevision::FirewireCamera.

Definition at line 321 of file bumblebee2.cpp.

References firevision::FirewireCamera::_camera, firevision::FirewireCamera::_dc1394, firevision::FirewireCamera::_device_opened, and firevision::FirewireCamera::_model.

Referenced by open().

◆ print_info()

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

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

◆ serial_no()

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

Get BB2 serial no.

Returns
BB2 serial number.

Definition at line 212 of file bumblebee2.cpp.

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

Referenced by print_info(), and verify_guid().

◆ set_image_number()

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

References DEINTERLACED, and RGB_IMAGE.

◆ verify_guid()

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

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

◆ write_triclops_config_from_camera_to_file()

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

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

Referenced by Bumblebee2Thread::init().

Member Data Documentation

◆ DEINTERLACED

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

Deinterlaced image.

Definition at line 42 of file bumblebee2.h.

Referenced by set_image_number().

◆ ORIGINAL

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

Original image in RAW16.

Definition at line 41 of file bumblebee2.h.

Referenced by capture().

◆ RGB_IMAGE

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: