OpenEV
Extending OpenCV to event-based vision
Loading...
Searching...
No Matches
ev::Davis Class Reference

This class extends AbstractCamera to operate with DAVIS event cameras. DAVIS cameras offer events (DVS), framed images (APS), and IMU data. More...

#include <davis.hpp>

Inheritance diagram for ev::Davis:
ev::AbstractCamera

Public Member Functions

void start () override
 Initialize the DAVIS camera. This function sets up the DAVIS camera for operation. It must be called before any other.
bool hasAps () const override
 DAVIS cameras have an APS sensor.
bool hasImu () const override
 DAVIS cameras have an IMU.
cv::Size getSensorSize () const override
 Get device sensor size.
std::string getSerialNumber () const override
 Get device serial number, prefixed with the chip model.
bool setRoi (const cv::Rect_< uint16_t > &roi) override
 Set current ROI. Events outside the ROI are not considered. Images are cropped according to the ROI.
BiasValue getBias (const uint8_t name) const
 Retrieve the bias value associated with the given name.
bool setBias (const uint8_t name, const BiasValue &value)
 Set the bias value associated with the given name.
void enableDvs (bool state)
 Enable DVS.
void enableAps (bool state)
 Enable APS.
void setApsTimeInterval (uint32_t usec)
 Set APS maximum time interval between subsequent transmissions.
uint32_t getApsExposure () const
 Get the APS exposure time currently applied by the device.
void setApsExposure (uint32_t usec)
 Set APS exposure time.
void enableApsAutoExposure (bool state)
 Let the device choose the APS exposure time on its own, aiming to avoid under and over exposure.
void enableImu (bool state)
 Enable IMU.
Public Member Functions inherited from ev::AbstractCamera
void stop ()
 Stop reading data.
bool isOpen () const
 Check whether the device was found and opened.
uint64_t getResetTime () const
 Get device reset time.
cv::Rect_< uint16_t > getRoi () const
 Get current ROI.
void setDefectivePixels (const std::string &defective_pixels_file)
 Load a defective pixel file. Events on hot pixels are discarded, and saturated pixels are replaced by the median of their neighbours on every frame.
void setContainerInterval (const uint32_t usec)
 Set the maximum time interval between subsequent containers.
void setContainerSize (const uint32_t n)
 Set the maximum number of events a container may hold before it is delivered. The limit applies to each typed packet of the container separately, so a container carrying events, frames, and imu data can deliver up to this number of each of them.
bool getData (Vector &events)
 Get DVS data.
bool getData (Queue &events)
 Get DVS data.
bool getData (StampedMat &frame)
 Get APS data.
bool getData (StampedMatVector &frames)
 Get APS data.
bool getData (StampedMatQueue &frames)
 Get APS data.
bool getData (Imu &imu)
 Get IMU data.
bool getData (ImuVector &imu)
 Get IMU data.
bool getData (ImuQueue &imu)
 Get IMU data.
bool getData (Vector &events, StampedMat &frame)
 Get DVS+APS data.
bool getData (Vector &events, StampedMatVector &frames)
 Get DVS+APS data.
bool getData (Queue &events, StampedMatQueue &frames)
 Get DVS+APS data.
bool getData (Vector &events, Imu &imu)
 Get DVS+IMU data.
bool getData (Vector &events, ImuVector &imu)
 Get DVS+IMU data.
bool getData (Queue &events, ImuQueue &imu)
 Get DVS+IMU data.
bool getData (Vector &events, StampedMat &frame, Imu &imu)
 Get DVS+APS+IMU data.
bool getData (Vector &events, StampedMatVector &frame, ImuVector &imu)
 Get DVS+APS+IMU data.
bool getData (Queue &events, StampedMatQueue &frame, ImuQueue &imu)
 Get DVS+APS+IMU data.
std::size_t getEventRaw (std::vector< uint64_t > &data)
 Retrieve raw event data.
std::size_t getEventRaw (uint64_t *&data, const bool allow_realloc=true)
 Retrieve raw event data.
void flush (const double usec) const
 Discard data during an interval of time.

Static Public Member Functions

static uint32_t biasToCurrent (const BiasValue &value)
 Convert a bias value into the current it produces. The coarse and fine ranges overlap, so a bias with a lower coarse can produce a higher current than one with a higher coarse, and a fine of zero produces no current at all regardless of the coarse.

Static Public Attributes

