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

This is an auxiliary class. This class cannot be instanced. More...

#include <abstract-camera.hpp>

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

Public Member Functions

virtual void start ()=0
 Start reading data.
void stop ()
 Stop reading data.
bool isOpen () const
 Check whether the device was found and opened.
virtual bool hasAps () const =0
 Check whether the device produces APS frames.
virtual bool hasImu () const =0
 Check whether the device produces IMU data.
virtual cv::Size getSensorSize () const =0
 Get device sensor size.
virtual std::string getSerialNumber () const =0
 Get device serial number, prefixed with the camera family.
uint64_t getResetTime () const
 Get device reset time.
cv::Rect_< uint16_t > getRoi () const
 Get current ROI.
virtual bool setRoi (const cv::Rect_< uint16_t > &roi)=0
 Set current ROI. Events outside the ROI are not considered. Images are cropped according to the 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.

Detailed Description

This is an auxiliary class. This class cannot be instanced.

Member Function Documentation

◆ flush()

void ev::AbstractCamera::flush ( const double usec) const

Discard data during an interval of time.

Parameters
usecTime interval in microseconds

◆ getData() [1/17]

bool ev::AbstractCamera::getData ( Imu & imu)

Get IMU data.

Parameters
imuImu data destination
Returns
True if imu data not empty

◆ getData() [2/17]

bool ev::AbstractCamera::getData ( ImuQueue & imu)

Get IMU data.

Parameters
imuImu data queue to which imu data will be added
Returns
True if queue not empty

◆ getData() [3/17]

bool ev::AbstractCamera::getData ( ImuVector & imu)

Get IMU data.

Parameters
imuImu data vector to which imu data will be added
Returns
True if vector not empty

◆ getData() [4/17]

bool ev::AbstractCamera::getData ( ev::Queue & events)

Get DVS data.

Parameters
eventsEvent queue to which events will be added.
Returns
True if queue not empty

◆ getData() [5/17]

bool ev::AbstractCamera::getData ( ev::Queue & events,
ev::ImuQueue & imu )

Get DVS+IMU data.

Parameters
eventsEvent queue to which events will be added
imuImu data queue to which imu data will be added
Returns
True if event queue or imu data queue not empty

◆ getData() [6/17]

bool ev::AbstractCamera::getData ( ev::Queue & events,
ev::StampedMatQueue & frames,
ev::ImuQueue & imu )

Get DVS+APS+IMU data.

Parameters
eventsEvent queue to which events will be added
framesFrame queue to which frame will be added
imuImu data queue to which imu data will be added
Returns
True if event queue, frame queue, or imu data queue not empty

◆ getData() [7/17]

bool ev::AbstractCamera::getData ( ev::Queue & events,
ev::StampedMatQueue & frames )

Get DVS+APS data.

Parameters
eventsEvent queue to which events will be added
framesFrame queue to which frame will be added
Returns
True if event queue or frame queue not empty

◆ getData() [8/17]

bool ev::AbstractCamera::getData ( StampedMat & frame)

Get APS data.

Parameters
frameFrame destination
Returns
True if frame not empty

◆ getData() [9/17]

bool ev::AbstractCamera::getData ( StampedMatQueue & frames)

Get APS data.

Parameters
framesFrame queue to which frame will be added
Returns
True if queue not empty

◆ getData() [10/17]

bool ev::AbstractCamera::getData ( StampedMatVector & frames)

Get APS data.

Parameters
framesFrame vector to which frame will be added
Returns
True if vector not empty

◆ getData() [11/17]

bool ev::AbstractCamera::getData ( ev::Vector & events)

Get DVS data.

Parameters
eventsEvent vector to which events will be added
Returns
True if vector not empty
Examples
example-davis.cpp.

◆ getData() [12/17]

bool ev::AbstractCamera::getData ( ev::Vector & events,
ev::Imu & imu )

Get DVS+IMU data.

Parameters
eventsEvent vector to which events will be added
imuImu data destination
Returns
True if event vector or imu data not empty

◆ getData() [13/17]

bool ev::AbstractCamera::getData ( ev::Vector & events,
ev::ImuVector & imu )

Get DVS+IMU data.

Parameters
eventsEvent vector to which events will be added
imuImu data vector to which imu data will be added
Returns
True if event vector or imu data vector not empty

◆ getData() [14/17]

bool ev::AbstractCamera::getData ( ev::Vector & events,
ev::StampedMat & frame )

Get DVS+APS data.

Parameters
eventsEvent vector to which events will be added
frameFrame destination
Returns
True if event vector or frame not empty

◆ getData() [15/17]

bool ev::AbstractCamera::getData ( ev::Vector & events,
ev::StampedMat & frame,
ev::Imu & imu )

Get DVS+APS+IMU data.

Parameters
eventsEvent vector to which events will be added
frameFrame destination
imuImu data destination
Returns
True if event vector, frame, or imu data not empty

◆ getData() [16/17]

bool ev::AbstractCamera::getData ( ev::Vector & events,
ev::StampedMatVector & frames,
ev::ImuVector & imu )

Get DVS+APS+IMU data.

