Fawkes API
Fawkes Development Version
|
Firewire camera. More...
#include <>>
Public Member Functions | |
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 | open_device () |
Open the desired device. More... | |
virtual void | open () |
Open the camera. More... | |
virtual void | start () |
Start image transfer from the camera. More... | |
virtual void | stop () |
Stop image transfer from the camera. More... | |
virtual void | close () |
Close camera. More... | |
virtual void | flush () |
Flush image queue. More... | |
virtual void | capture () |
Capture an image. More... | |
virtual void | print_info () |
Print out camera information. More... | |
virtual bool | ready () |
Camera is ready for taking pictures. More... | |
virtual unsigned char * | buffer () |
Get access to current image buffer. 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... | |
virtual void | set_image_number (unsigned int n) |
Set image number to retrieve. 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 | print_available_fwcams () |
Print list of cameras. More... | |
Protected Attributes | |
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... | |
Firewire camera.
This camera implementation allows for access to IEEE1394 cameras via libdc1394.
Definition at line 44 of file firewire.h.
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.
framerate | desired framerate |
mode | desired mode |
speed | IEEE 1394 speed |
num_buffers | number of DMA buffers |
Definition at line 60 of file firewire.cpp.
firevision::FirewireCamera::FirewireCamera | ( | const CameraArgumentParser * | cap | ) |
Constructor.
Initialize and take parameters from camera argument parser. The following arguments are supported:
cap | camera argument parser |
Definition at line 869 of file firewire.cpp.
References firevision::CameraArgumentParser::cam_id(), firevision::CameraArgumentParser::get(), and firevision::CameraArgumentParser::has().
|
virtual |
Empty destructor.
Definition at line 97 of file firewire.cpp.
|
virtual |
Check if auto focus is enabled.
NotImplementedException | Not implemented by this control |
Implements firevision::CameraControlFocus.
Definition at line 555 of file firewire.cpp.
|
virtual |
Get status of auto shutter.
Definition at line 625 of file firewire.cpp.
|
virtual |
Get status of auto white balance.
Definition at line 675 of file firewire.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.
Implements firevision::Camera.
Reimplemented in firevision::Bumblebee2Camera.
Definition at line 367 of file firewire.cpp.
|
virtual |
Size of buffer.
Gets the size in bytes of the buffer returned by buffer().
Implements firevision::Camera.
Definition at line 378 of file firewire.cpp.
|
inline |
Get underlying libdc1394 camera C handle.
Definition at line 120 of file firewire.h.
References _camera.
|
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.
Implements firevision::Camera.
Reimplemented in firevision::Bumblebee2Camera.
Definition at line 331 of file firewire.cpp.
Referenced by firevision::Bumblebee2Camera::capture().
|
virtual |
Close camera.
This closes the camera device. The camera must have been stopped before calling close().
Implements firevision::Camera.
Reimplemented in firevision::Bumblebee2Camera.
Definition at line 388 of file firewire.cpp.
Referenced by firevision::Bumblebee2Camera::close().
|
inline |
Get underlying libdc1394 C handle.
Definition at line 115 of file firewire.h.
References _dc1394.
|
virtual |
Colorspace of returned image.
Implements firevision::Camera.
Definition at line 453 of file firewire.cpp.
|
virtual |
Dispose current buffer.
Some cameras need disposal of the current buffer (for example to free space in a queue to retrieve the next image). This is done with this method. It has to be called after all work has been done on the image as desired. After dispose_buffer() has been called no further access may happen to the image buffer or undesired behavior may happen.
Implements firevision::Camera.
Definition at line 402 of file firewire.cpp.
Referenced by Bumblebee2Thread::loop().
|
virtual |
Flush image queue.
Some cameras may have an image buffer queue. With this it can happen that if the processing of an image took longer than desired it is needed to flush this buffer queue.
Implements firevision::Camera.
Definition at line 357 of file firewire.cpp.
|
virtual |
Get current focus value.
Implements firevision::CameraControlFocus.
Definition at line 562 of file firewire.cpp.
|
virtual |
Get maximum focus value.
Implements firevision::CameraControlFocus.
Definition at line 595 of file firewire.cpp.
|
virtual |
Get minimum focus value.
Implements firevision::CameraControlFocus.
Definition at line 582 of file firewire.cpp.
|
virtual |
Get Firewire GUID of camera.
Definition at line 306 of file firewire.cpp.
Referenced by firevision::Bumblebee2Camera::print_info(), and firevision::Bumblebee2Camera::verify_guid().
bool firevision::FirewireCamera::iso_mode_enabled | ( | ) |
Check if ISO mode is enabled.
Exception | thrown if the transmission status could not be determined |
Definition at line 270 of file firewire.cpp.
|
virtual |
Get camera model.
Definition at line 320 of file firewire.cpp.
|
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.
Implements firevision::Camera.
Reimplemented in firevision::Bumblebee2Camera, and firevision::PikeCamera.
Definition at line 153 of file firewire.cpp.
Referenced by firevision::PikeCamera::open(), and firevision::Bumblebee2Camera::open().
|
virtual |
Open the desired device.
This only opens the device but does not do any initialization.
Reimplemented in firevision::Bumblebee2Camera.
Definition at line 111 of file firewire.cpp.
|
virtual |
Parse focus and set value.
Parses the given string for a valid focus value and sets it.
focus | string representation of value |
Definition at line 739 of file firewire.cpp.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera().
|
virtual |
Parse shutter and set value.
Parses the given string for a valid shutter value and sets it.
shutter | string representation of value |
Definition at line 808 of file firewire.cpp.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera().
|
virtual |
Parse white balance and set value.
Parses the given string for a valid white balance value and sets it.
white_balance | string representation of value |
Definition at line 766 of file firewire.cpp.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera().
|
virtual |
Height of image in pixels.
Implements firevision::Camera.
Definition at line 432 of file firewire.cpp.
Referenced by firevision::Bumblebee2Camera::decode_bayer(), firevision::Bumblebee2Camera::deinterlace_stereo(), and firevision::Bumblebee2Camera::open().
|
virtual |
Width of image in pixels.
Implements firevision::Camera.
Definition at line 411 of file firewire.cpp.
Referenced by firevision::Bumblebee2Camera::decode_bayer(), firevision::Bumblebee2Camera::deinterlace_stereo(), and firevision::Bumblebee2Camera::open().
|
static |
Print list of cameras.
Prints a list of available cameras to stdout.
Definition at line 1013 of file firewire.cpp.
|
virtual |
Print out camera information.
Shall print out camera information and current setup information on stdout.
Implements firevision::Camera.
Reimplemented in firevision::Bumblebee2Camera, and firevision::PikeCamera.
Definition at line 282 of file firewire.cpp.
Referenced by firevision::PikeCamera::print_info(), and firevision::Bumblebee2Camera::print_info().
|
virtual |
Camera is ready for taking pictures.
The camera has been opened and started correctly and may now provide images.
Implements firevision::Camera.
Definition at line 525 of file firewire.cpp.
|
virtual |
Enable or disable auto focus.
enabled | if true, enable auto focus, otherwise disable |
NotImplementedException | Not implemented by this control |
Implements firevision::CameraControlFocus.
Definition at line 540 of file firewire.cpp.
|
virtual |
Set status of auto shutter.
enabled | true to enable auto shutter, false to disable. |
Definition at line 611 of file firewire.cpp.
|
virtual |
Set status of auto white balance.
enabled | true to enable auto white balance, false to disable. |
Definition at line 661 of file firewire.cpp.
|
virtual |
Set new focus value.
focus | new focus value |
Implements firevision::CameraControlFocus.
Definition at line 575 of file firewire.cpp.
|
virtual |
|
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 |
Implements firevision::Camera.
Reimplemented in firevision::Bumblebee2Camera.
Definition at line 532 of file firewire.cpp.
|
virtual |
|
virtual |
Set white balance values.
ub | U/B value |
vr | V/R value |
Definition at line 702 of file firewire.cpp.
|
virtual |
|
virtual |
Start image transfer from the camera.
For many cameras opening the camera and starting transmission of images are two tasks. This method will simply initiate the transfer after the camera as been opened. And exception shall be thrown if the camera has not been opened.
Implements firevision::Camera.
Definition at line 227 of file firewire.cpp.
|
virtual |
Stop image transfer from the camera.
This will stop the image transfer initiated with start(). This can be used to start and stop the image transfer at will without opening and closing operations inbetween.
Implements firevision::Camera.
Definition at line 255 of file firewire.cpp.
Referenced by Bumblebee2Thread::finalize().
|
virtual |
Get white balance values.
ub | contains U/B value upon return |
vr | contains V/R value upon return |
Definition at line 686 of file firewire.cpp.
|
protected |
true if auto focus is enabled, false if disabled
Definition at line 133 of file firewire.h.
|
protected |
True, if gain is set automatically.
Definition at line 188 of file firewire.h.
|
protected |
true if auto shutter is enabled, false if disabled
Definition at line 135 of file firewire.h.
|
protected |
true if auto white balance is enabled, false if disabled
Definition at line 137 of file firewire.h.
|
protected |
DC1394 camera handle.
Definition at line 158 of file firewire.h.
Referenced by camera_cobj(), firevision::Bumblebee2Camera::decode_bayer(), firevision::Bumblebee2Camera::is_bumblebee2(), firevision::Bumblebee2Camera::open(), firevision::Bumblebee2Camera::open_device(), firevision::PikeCamera::print_info(), firevision::Bumblebee2Camera::serial_no(), firevision::PikeCamera::set_autofunction_aoi(), firevision::Bumblebee2Camera::verify_guid(), and firevision::Bumblebee2Camera::write_triclops_config_from_camera_to_file().
|
protected |
DC1394 main context.
Definition at line 148 of file firewire.h.
Referenced by cobj(), and firevision::Bumblebee2Camera::open_device().
|
protected |
true if device has been opened, false otherwise
Definition at line 127 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::open_device().
|
protected |
true if the focus should actually be set, false otherwise
Definition at line 145 of file firewire.h.
|
protected |
true if the shutter should actually be set, false otherwise
Definition at line 141 of file firewire.h.
|
protected |
true if the white balance should actually be set, false otherwise
Definition at line 143 of file firewire.h.
|
protected |
Focus value.
Definition at line 183 of file firewire.h.
|
protected |
Format7 bytes per packet.
Definition at line 164 of file firewire.h.
|
protected |
Format7 color coding.
Definition at line 162 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera().
|
protected |
Format7 height.
Definition at line 168 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera(), and firevision::Bumblebee2Camera::verify_guid().
|
protected |
Indicator of Format7 status.
Definition at line 152 of file firewire.h.
|
protected |
Format7 ROI Start X coordinate.
Definition at line 170 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera().
|
protected |
Format7 ROI Start Y coordinate.
Definition at line 172 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera().
|
protected |
Format7 width.
Definition at line 166 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera(), and firevision::Bumblebee2Camera::verify_guid().
|
protected |
Last captured DC1394 video frame.
Definition at line 160 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::capture(), and firevision::Bumblebee2Camera::deinterlace_stereo().
|
protected |
DC1394 framerate.
Definition at line 156 of file firewire.h.
|
protected |
Gain value.
Definition at line 186 of file firewire.h.
|
protected |
DC1394 video mode.
Definition at line 150 of file firewire.h.
|
protected |
Camera model, used in open to identify the camera, if empty first found camera is used.
Definition at line 191 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera(), and firevision::Bumblebee2Camera::open_device().
|
protected |
Number of DMA buffers.
Definition at line 125 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::Bumblebee2Camera().
|
protected |
true if camera has been opened, false otherwise
Definition at line 129 of file firewire.h.
Referenced by firevision::Bumblebee2Camera::close(), firevision::Bumblebee2Camera::is_bumblebee2(), firevision::PikeCamera::open(), firevision::Bumblebee2Camera::open(), firevision::Bumblebee2Camera::serial_no(), firevision::PikeCamera::set_autofunction_aoi(), and firevision::Bumblebee2Camera::verify_guid().
|
protected |
Shutter value.
Definition at line 180 of file firewire.h.
|
protected |
DC1394 speed.
Definition at line 154 of file firewire.h.
|
protected |
true if camera has been started, false otherwise
Definition at line 131 of file firewire.h.
|
protected |
true, if a valid frame has been received, false otherwise
Definition at line 139 of file firewire.h.
|
protected |
White balance U/B value.
Definition at line 175 of file firewire.h.
|
protected |
White balance V/R value.
Definition at line 177 of file firewire.h.