static constexpr uint32_t DEFAULT_INTERVAL = 20000
static constexpr uint32_t DEFAULT_EXPOSURE = 6500

Detailed Description

This class extends AbstractCamera to operate with DAVIS event cameras. DAVIS cameras offer events (DVS), framed images (APS), and IMU data.

Examples
example-davis.cpp.

Member Function Documentation

◆ biasToCurrent()

uint32_t ev::Davis::biasToCurrent ( const BiasValue & value)
staticnodiscard

Convert a bias value into the current it produces. The coarse and fine ranges overlap, so a bias with a lower coarse can produce a higher current than one with a higher coarse, and a fine of zero produces no current at all regardless of the coarse.

Parameters
valueThe bias value to convert.
Returns
Current in picoamperes.

◆ enableAps()

void ev::Davis::enableAps ( bool state)

Enable APS.

Parameters
stateTrue to enable, false to disable
Examples
example-davis.cpp.

◆ enableApsAutoExposure()

void ev::Davis::enableApsAutoExposure ( bool state)

Let the device choose the APS exposure time on its own, aiming to avoid under and over exposure.

Parameters
stateTrue to enable, false to disable

◆ enableDvs()

void ev::Davis::enableDvs ( bool state)

Enable DVS.

Parameters
stateTrue to enable, false to disable
Examples
example-davis.cpp.

◆ enableImu()

void ev::Davis::enableImu ( bool state)

Enable IMU.

Parameters
stateTrue to enable, false to disable
Examples
example-davis.cpp.

◆ getApsExposure()

uint32_t ev::Davis::getApsExposure ( ) const
nodiscard

Get the APS exposure time currently applied by the device.

Returns
Exposure time in microseconds

◆ getBias()

ev::BiasValue ev::Davis::getBias ( const uint8_t name) const

Retrieve the bias value associated with the given name.

Parameters
nameThe identifier for the bias value to retrieve.
Returns
The bias value corresponding to the given name.

◆ getSensorSize()

cv::Size ev::Davis::getSensorSize ( ) const
nodiscardoverridevirtual

Get device sensor size.

Returns
Sensor size

Implements ev::AbstractCamera.

Examples
example-davis.cpp.

◆ getSerialNumber()

std::string ev::Davis::getSerialNumber ( ) const
nodiscardoverridevirtual

Get device serial number, prefixed with the chip model.

Returns
Serial number as CHIP-XXXXXXXX, empty if the camera is not open

Implements ev::AbstractCamera.

◆ hasAps()

bool ev::Davis::hasAps ( ) const
inlinenodiscardoverridevirtual

DAVIS cameras have an APS sensor.

Returns
Always true

Implements ev::AbstractCamera.

◆ hasImu()

bool ev::Davis::hasImu ( ) const
inlinenodiscardoverridevirtual

DAVIS cameras have an IMU.

Returns
Always true

Implements ev::AbstractCamera.

◆ setApsExposure()

void ev::Davis::setApsExposure ( uint32_t usec)

Set APS exposure time.

Parameters
usecExposure time in microseconds

◆ setApsTimeInterval()

void ev::Davis::setApsTimeInterval ( uint32_t usec)

Set APS maximum time interval between subsequent transmissions.

Parameters
usecMaximum time interval in microseconds

◆ setBias()

bool ev::Davis::setBias ( const uint8_t name,
const BiasValue & value )

Set the bias value associated with the given name.

Parameters
nameThe identifier for the bias value to set.
valueThe new bias value to set.
Returns
True if the bias value was successfully set, false otherwise.

◆ setRoi()

bool ev::Davis::setRoi ( const cv::Rect_< uint16_t > & roi)
overridevirtual

Set current ROI. Events outside the ROI are not considered. Images are cropped according to the ROI.

Parameters
roiROI
Returns
True if valid ROI
Note
Both filters are applied by the device when the model supports them. Events keep full-sensor coordinates, whereas frames are delivered already cropped, so their pixel (0, 0) is roi.tl(). Subtract that offset before overlaying them.

Implements ev::AbstractCamera.

Examples
example-davis.cpp.

◆ start()

void ev::Davis::start ( )
overridevirtual

Initialize the DAVIS camera. This function sets up the DAVIS camera for operation. It must be called before any other.

Implements ev::AbstractCamera.

Examples
example-davis.cpp.

The documentation for this class was generated from the following files: