DvsenseDriver  1.3.0
The SDK for dvsense products.
Loading...
Searching...
No Matches
dvsense::FusionCamera Class Referenceabstract

Common interface for DVS/APS fusion cameras, including DVSync and DVSyncPro. More...

#include <FusionCamera.hpp>

Public Member Functions

 FusionCamera (CameraDescription cameraDesc)
 Constructor.
virtual const bool isConnected ()=0
 Check if the camera is connected.
const CameraDescription getDescription ()
 Get camera description.
virtual uint32_t addEventsStreamHandleCallback (EventsStreamHandleCallback cb)=0
 Add a callback function to handle events.
virtual uint32_t addSharedEventsStreamHandleCallback (SharedEventsStreamHandleCallback cb)=0
 Add a callback that shares ownership of each decoded DVS event buffer.
virtual bool removeEventsStreamHandleCallback (uint32_t callback_id)=0
 Remove a callback function by id.
virtual bool removeSharedEventsStreamHandleCallback (uint32_t callback_id)=0
 Remove a shared DVS event-buffer callback by id.
virtual uint32_t addApsFrameCallback (FrameCallback cb)=0
 Add a callback function to handle aps data.
virtual bool removeApsFrameCallback (uint32_t callback_id)=0
 Remove a callback function by id.
virtual uint32_t addSyncSignalCallback (DvsTriggerInCallback cb)=0
 Add a callback function to handle trigger in signal.
virtual bool removeSyncSignalCallback (uint32_t callback_id)=0
 Remove a callback function by id.
virtual bool getNextBatch (Event2DVector &event_batch)=0
 Get the next batch of events Before using the getNextBatch function, you need to use setBatchEventsNum to set the number of events you need to fetch, or setBatchEventsTime to set the interval at which you need to fetch the events.
virtual void setBatchEventsNum (uint64_t n)=0
 Set the number of events to be fetched.
virtual void setBatchEventsTime (TimeStamp n)=0
 Set the time interval at which events are fetched.
virtual int start (STREAM_TYPE type=FUSION_STREAM)=0
 Start the camera.
virtual int stop (STREAM_TYPE type=FUSION_STREAM)=0
 Stop the camera.
virtual int destroy ()=0
virtual int startRecording (std::string file_path, std::string file_name, STREAM_TYPE stream_type=FUSION_STREAM)=0
 Start recording events.
virtual int stopRecording (STREAM_TYPE stream_type=FUSION_STREAM)=0
 Stop recording events.
virtual uint16_t getWidth (STREAM_TYPE type=DVS_STREAM)=0
 Get the Width of the camera sensor.
virtual uint16_t getHeight (STREAM_TYPE type=DVS_STREAM)=0
 Get the Height of the camera sensor.
const std::vector< ToolInfo > getAllToolsInfo ()
 Get all the tools information.
const ToolInfo getToolInfo (ToolType type)
 Get the tool information.
const std::shared_ptr< CameraTool > getTool (ToolType type)
 Get the tool.
const std::shared_ptr< CameraTool > getTool (std::string tool_name)
 Get the tool by tool name.
virtual void setStatisticInfoCallback (DsStatisticInfoCallback cb)
 set the callback function to get the statistic information
virtual bool writeCalibrationFile (std::string file_path)=0
virtual bool readCalibrationParam (CalibratorParameters &param)=0
virtual bool getFirmwareVersion (std::string &version)=0
bool exportCameraConfigParams (std::string json_file_path)
 Export camera configuration parameters to a JSON file.
bool loadCameraConfigParams (std::string json_file_path)
 Load camera configuration parameters from a JSON file.

Protected Member Functions

virtual int init ()=0
 When a camera is opened, it should be initialized.

Protected Attributes

CameraDescription cameraDesc_
 Get the camera description.
std::map< ToolType, std::shared_ptr< CameraTool > > tools_

Detailed Description

Common interface for DVS/APS fusion cameras, including DVSync and DVSyncPro.

Constructor & Destructor Documentation

◆ FusionCamera()

dvsense::FusionCamera::FusionCamera ( CameraDescription cameraDesc)
inline

