DvsenseDriver  1.0.3
The SDK for dvsense products.
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
File Reading

This section introduces how to read the recorded files through the API interface.

File Format

The SDK supports reading the .raw file format. The raw file records the undecoded data directly obtained from the dynamic vision camera. The encoding method is EVT3.0

File Loading And Usage

The header files related to file reading are located in DvsenseDriver/FileReader/DvsFileReader.h

File Loading

You can create an instance of dvsense::DvsFile via dvsense::DvsFileReader::createFileReader, and use it to load and process data. dvsense::DvsFile is an encapsulation of dvsense::DvsFileReader for ease of use: typedef DVSENSE_API std::unique_ptr<DvsFileReader> DvsFile;

reader->loadFile();
static std::unique_ptr< DvsFileReader > createFileReader(std::string filepath)
Create a File Reader object.
DVSENSE_API std::unique_ptr< DvsFileReader > DvsFile
unique_ptr to manage DVS file reader
Definition: DvsFileReader.h:257

Please note that the reader does not directly load data after construction. You need to manually call dvsense::DvsFileReader::loadFile to load the file data. The running time of the function depends on the size of the file.

Data Reading Interface

Two interfaces for data reading are provided in dvsense.DvsFileReader:

When calling these two interfaces, the file pointer within dvsense::DvsFileReader will also be adjusted accordingly.

std::shared_ptr<dvsense::Event2DVector> events = reader->getNTimeEvents(2000);
for (auto& event : *events) {
// do something
}

Attention!! What this function returns std::shared_ptr<dvsense::Event2DVector> is not thread - safe, and it will be overwritten when the function is called next time.

Jump

For files that have already been loaded, an interface dvsense::DvsFileReader::seekTime is provided to find and jump to a specified time. You can first obtain the start timestamp and the last timestamp in the file through dvsense::DvsFileReader::getStartTimeStamp and dvsense::DvsFileReader::getEndTimeStamp respectively.

dvsense::TimeStamp start_timestamp, end_timestamp;
reader->getStartTimeStamp(start_timestamp);
reader->getEndTimeStamp(end_timestamp);
reader->seekTime(start_timestamp);
uint64_t TimeStamp
Definition: TypeUtils.hpp:8