Fawkes API
Fawkes Development Version
|
Bumblebee2 camera. More...
#include <>>
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... | |
![]() | |
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... | |
![]() | |
virtual | ~Camera () |
Virtual empty destructor. More... | |
virtual fawkes::Time * | capture_time () |
Get the Time of the last successfully captured image. More... | |
![]() | |
virtual | ~CameraControlFocus () |
Empty virtual destructor. More... | |
![]() | |
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 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 | |
![]() | |
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... | |
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.
Definition at line 37 of file bumblebee2.h.
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:
cap | camera 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().
firevision::Bumblebee2Camera::Bumblebee2Camera | ( | ) |
Constructor.
Initialize and use largest possible video mode suitable for stereo processing.
Definition at line 184 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, and firevision::FirewireCamera::_model.
|
virtual |
Destructor.
Definition at line 201 of file bumblebee2.cpp.
|
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.
Reimplemented from firevision::FirewireCamera.
Definition at line 432 of file bumblebee2.cpp.
|
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().
|
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().
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().
|
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
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
|
Definition at line 519 of file bumblebee2.cpp.
References firevision::FirewireCamera::_camera.
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().
|
static |
De-interlace the 16 bit data into 2 bayer tile pattern images.
Can be used for offline de-interlacing.
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 496 of file bumblebee2.cpp.
bool firevision::Bumblebee2Camera::is_bumblebee2 | ( | ) |
Check if connected camera is a Bumblebee2.
Definition at line 454 of file bumblebee2.cpp.
References firevision::FirewireCamera::_camera, and firevision::FirewireCamera::_opened.
|
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().
|
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().
|
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().
|
virtual |
Get BB2 serial no.
Definition at line 212 of file bumblebee2.cpp.
References firevision::FirewireCamera::_camera, and firevision::FirewireCamera::_opened.
Referenced by print_info(), and verify_guid().
|
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().
n | image number to set |
Reimplemented from firevision::FirewireCamera.
Definition at line 439 of file bumblebee2.cpp.
References DEINTERLACED, and RGB_IMAGE.
|
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.
ver_guid | GUID to verify |
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().
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.
filename | filename to write the config to |
Exception | thrown 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().
|
static |
|
static |
|
static |
From bayer tile decoded RGB image.
Definition at line 43 of file bumblebee2.h.
Referenced by set_image_number().