SDK Driver Camera Class

class Metavision::Camera

Main class for the camera interface.

Public Functions

Camera()

Constructor.

Creates an uninitialized camera instance.

Camera(Camera &camera) = delete

Copy constructor.

A Camera object can not be copy-constructed, but it can be move-constructed.

See

Camera(Camera &&camera);

Camera(Camera &&camera)

Move constructor.

A Camera can not be copied, but it can be move-constructed from another instance.

Camera &operator=(Camera &camera) = delete

Copy assignment.

A Camera object can not be copy-assigned, but it can be move-assigned.

See

Camera & operator=(Camera &&camera);

Camera &operator=(Camera &&camera)

Move assignment.

A Camera can not be copied, but it can be move-assigned from another instance.

~Camera()

Destructor.

RawData &raw_data()

Gets class to handle RAW data from the camera.

Exceptions

CD &cd()

Gets class to handle CD events.

Exceptions

EM &em()

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

ExtTrigger &ext_trigger()

Gets class to handle External Triggers events.

Exceptions

Imu &imu()

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

TriggerOut &trigger_out()

Gets class to handle trigger out signal.

Exceptions
  • A: CameraException if the camera has not been initialized.

  • A: CameraException in case of failure (for example if camera runs from an offline source).

Roi &roi()

Gets class to handle Roi on the sensor.

Exceptions
  • A: CameraException in case of failure (for instance if the camera is not initialized or the camera is running from an offline source).

Temperature &temperature()

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

Illuminance &illuminance()

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

ImuModule &imu_module()

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

AntiFlickerModule &antiflicker_module()

Gets class to handle AFK on the hardware side.

Exceptions
  • A: CameraException in case of failure (for instance if the camera is not initialized or the camera is running from an offline source).

ErcModule &erc_module()

Gets class to handle Event Rater Controller on the hardware side.

Exceptions
  • A: CameraException in case of failure (for instance if the camera is not initialized or the camera is running from an offline source).

NoiseFilterModule &noise_filter_module()

Gets class to handle STC or TRAIL Noise Filter Module on the hardware side.

Exceptions
  • A: CameraException in case of failure (for instance if the camera is not initialized or the camera is running from an offline source).

TemperatureModule &temperature_module()

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

IlluminanceModule &illuminance_module()

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

CallbackId add_runtime_error_callback(RuntimeErrorCallback error_callback)

Registers a callback that will be called when a runtime error occurs.

When a camera runtime error occurs, the camera thread is left and events are no longer sent. You are notified by this callback whenever this happens.

Return

ID of the added callback

Warning

It is forbidden to call the Camera::stop from a runtime error callback.

See

RuntimeErrorCallback

Exceptions
Parameters
  • error_callback: The error callback to call

bool remove_runtime_error_callback(CallbackId callback_id)

Removes a previously registered callback.

Return

true if the callback has been unregistered correctly, false otherwise.

See

CD::add_callback

See

ExtTrigger::add_callback

Parameters
  • callback_id: Callback ID

CallbackId add_status_change_callback(StatusChangeCallback status_change_callback)

Registers a callback that will be called when the camera status changes.

The callback will be called with the new status of the Camera as a parameter, when the camera is started or stopped (by a call to Camera::stop or when no more events are available in a recording).

Return

ID of the added callback

Warning

It is forbidden to call the Camera::stop from the status callback.

See

StatusChangeCallback

Parameters
  • status_change_callback: The status change callback to call

bool remove_status_change_callback(CallbackId callback_id)

Removes a previously registered callback.

Return

true if the callback has been unregistered correctly, false otherwise.

Parameters
  • callback_id: Callback ID

void set_exposure_frame_callback(std::uint16_t fps, ExposureFrameCallback exposure_frame_callback, bool allow_skipped_frames = false)

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

bool unset_exposure_frame_callback()

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

Biases &biases()

Gets class to handle camera biases.

Exceptions
  • A: CameraException in case of failure, (for example if camera runs from an offline source).

OfflineStreamingControl &offline_streaming_control()

Gets class to control offline streaming.

Exceptions
  • A: CameraException if the camera has not been initialized or if the feature is not available.

const Geometry &geometry() const

Gets the device’s geometry.

Exceptions

const CameraGeneration &generation() const

Gets the device’s generation.

Exceptions

bool start()

Starts the camera from the given input source.

It will start polling events from the source and calling specified events callbacks.

It has no effect if the start function has been already called and not the

stop function.
See

CD::add_callback

See

ExtTrigger::add_callback

Return

true if the camera started successfully, false otherwise. Also returns false, if the camera is already started.

Exceptions

bool is_running()

Checks if the camera is running or there are data remaining from an offline source.

If the source is online, it always returns true unless the stop function has been called.

If the input is offline (from a file), it returns false whenever no data are remaining in the input file.

Return

true if the camera is running or there are data remaining from an offline source, false otherwise.

bool stop()

Stops polling events from the camera or from the file.

Stops ongoing streaming.

Return

true if the camera instance has been stopped successfully, false otherwise. If the camera was not running, this function returns false.

Exceptions

bool set_max_event_rate_limit(uint32_t rate_kEV_s)

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

bool set_max_events_lifespan(timestamp max_events_lifespan_us)

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

void start_recording(const std::string &rawfile_path)