Constructor.

Parameters
cameraDesccamera description

Member Function Documentation

◆ isConnected()

virtual const bool dvsense::FusionCamera::isConnected ( )
pure virtual

Check if the camera is connected.

Returns
true if connected, otherwise false

◆ getDescription()

const CameraDescription dvsense::FusionCamera::getDescription ( )
inline

Get camera description.

Returns
CameraDescription

◆ addEventsStreamHandleCallback()

virtual uint32_t dvsense::FusionCamera::addEventsStreamHandleCallback ( EventsStreamHandleCallback cb)
pure virtual

Add a callback function to handle events.

Parameters
cbcallback function

The event pointer range is valid only during the callback. Copy events or use addSharedEventsStreamHandleCallback() when retaining them for asynchronous work.

Returns
callback id With id you can removeEventsStreamHandleCallback

◆ addSharedEventsStreamHandleCallback()

virtual uint32_t dvsense::FusionCamera::addSharedEventsStreamHandleCallback ( SharedEventsStreamHandleCallback cb)
pure virtual

Add a callback that shares ownership of each decoded DVS event buffer.

The callback may retain the shared buffer after returning for asynchronous processing.

Parameters
cbcallback receiving a shared event buffer
Returns
callback id usable with removeSharedEventsStreamHandleCallback

◆ removeEventsStreamHandleCallback()

virtual bool dvsense::FusionCamera::removeEventsStreamHandleCallback ( uint32_t callback_id)
pure virtual

Remove a callback function by id.

Parameters
callback_id
Returns
true if removed successfully
false if there is no callback function with the corresponding id in the callback function list.

◆ removeSharedEventsStreamHandleCallback()

virtual bool dvsense::FusionCamera::removeSharedEventsStreamHandleCallback ( uint32_t callback_id)
pure virtual

Remove a shared DVS event-buffer callback by id.

Parameters
callback_idcallback id returned by addSharedEventsStreamHandleCallback
Returns
true if the callback was removed

◆ addApsFrameCallback()

virtual uint32_t dvsense::FusionCamera::addApsFrameCallback ( FrameCallback cb)
pure virtual

Add a callback function to handle aps data.

Parameters
cbcallback function
Returns
callback id With id you can removeApsFrameCallback

◆ removeApsFrameCallback()

virtual bool dvsense::FusionCamera::removeApsFrameCallback ( uint32_t callback_id)
pure virtual

Remove a callback function by id.

Parameters
callback_id
Returns
true if removed successfully
false if there is no callback function with the corresponding id in the callback function list.

◆ addSyncSignalCallback()

virtual uint32_t dvsense::FusionCamera::addSyncSignalCallback ( DvsTriggerInCallback cb)
pure virtual

Add a callback function to handle trigger in signal.

Parameters
cbcallback function
Returns
callback id With id you can removeSyncSignalCallback

◆ removeSyncSignalCallback()

virtual bool dvsense::FusionCamera::removeSyncSignalCallback ( uint32_t callback_id)
pure virtual

Remove a callback function by id.

Parameters
callback_id
Returns
true if removed successfully
false if there is no callback function with the corresponding id in the callback function list.

◆ getNextBatch()

virtual bool dvsense::FusionCamera::getNextBatch ( Event2DVector & event_batch)
pure virtual

Get the next batch of events Before using the getNextBatch function, you need to use setBatchEventsNum to set the number of events you need to fetch, or setBatchEventsTime to set the interval at which you need to fetch the events.

Parameters
event_batch
Returns
true if fetched successfully
false if there is no event to fetch

◆ setBatchEventsNum()

virtual void dvsense::FusionCamera::setBatchEventsNum ( uint64_t n)
pure virtual

Set the number of events to be fetched.

Parameters
nnumber of events

◆ setBatchEventsTime()

virtual void dvsense::FusionCamera::setBatchEventsTime ( TimeStamp n)
pure virtual

Set the time interval at which events are fetched.

Parameters
ninterval in microseconds

◆ start()

