Main MRPT website > C++ reference for MRPT 1.5.9
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes
mrpt::hwdrivers::CImageGrabber_dc1394 Class Reference

Detailed Description

A class for grabing images from a IEEE1394 (Firewire) camera using the libdc1394-2 library.

See the constructor for the options when opening the camera. Notice that you may have to carefully set the resolution, framerate and color_mode. See the verbose parameter of the constructor, which can display a list of supported modes in your camera.

This class is able to manage any Firewire cameras, including Stereo or multi-cameras in general, so this can be used to open the Bumblebee camera (not tested yet).

A static method (CImageGrabber_dc1394::enumerateCameras) is provided to enumerate all existing cameras and their properties. It can be used to find the GUID of the desired camera, then open it at the constructor.

Note
This class requires MRPT compiled with "libdc1394-2" (Only works under Linux for now) and "opencv".
In Linux you may need to execute "chmod 666 /dev/video1394/ * " and "chmod 666 /dev/raw1394" for allowing any user R/W access to firewire cameras.
[New in MRPT 1.3.0] Length of ring buffer is now configurable via TCaptureOptions_dc1394::ring_buffer_size
See also
The most generic camera grabber in MRPT: mrpt::hwdrivers::CCameraSensor

Definition at line 124 of file CImageGrabber_dc1394.h.

#include <mrpt/hwdrivers/CImageGrabber_dc1394.h>

Classes

struct  TCameraInfo
 Used in enumerateCameras. More...
 

Public Types

typedef std::list< TCameraInfoTCameraInfoList
 

Public Member Functions

 CImageGrabber_dc1394 (uint64_t cameraGUID=0, uint16_t cameraUnit=0, const TCaptureOptions_dc1394 &options=TCaptureOptions_dc1394(), bool verbose=false)
 Constructor: open an ieee1394 camera. More...
 
virtual ~CImageGrabber_dc1394 ()
 Destructor. More...
 
bool isOpen () const
 Check whether the camera has been open successfully. More...
 
bool changeCaptureOptions (const TCaptureOptions_dc1394 &options)
 Changes the capture properties (brightness, gain, shutter, etc) The frame size, framerate, and color_coding fields in options are ignored since they can be only set at construction time. More...
 
bool getObservation (mrpt::obs::CObservationImage &out_observation)
 Grab an image from the opened camera (for monocular cameras). More...
 
bool getObservation (mrpt::obs::CObservationStereoImages &out_observation)
 Grab an image from the opened camera (for stereo cameras). More...
 
bool setSoftwareTriggerLevel (bool level)
 Changes the boolean level associated to Software Trigger (ON/OFF) Can be used to control camera triggering trough software. More...
 

Static Public Member Functions

static void enumerateCameras (TCameraInfoList &out_list)
 Generates a list with the information on all the existing (Firewire) cameras in the system. More...
 

Protected Attributes

bool m_bInitialized
 Set to false if we could not initialize the camera. More...
 
voidm_dc1394_lib_context
 Internal use: More...
 
voidm_dc1394camera
 
int m_desired_mode
 
TCaptureOptions_dc1394 m_options
 

Member Typedef Documentation

◆ TCameraInfoList

Definition at line 219 of file CImageGrabber_dc1394.h.

Constructor & Destructor Documentation

◆ CImageGrabber_dc1394()

CImageGrabber_dc1394::CImageGrabber_dc1394 ( uint64_t  cameraGUID = 0,
uint16_t  cameraUnit = 0,
const TCaptureOptions_dc1394 options = TCaptureOptions_dc1394(),
bool  verbose = false 
)

◆ ~CImageGrabber_dc1394()

CImageGrabber_dc1394::~CImageGrabber_dc1394 ( )
virtual

Destructor.

Definition at line 338 of file CImageGrabber_dc1394.cpp.

References m_bInitialized, THE_CAMERA, and THE_CONTEXT.

Member Function Documentation

◆ changeCaptureOptions()

bool CImageGrabber_dc1394::changeCaptureOptions ( const TCaptureOptions_dc1394 options)

Changes the capture properties (brightness, gain, shutter, etc) The frame size, framerate, and color_coding fields in options are ignored since they can be only set at construction time.

Returns
false on error

Definition at line 534 of file CImageGrabber_dc1394.cpp.

References m_bInitialized, MRPT_END, MRPT_START, and THROW_EXCEPTION.

