DvsenseDriver  1.3.0
The SDK for dvsense products.
Loading...
Searching...
No Matches
dvsense::DvsApsFusionProccessor Class Reference

Pair APS frames with completed DVS synchronization groups in FIFO order. More...

#include <DvsApsFusionProccessor.hpp>

Public Member Functions

 DvsApsFusionProccessor (size_t max_events_per_frame=0, bool latest_only=false)
 Construct a DVS/APS fusion processor.
void clear ()
 Clear all queued APS frames, completed DVS groups, and the current DVS event buffer.
void addFusionDataCallback (DsFusionDataCallback cb)
 Register a non-owning callback for fused APS and DVS data.
void addSharedFusionDataCallback (SharedDsFusionDataCallback cb)
 Register a callback that shares the fused DVS event buffer.
void removeFusionDataCallback ()
 Remove both the non-owning and shared fusion-data callbacks.
void addDvsData (const Event2D *begin, const Event2D *end)
 Append DVS events to the current synchronization group.
void addApsData (const ApsFrame frame)
 Add an APS frame by making a deep copy of its pixel data.
void addSharedApsData (const ApsFrame &frame)
 Add an APS frame by sharing its pixel storage without a deep copy.
void addSyncSignal (const EventTriggerIn &trigger_in)
 Add a synchronization signal and close the current DVS event group on a rising edge.
void fusionData ()
 Match queued APS frames and DVS groups in FIFO order and invoke registered callbacks.

Detailed Description

Pair APS frames with completed DVS synchronization groups in FIFO order.

Callers must serialize DVS accumulation and callback registration. Fusion callbacks run synchronously under the queue mutex: do not reenter clear(), addApsData(), addSharedApsData(), or addSyncSignal() from them. Latest-only mode and positive event limits can discard input.

Constructor & Destructor Documentation

◆ DvsApsFusionProccessor()

dvsense::DvsApsFusionProccessor::DvsApsFusionProccessor ( size_t max_events_per_frame = 0,
bool latest_only = false )
inlineexplicit

Construct a DVS/APS fusion processor.

Initializes an empty event buffer and an event-frame object pool. When latest-only mode is enabled, queued APS and DVS groups may be discarded in favor of newer input to bound preview latency.

Parameters
max_events_per_frameMaximum number of DVS events retained for one synchronization group. Set to 0 to retain all events.
latest_onlyWhether to discard queued older groups when newer input arrives.

Member Function Documentation

◆ clear()

void dvsense::DvsApsFusionProccessor::clear ( )
inline

Clear all queued APS frames, completed DVS groups, and the current DVS event buffer.

Registered callbacks and processor configuration are preserved.

◆ addFusionDataCallback()

void dvsense::DvsApsFusionProccessor::addFusionDataCallback ( DsFusionDataCallback cb)
inline

Register a non-owning callback for fused APS and DVS data.

The DVS pointer range is valid only for the duration of the callback. Registering a new callback replaces the previously registered non-owning callback. If a shared callback is also registered, this callback is invoked first.

Parameters
cbCallback receiving the matched APS frame and the half-open DVS range [begin, end).

◆ addSharedFusionDataCallback()

void dvsense::DvsApsFusionProccessor::addSharedFusionDataCallback ( SharedDsFusionDataCallback cb)
inline

Register a callback that shares the fused DVS event buffer.

The callback may retain the shared event buffer for asynchronous processing. Registering a new callback replaces the previously registered shared callback. If a non-owning callback is also registered, the shared callback is invoked after it.

Parameters
cbCallback receiving the matched APS frame and a shared DVS event buffer.

◆ removeFusionDataCallback()

void dvsense::DvsApsFusionProccessor::removeFusionDataCallback ( )
inline

Remove both the non-owning and shared fusion-data callbacks.

◆ addDvsData()

void dvsense::DvsApsFusionProccessor::addDvsData ( const Event2D * begin,
const Event2D * end )
inline

Append DVS events to the current synchronization group.

If a per-frame event limit was configured, only the events that fit within the remaining capacity are retained; excess events are ignored by this fusion processor.

Parameters
beginPointer to the first input event.
endPointer one past the last input event.

◆ addApsData()

void dvsense::DvsApsFusionProccessor::addApsData ( const ApsFrame frame)
inline

Add an APS frame by making a deep copy of its pixel data.

The queued frame is independent of the input frame lifetime. In latest-only mode, queued older APS frames are discarded before this frame is added. Matching callbacks may run synchronously before this function returns.

Parameters
frameAPS frame to copy and enqueue.

◆ addSharedApsData()

void dvsense::DvsApsFusionProccessor::addSharedApsData ( const ApsFrame & frame)
inline

Add an APS frame by sharing its pixel storage without a deep copy.

Use this overload only when copies of the frame keep its pixel storage alive for the entire queued lifetime. Matching callbacks may run synchronously before this function returns.

Parameters
frameAPS frame whose pixel storage will be shared with the queue.
Warning
Passing a frame backed only by borrowed external memory can leave queued data dangling.

◆ addSyncSignal()

void dvsense::DvsApsFusionProccessor::addSyncSignal ( const EventTriggerIn & trigger_in)
inline

Add a synchronization signal and close the current DVS event group on a rising edge.

Signals whose polarity is not 1 are ignored. In latest-only mode, completed older DVS groups are discarded before the current group is queued. Matching callbacks may run synchronously before this function returns.

Parameters
trigger_inSynchronization signal associated with the DVS stream.

◆ fusionData()

void dvsense::DvsApsFusionProccessor::fusionData ( )
inline

Match queued APS frames and DVS groups in FIFO order and invoke registered callbacks.

Each iteration consumes one APS frame and one completed DVS group. The non-owning callback is invoked first, followed by the owning callback. This function is called while the fusion queue mutex is held and normally should not be called directly by users.