SDK Driver Camera Class

class Metavision::Camera

Main class for the camera interface.

Public Functions

Camera()

Constructor.

Creates an unitialized 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.

Throws CameraException if the camera has not been initialized.

CD &cd()

Gets class to handle CD events.

Throws a CameraException if the camera has not been initialized.

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.

Throws CameraException if the camera has not been initialized.

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.

Throws CameraException if the camera has not been initialized. Throws CameraException in case of failure, (for example if camera runs from an offline source).

Roi &roi()

Gets class to handle Roi on the sensor.

Throws 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.

Throws 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.

Throws 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. Throws a CameraException if the camera has not been initialized.

Return

ID of the added callback

Warning

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

See

RuntimeErrorCallback

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.

Throws CameraException in case of failure, (for example if camera runs from an offline source).

const Geometry &geometry() const

Gets the device’s geometry.

Throws CameraException if the camera has not been initialized.

const CameraGeneration &generation() const

Gets the device’s generation.

Throws CameraException if the camera has not been initialized.

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.

Throws

CameraException if the camera has not been initialized.
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.

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.

Throws

CameraException if the camera has not been initialized.
Return

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

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. Throws

CameraException if the camera has not been initialized.
Parameters
  • rawfile_path: Path to the RAW file used for data recording.

void stop_recording()

Stops an ongoing recording.

Throws CameraException if the camera has not been initialized.

const CameraConfiguration &get_camera_configuration()

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

Read-only structure.

See

CameraConfiguration

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.

Throws

CameraException in case of initialization failure.

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.

Throws

CameraException in case if the camera corresponding to the input source type and the source index has not been found.
Return

Camera instance initialized from the source

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.

Throws

CameraException in case if the camera with the input serial number has not been found.
Return

Camera instance initialized from the serial number

Parameters
  • serial: Serial number of the camera

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

Initializes a camera instance from a RAW file.

Throws CameraException in case of initialization failure.

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

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.

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