Referenced by CImageGrabber_dc1394().

◆ enumerateCameras()

void CImageGrabber_dc1394::enumerateCameras ( TCameraInfoList out_list)
static

Generates a list with the information on all the existing (Firewire) cameras in the system.

Exceptions
std::runtime_errorOn any error calling libdc1394.

Definition at line 607 of file CImageGrabber_dc1394.cpp.

References mrpt::format(), jpeg_error_mgr::i, info, MRPT_END, MRPT_START, THROW_EXCEPTION, and THROW_STACKED_EXCEPTION.

◆ getObservation() [1/2]

bool CImageGrabber_dc1394::getObservation ( mrpt::obs::CObservationImage out_observation)

Grab an image from the opened camera (for monocular cameras).

Parameters
out_observationThe object to be filled with sensed data.
Note
This may be blocking when using software trigger and no frame is available yet. Ensure trigger before getObservation() or take into account that this call may block.
Returns
false on any error, true if all go fine.

Definition at line 367 of file CImageGrabber_dc1394.cpp.

References mrpt::hwdrivers::TCaptureOptions_dc1394::deinterlace_stereo, mrpt::obs::CObservationImage::image, mrpt::utils::CImage::loadFromMemoryBuffer(), m_bInitialized, m_options, MRPT_END, MRPT_START, mrpt::system::now(), THE_CAMERA, THROW_EXCEPTION, and mrpt::obs::CObservation::timestamp.

Referenced by mrpt::hwdrivers::CStereoGrabber_Bumblebee_libdc1394::getStereoObservation().

◆ getObservation() [2/2]

bool CImageGrabber_dc1394::getObservation ( mrpt::obs::CObservationStereoImages out_observation)

Grab an image from the opened camera (for stereo cameras).

Parameters
out_observationThe object to be filled with sensed data.
Returns
false on any error, true if all go fine.

Definition at line 464 of file CImageGrabber_dc1394.cpp.

References mrpt::hwdrivers::TCaptureOptions_dc1394::deinterlace_stereo, mrpt::obs::CObservationStereoImages::imageLeft, mrpt::obs::CObservationStereoImages::imageRight, mrpt::utils::CImage::loadFromMemoryBuffer(), m_bInitialized, m_options, MRPT_END, MRPT_START, mrpt::system::now(), THE_CAMERA, THROW_EXCEPTION, and mrpt::obs::CObservation::timestamp.

◆ isOpen()

bool mrpt::hwdrivers::CImageGrabber_dc1394::isOpen ( ) const
inline

◆ setSoftwareTriggerLevel()

bool CImageGrabber_dc1394::setSoftwareTriggerLevel ( bool  level)

Changes the boolean level associated to Software Trigger (ON/OFF) Can be used to control camera triggering trough software.

Returns
false on error

Definition at line 584 of file CImageGrabber_dc1394.cpp.

References m_bInitialized, MRPT_END, MRPT_START, THE_CAMERA, and THROW_EXCEPTION.

Member Data Documentation

◆ m_bInitialized

bool mrpt::hwdrivers::CImageGrabber_dc1394::m_bInitialized
protected

Set to false if we could not initialize the camera.

Definition at line 129 of file CImageGrabber_dc1394.h.

Referenced by changeCaptureOptions(), CImageGrabber_dc1394(), getObservation(), setSoftwareTriggerLevel(), and ~CImageGrabber_dc1394().

◆ m_dc1394_lib_context

void* mrpt::hwdrivers::CImageGrabber_dc1394::m_dc1394_lib_context
protected

Internal use:

Definition at line 132 of file CImageGrabber_dc1394.h.

Referenced by CImageGrabber_dc1394().

◆ m_dc1394camera

void* mrpt::hwdrivers::CImageGrabber_dc1394::m_dc1394camera
protected

Definition at line 133 of file CImageGrabber_dc1394.h.

Referenced by CImageGrabber_dc1394().

◆ m_desired_mode

int mrpt::hwdrivers::CImageGrabber_dc1394::m_desired_mode
protected

Definition at line 134 of file CImageGrabber_dc1394.h.

Referenced by CImageGrabber_dc1394().

◆ m_options

TCaptureOptions_dc1394 mrpt::hwdrivers::CImageGrabber_dc1394::m_options
protected

Definition at line 136 of file CImageGrabber_dc1394.h.

Referenced by CImageGrabber_dc1394(), and getObservation().




Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020