Records data from camera to a file with .raw extension.

The call to this function stops ongoing recording.

The function creates a new file at the given path or overwrites the already existing file.

In case of an offline input source, the function can be used to split the RAW file. In case of not having rights to write at the provided path, the function will not record anything.

Exceptions
Parameters
  • rawfile_path: Path to the RAW file used for data recording.

void stop_recording()

Stops an ongoing recording.

Exceptions

const CameraConfiguration &get_camera_configuration()

Returns CameraConfiguration of the camera that holds the camera properties (dimensions, camera biases, …)

Read-only structure.

See

CameraConfiguration

timestamp get_last_timestamp() const

Gets the last decoded timestamp.

Return

timestamp Last decoded timestamp

Warning

If no event decoding callback has been set, this functions returns -1

Device &get_device()

Gets corresponding Device in HAL library.

Return

The Device used internally by the class Camera

Private &get_pimpl()

For internal use.

Camera(Private*)

For internal use.

Public Static Functions

AvailableSourcesList list_online_sources()

Lists available sources for the online mode.

Return

AvailableSourcesList structure containing available cameras (plugged on the system) along with their serial numbers.

Camera from_first_available()

Initializes a camera instance from the first available camera plugged on the system.

Open the first available camera following at first EMBEDDED and then USB order.

Please note that remote cameras will not be opened with this function. To do that, please specify the

OnlineSourceType and use the Camera::from_source function, or else specify the serial number and use the Camera::from_serial function.

Serial numbers and types of available sources can be found with

Camera::list_online_sources function.
Exceptions

Camera from_source(OnlineSourceType input_source_type, uint32_t source_index = 0)

Initializes a camera instance from an OnlineSourceType and a source index.

Open the source_index camera of online input_source_type if available from list_online_sources.

By default, it opens the first available camera listed by

list_online_sources of type input_source_type.

Serial numbers and types of available sources can be found with

Camera::list_online_sources function.
Return

Camera instance initialized from the source

Exceptions
  • A: CameraException in case if the camera corresponding to the input source type and the source index has not been found.

Parameters
  • input_source_type: OnlineSourceType

  • source_index: Index of the source in the list of available online sources

Camera from_serial(const std::string &serial)

Initializes a camera instance from a ‘serial’ number.

Serial numbers of available sources can be found by with Camera::list_online_sources function.

If ‘serial’ is an empty string, the function works as the main constructor.

Return

Camera instance initialized from the serial number

Exceptions
  • A: CameraException in case if the camera with the input serial number has not been found.

Parameters
  • serial: Serial number of the camera

Camera from_file(const std::string &rawfile, bool reproduce_camera_behavior = true, const RawFileConfig &file_config = RawFileConfig())

Initializes a camera instance from a RAW file.

Note

Since 2.1.0, the reproduce_camera_behavior is only taken into account if at least one event callback is registered (CD or ExtTrigger), it will have no effect if only a RawData callback is registered.

Return

Camera instance initialized from the input RAW file

Return

Camera instance initialized from the input RAW file

Exceptions
Parameters
  • rawfile: Path to the RAW file

  • reproduce_camera_behavior: If true, the RAW file will be read at the same speed as was sent by the camera when the file was recorded, and the events will be available after the same amount of time it took for them to be received when recording the RAW file. If false, the file will be read as fast as possible and the events will be available as soon as possible as well. The max_event_lifespan will only be taken into account when reproducing the camera behavior.

  • file_config: Configuration describing how to read the file (see RawFileConfig)

Camera from_file(const std::string &rawfile, bool reproduce_camera_behavior, const Future::RawFileConfig &file_config)

Initializes a camera instance from a RAW file.

Note

Since 2.1.0, the reproduce_camera_behavior is only taken into account if at least one event callback is registered (CD or ExtTrigger), it will have no effect if only a RawData callback is registered.

Return

Camera instance initialized from the input RAW file

Exceptions
Parameters
  • rawfile: Path to the RAW file

  • reproduce_camera_behavior: If true, the RAW file will be read at the same speed as was sent by the camera when the file was recorded, and the events will be available after the same amount of time it took for them to be received when recording the RAW file. If false, the file will be read as fast as possible and the events will be available as soon as possible as well. The max_event_lifespan will only be taken into account when reproducing the camera behavior.

  • file_config: Configuration describing how to read the file (see Future::RawFileConfig)

bool synchronize_and_start_cameras(Camera &master, Camera &slave)

Note

This method is deprecated since version 2.1.0 and will be removed in next releases

enum Metavision::OnlineSourceType

Online camera type input sources: USB, embedded, remote.

Values:

enumerator EMBEDDED = 0

Data from an embedded event-based camera.

enumerator USB = 1

Data from an USB event-based camera.

enumerator REMOTE = 2

Data from a remote event-based camera.

enum Metavision::CameraStatus

Values:

enumerator STARTED = 0

Camera is started, see Camera::start and Camera::is_running.

enumerator STOPPED = 1

Camera is stopped, see Camera::stop and Camera::is_running.

struct Metavision::CameraConfiguration

Struct with the current camera configuration.

Public Members

std::string serial_number = ""

Serial number of the camera.

In case of an online source, it is the serial number of the current online source.

In case of an offline source, it is the serial number of the online source used to record the data.