Parameters
eventsEvent vector to which events will be added
framesFrame vector to which frame will be added
imuImu data vector to which imu data will be added
Returns
True if event vector, frame vector, or imu data vector not empty

◆ getData() [17/17]

bool ev::AbstractCamera::getData ( ev::Vector & events,
ev::StampedMatVector & frames )

Get DVS+APS data.

Parameters
eventsEvent vector to which events will be added
framesFrame vector to which frame will be added
Returns
True if event vector or frame vector not empty

◆ getEventRaw() [1/2]

std::size_t ev::AbstractCamera::getEventRaw ( std::vector< uint64_t > & data)

Retrieve raw event data.

Parameters
dataA vector to which the raw event data will be added.
Returns
The number of events added.
Note
Events are encoded as follows: Mask for x: 11111111111111100000000000000000 00000000000000000000000000000000 Mask for y: 00000000000000011111111111111100 00000000000000000000000000000000 Mask for p: 00000000000000000000000000000010 00000000000000000000000000000000 Mask for t: 00000000000000000000000000000000 11111111111111111111111111111111

◆ getEventRaw() [2/2]

std::size_t ev::AbstractCamera::getEventRaw ( uint64_t *& data,
const bool allow_realloc = true )

Retrieve raw event data.

Parameters
dataBuffer to which the raw event data will be written. Updated in place if the buffer is reallocated.
allow_reallocIf true, this function manages the size of the buffer, reallocating if needed. The buffer must then come from malloc/calloc/realloc (never from new[]) and remains owned by the caller, which is responsible for freeing it. If false, the caller must guarantee that the buffer is large enough: no bounds checking is performed.
Returns
The number of events written.
Note
Events are encoded as follows: Mask for x: 11111111111111100000000000000000 00000000000000000000000000000000 Mask for y: 00000000000000011111111111111100 00000000000000000000000000000000 Mask for p: 00000000000000000000000000000010 00000000000000000000000000000000 Mask for t: 00000000000000000000000000000000 11111111111111111111111111111111

◆ getResetTime()

uint64_t ev::AbstractCamera::getResetTime ( ) const
inlinenodiscard

Get device reset time.

Returns
Reset time in microseconds

◆ getRoi()

cv::Rect_< uint16_t > ev::AbstractCamera::getRoi ( ) const
nodiscard

Get current ROI.

Returns
ROI
Examples
example-davis.cpp.

◆ getSensorSize()

virtual cv::Size ev::AbstractCamera::getSensorSize ( ) const
nodiscardpure virtual

Get device sensor size.

Returns
Sensor size

Implemented in ev::Davis.

◆ getSerialNumber()

virtual std::string ev::AbstractCamera::getSerialNumber ( ) const
nodiscardpure virtual

Get device serial number, prefixed with the camera family.

Returns
Serial number, empty if the camera is not open

Implemented in ev::Davis.

◆ hasAps()

virtual bool ev::AbstractCamera::hasAps ( ) const
nodiscardpure virtual

Check whether the device produces APS frames.

Returns
True if the camera has an APS sensor

Implemented in ev::Davis.

◆ hasImu()

virtual bool ev::AbstractCamera::hasImu ( ) const
nodiscardpure virtual

Check whether the device produces IMU data.

Returns
True if the camera has an IMU

Implemented in ev::Davis.

◆ isOpen()

bool ev::AbstractCamera::isOpen ( ) const
inlinenodiscard

Check whether the device was found and opened.

Returns
True if the camera is open

◆ setContainerInterval()

void ev::AbstractCamera::setContainerInterval ( const uint32_t usec)

Set the maximum time interval between subsequent containers.

Parameters
usecMaximum time interval in microseconds
Examples
example-davis.cpp.

◆ setContainerSize()

void ev::AbstractCamera::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.

Warning
Set to zero to disable.
Parameters
nMaximum number of events
Examples
example-davis.cpp.

◆ setDefectivePixels()

void ev::AbstractCamera::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.

Parameters
defective_pixels_filePath to a YAML file
Note
The file holds one entry per camera, keyed by the serial number reported by getSerialNumber(). Each entry lists the defective pixels as flat sequences of x, y pairs. Every event at a hot_pixels coordinate is discarded. Every saturated_pixels coordinate is replaced on each APS frame by the median of its neighbours, excluding those that are themselves saturated or fall outside the frame. The dead_pixels entry may be present but is not used.
%YAML:1.0
---
DAVIS346B-00000259:
dead_pixels: []
hot_pixels: [ 102, 216, 308, 205 ]
saturated_pixels: [ 183, 126 ]
DAVIS240C-00000117:
dead_pixels: []
hot_pixels: [ 5, 5 ]
saturated_pixels: []

◆ setRoi()

virtual bool ev::AbstractCamera::setRoi ( const cv::Rect_< uint16_t > & roi)
pure virtual

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

Parameters
roiROI
Returns
True if valid ROI

Implemented in ev::Davis.

◆ start()

virtual void ev::AbstractCamera::start ( )
pure virtual

Start reading data.

Implemented in ev::Davis.


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