DvsenseDriver  1.0.3
The SDK for dvsense products.
Loading...
Searching...
No Matches
DvsFileReader.h
1#ifndef DVS_FILE_READER_H
2#define DVS_FILE_READER_H
3
4#ifdef _WIN32
5#define DVSENSE_API __declspec(dllexport)
6#else
7#define DVSENSE_API
8#endif // _WIN32
9
10#include <memory>
11#include "DvsenseHal/camera/DvsCameraUtils.hpp"
12#include "DvsenseBase/EventBase/EventTypes.hpp"
13#include "DvsenseBase/Utils/TypeUtils.hpp"
14
15namespace dvsense
16{
20 class DVSENSE_API DvsFileReader
21 {
22 public:
27
31 virtual ~DvsFileReader() { };
32
40 static std::unique_ptr<DvsFileReader> createFileReader(std::string filepath);
41
51 virtual bool loadFile() = 0;
52
62 virtual bool getStartTimeStamp(TimeStamp& start_timestamp) = 0;
63
73 virtual bool getEndTimeStamp(TimeStamp& end_timestamp) = 0;
74
84 virtual bool getMaxEvents(uint64_t &num) = 0;
85
93 virtual bool reachedEndOfEvents() = 0;
94
95
111 virtual bool seekTime(TimeStamp t) = 0;
112
123 virtual bool seekNEvents(uint64_t n_event) = 0;
124
135
141 virtual uint64_t getCurrentPosEventNum() = 0;
142
152 virtual std::shared_ptr<Event2DVector> getNEvents(uint64_t n) = 0;
153
165 virtual std::shared_ptr<Event2DVector> getNEventsGivenStartTimeStamp(TimeStamp start, uint64_t n) = 0;
166
178 virtual std::shared_ptr<Event2DVector> getNEventsGivenStartEvent(uint64_t event_num, uint64_t n) = 0;
179
189 virtual std::shared_ptr<std::vector<Event2D>> getNTimeEvents(TimeStamp interval) = 0;
190
202 virtual std::shared_ptr<Event2DVector> getNTimeEventsGivenStartTimeStamp(TimeStamp start, TimeStamp interval) = 0;
203
215 virtual std::shared_ptr<std::vector<Event2D>> getNTimeEventsGivenStartEvent(uint64_t event_num, TimeStamp interval) = 0;
216
232 virtual bool extractEventData(TimeStamp start, TimeStamp end, std::string out_file_path) = 0;
233
234 virtual bool exportEventDataToVideo(TimeStamp start, TimeStamp end, std::string out_file_path) = 0;
235
242 virtual uint16_t getWidth() const = 0;
243
250 virtual uint16_t getHeight() const = 0;
251
258 virtual bool getFileInfo(DvsFileInfo& file_info) { return false;};
259 };
260
265 typedef DVSENSE_API std::unique_ptr<DvsFileReader> DvsFile;
266
267} // namespace dvsense
268
269#endif //DVS_FILE_READER_H
DVS File Reader class.
Definition DvsFileReader.h:21
virtual bool exportEventDataToVideo(TimeStamp start, TimeStamp end, std::string out_file_path)=0
virtual bool loadFile()=0
Loads a RAW file for event processing.
virtual std::shared_ptr< Event2DVector > getNEvents(uint64_t n)=0
Retrieves a specified number of events from the current file position.
virtual ~DvsFileReader()
Virtual destructor.
Definition DvsFileReader.h:31
virtual std::shared_ptr< Event2DVector > getNEventsGivenStartEvent(uint64_t event_num, uint64_t n)=0
Retrieves a specific number of events from a specified location.
virtual TimeStamp getCurrentPosTimeStamp()=0
Gets the timestamp of the current file decode location.
static std::unique_ptr< DvsFileReader > createFileReader(std::string filepath)
Create a File Reader object.
virtual bool seekTime(TimeStamp t)=0
Seeks to a specific timestamp in the file.
virtual std::shared_ptr< std::vector< Event2D > > getNTimeEvents(TimeStamp interval)=0
Retrieves events within a specific time interval from the current position.
virtual bool getEndTimeStamp(TimeStamp &end_timestamp)=0
Get the Seek end of TimeStamp in the file.
virtual bool getStartTimeStamp(TimeStamp &start_timestamp)=0
Get the Seek start of TimeStamp in the file.
virtual uint64_t getCurrentPosEventNum()=0
Gets the number of events from the start of the file to the current file decoding location.
virtual bool reachedEndOfEvents()=0
Check if the end of the event data has been reached.
virtual std::shared_ptr< Event2DVector > getNTimeEventsGivenStartTimeStamp(TimeStamp start, TimeStamp interval)=0
Retrieves events within a specific time interval from the current position.
virtual bool getFileInfo(DvsFileInfo &file_info)
Obtain the information of the imported file.
Definition DvsFileReader.h:258
virtual bool getMaxEvents(uint64_t &num)=0
Get the maximum number of events available.
virtual uint16_t getWidth() const =0
Get the width of the sensor used to capture the events.
virtual bool seekNEvents(uint64_t n_event)=0
Seeks to the n event in the file.
virtual bool extractEventData(TimeStamp start, TimeStamp end, std::string out_file_path)=0
Extracts event data within a specified time range and saves the results to a specified output file.
virtual uint16_t getHeight() const =0
Get the height of the sensor used to capture the events.
DvsFileReader()
Default constructor.
Definition DvsFileReader.h:26
virtual std::shared_ptr< Event2DVector > getNEventsGivenStartTimeStamp(TimeStamp start, uint64_t n)=0
Retrieves a specified number of events starting from a given timestamp.
virtual std::shared_ptr< std::vector< Event2D > > getNTimeEventsGivenStartEvent(uint64_t event_num, TimeStamp interval)=0
Retrieves events within a specified time interval starting with event num.
Definition TypeUtils.hpp:7
DVSENSE_API std::unique_ptr< DvsFileReader > DvsFile
unique_ptr to manage DVS file reader
Definition DvsFileReader.h:265
uint64_t TimeStamp
Definition TypeUtils.hpp:8
Definition TypeUtils.hpp:10