class mrpt::hwdrivers::CImageGrabber_dc1394

Overview

Captures images from IEEE 1394 (FireWire) cameras using libdc1394-2.

Supports any IEEE 1394 camera (DCAM/IIDC standard), including stereo pairs such as the Point Grey Bumblebee. Use enumerateCameras() to discover connected devices and their GUIDs before opening.

Produced observations are:

Requires libdc1394-2 and OpenCV. Currently Linux-only.

You may need to set permissions: chmod 666 /dev/video1394/ * and chmod 666 /dev/raw1394 to allow non-root access to FireWire devices.

Ring buffer length is configurable via TCaptureOptions_dc1394::ring_buffer_size (new in MRPT 1.3.0).

See also:

mrpt::hwdrivers::CCameraSensor

#include <mrpt/hwdrivers/CImageGrabber_dc1394.h>

class CImageGrabber_dc1394
{
public:
    // typedefs

    typedef std::list<TCameraInfo> TCameraInfoList;

    // structs

    struct TCameraInfo;

    // construction

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

    // methods

    bool isOpen() const;
    bool changeCaptureOptions(const TCaptureOptions_dc1394& options);
    std::optional<mrpt::obs::CObservationImage> grabFrame();
    bool getObservation(mrpt::obs::CObservationImage& out_observation);
    std::optional<mrpt::obs::CObservationStereoImages> grabStereoFrame();
    bool getObservation(mrpt::obs::CObservationStereoImages& out_observation);
    bool setSoftwareTriggerLevel(bool level);
    static void enumerateCameras(TCameraInfoList& out_list);
};

Construction

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

Constructor: open an ieee1394 camera.

Parameters:

cameraGUID

Set the camera GUID to open, or 0 to open the first found camera.

cameraUnit

(Ignored if cameraGUID=0). The number of camera to open within the device with the given GUID: In a stereo camera this may be 0 or 1. Normally this is 0.

options

Capture options, defined in mrpt::hwdrivers::TCaptureOptions_dc1394.

verbose

Displays a lot of information about the camera to be open and its valid video modes.

Methods

bool isOpen() const

Check whether the camera has been open successfully.

bool changeCaptureOptions(const TCaptureOptions_dc1394& options)

Changes live capture properties (brightness, gain, shutter, etc.).

Frame size, frame rate, and color coding cannot be changed after opening the camera; those fields in options are silently ignored.

Parameters:

options

The new capture property values to apply.

Returns:

false on any error.

std::optional<mrpt::obs::CObservationImage> grabFrame()

Grabs one frame from a monocular FireWire camera.

May block when using software trigger if no frame is pending.

Deprecated Use grabFrame() instead.

Grabs one frame from a monocular FireWire camera, returning by value.

Parameters:

out_observation

Filled with the captured image.

Returns:

false on any error, true on success.

std::nullopt on any error, or the captured observation on success.

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

Deprecated Use grabFrame() instead.

std::optional<mrpt::obs::CObservationStereoImages> grabStereoFrame()

Grabs a stereo frame from a FireWire stereo camera.

Returns:

std::nullopt on any error, or the captured stereo observation on success.

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

Deprecated Use grabStereoFrame() instead.

bool setSoftwareTriggerLevel(bool level)

Sets the software trigger signal level (ON/OFF).

Allows controlling camera triggering via software rather than hardware.

Parameters:

level

true to assert (ON), false to de-assert (OFF).

Returns:

false on any error.

static void enumerateCameras(TCameraInfoList& out_list)

Enumerates all FireWire cameras currently visible on the bus.

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

Parameters:

out_list

Populated with one entry per discovered camera.

std::runtime_error

On any error from libdc1394.

std::runtime_error

On any error calling libdc1394.