virtual int dvsense::FusionCamera::start ( STREAM_TYPE type = FUSION_STREAM)
pure virtual

Start the camera.

Parameters
typeRequested stream mode; reference-board DVSyncPro accepts FUSION_STREAM only.
Returns
int 0 if success, otherwise return error code

◆ stop()

virtual int dvsense::FusionCamera::stop ( STREAM_TYPE type = FUSION_STREAM)
pure virtual

Stop the camera.

Returns
int 0 if success, otherwise return error code

◆ destroy()

virtual int dvsense::FusionCamera::destroy ( )
pure virtual

◆ startRecording()

virtual int dvsense::FusionCamera::startRecording ( std::string file_path,
std::string file_name,
STREAM_TYPE stream_type = FUSION_STREAM )
pure virtual

Start recording events.

Parameters
file_path
file_name
stream_type
Returns
int 0 if success, otherwise return error code

◆ stopRecording()

virtual int dvsense::FusionCamera::stopRecording ( STREAM_TYPE stream_type = FUSION_STREAM)
pure virtual

Stop recording events.

Returns
int 0 if success, otherwise return error code

◆ getWidth()

virtual uint16_t dvsense::FusionCamera::getWidth ( STREAM_TYPE type = DVS_STREAM)
pure virtual

Get the Width of the camera sensor.

Returns
uint16_t

◆ getHeight()

virtual uint16_t dvsense::FusionCamera::getHeight ( STREAM_TYPE type = DVS_STREAM)
pure virtual

Get the Height of the camera sensor.

Returns
uint16_t

◆ getAllToolsInfo()

const std::vector< ToolInfo > dvsense::FusionCamera::getAllToolsInfo ( )

Get all the tools information.

Returns
std::vector<ToolInfo> information of all tools

◆ getToolInfo()

const ToolInfo dvsense::FusionCamera::getToolInfo ( ToolType type)

Get the tool information.

Parameters
typetool type
Returns
ToolInfo information of the tool

◆ getTool() [1/2]

const std::shared_ptr< CameraTool > dvsense::FusionCamera::getTool ( ToolType type)

Get the tool.

Parameters
typetool type
Returns
std::shared_ptr<CameraTool> tool

◆ getTool() [2/2]

const std::shared_ptr< CameraTool > dvsense::FusionCamera::getTool ( std::string tool_name)

Get the tool by tool name.

Parameters
tool_nameName of the tool
Returns
std::shared_ptr<CameraTool> tool

◆ setStatisticInfoCallback()

virtual void dvsense::FusionCamera::setStatisticInfoCallback ( DsStatisticInfoCallback cb)
inlinevirtual

set the callback function to get the statistic information

Parameters
cbcallback function

◆ writeCalibrationFile()

virtual bool dvsense::FusionCamera::writeCalibrationFile ( std::string file_path)
pure virtual

◆ readCalibrationParam()

virtual bool dvsense::FusionCamera::readCalibrationParam ( CalibratorParameters & param)
pure virtual

◆ getFirmwareVersion()

virtual bool dvsense::FusionCamera::getFirmwareVersion ( std::string & version)
pure virtual

◆ exportCameraConfigParams()

bool dvsense::FusionCamera::exportCameraConfigParams ( std::string json_file_path)

Export camera configuration parameters to a JSON file.

Parameters
json_file_pathPath to the JSON file
Returns
true if export is successful, otherwise false

◆ loadCameraConfigParams()

bool dvsense::FusionCamera::loadCameraConfigParams ( std::string json_file_path)

Load camera configuration parameters from a JSON file.

Parameters
json_file_pathPath to the JSON file
Returns
true if load is successful, otherwise false

◆ init()

virtual int dvsense::FusionCamera::init ( )
protectedpure virtual

When a camera is opened, it should be initialized.

Returns
0 if success, otherwise return error code

Member Data Documentation

◆ cameraDesc_

CameraDescription dvsense::FusionCamera::cameraDesc_
protected

Get the camera description.

Returns
CameraDescription

◆ tools_

std::map<ToolType, std::shared_ptr<CameraTool> > dvsense::FusionCamera::tools_
protected