OpenEV
Extending OpenCV to event-based vision
Loading...
Searching...
No Matches
davis.hpp
Go to the documentation of this file.
1
6#ifndef OPENEV_DEVICES_DAVIS_HPP
7#define OPENEV_DEVICES_DAVIS_HPP
8
10#include <ostream>
11#include <stdint.h>
12#include <string>
13#include <vector>
14
15namespace ev {
19struct BiasValue {
20 uint8_t coarse;
21 uint8_t fine;
22 [[nodiscard]] friend std::ostream &operator<<(std::ostream &os, const struct BiasValue &value) {
23 os << "Coarse: " << static_cast<int>(value.coarse) << ", Fine: " << static_cast<int>(value.fine);
24 return os;
25 }
26};
27
31class Davis : public AbstractCamera {
32public:
33 constexpr static uint32_t DEFAULT_INTERVAL = 20000;
34 constexpr static uint32_t DEFAULT_EXPOSURE = 6500;
35
37 Davis();
38 Davis(const Davis &) = delete;
39 Davis(Davis &&) noexcept = delete;
40 Davis &operator=(const Davis &) = delete;
41 Davis &operator=(Davis &&) noexcept = delete;
43
48 void start() override;
49
54 [[nodiscard]] bool hasAps() const override {
55 return true;
56 }
57
62 [[nodiscard]] bool hasImu() const override {
63 return true;
64 }
65
70 [[nodiscard]] cv::Size getSensorSize() const override;
71
76 [[nodiscard]] std::string getSerialNumber() const override;
77
85 bool setRoi(const cv::Rect_<uint16_t> &roi) override;
86
92 BiasValue getBias(const uint8_t name) const;
93
100 bool setBias(const uint8_t name, const BiasValue &value);
101
108 [[nodiscard]] static uint32_t biasToCurrent(const BiasValue &value);
109
114 void enableDvs(bool state);
115
120 void enableAps(bool state);
121
126 void setApsTimeInterval(uint32_t usec);
127
132 [[nodiscard]] uint32_t getApsExposure() const;
133
138 void setApsExposure(uint32_t usec);
139
144 void enableApsAutoExposure(bool state);
145
150 void enableImu(bool state);
151
152private:
153 std::size_t setDvsFilterPixels(const std::vector<cv::Point> &pixels) override;
154};
155
156} // namespace ev
157
158#endif // OPENEV_DEVICES_DAVIS_HPP
Abstract camera device driver.
This is an auxiliary class. This class cannot be instanced.
Definition abstract-camera.hpp:131
This class extends AbstractCamera to operate with DAVIS event cameras. DAVIS cameras offer events (DV...
Definition davis.hpp:31
void enableDvs(bool state)
Enable DVS.
Definition davis.cpp:171
void setApsExposure(uint32_t usec)
Set APS exposure time.
Definition davis.cpp:189
bool hasAps() const override
DAVIS cameras have an APS sensor.
Definition davis.hpp:54
std::string getSerialNumber() const override
Get device serial number, prefixed with the chip model.
Definition davis.cpp:113
void enableAps(bool state)
Enable APS.
Definition davis.cpp:175
static uint32_t biasToCurrent(const BiasValue &value)
Convert a bias value into the current it produces. The coarse and fine ranges overlap,...
Definition davis.cpp:164
uint32_t getApsExposure() const
Get the APS exposure time currently applied by the device.
Definition davis.cpp:183
void start() override
Initialize the DAVIS camera. This function sets up the DAVIS camera for operation....
Definition davis.cpp:53
bool setBias(const uint8_t name, const BiasValue &value)
Set the bias value associated with the given name.
Definition davis.cpp:155
cv::Size getSensorSize() const override
Get device sensor size.
Definition davis.cpp:79
void enableImu(bool state)
Enable IMU.
Definition davis.cpp:221
BiasValue getBias(const uint8_t name) const
Retrieve the bias value associated with the given name.
Definition davis.cpp:148
void enableApsAutoExposure(bool state)
Let the device choose the APS exposure time on its own, aiming to avoid under and over exposure.
Definition davis.cpp:198
bool setRoi(const cv::Rect_< uint16_t > &roi) override
Set current ROI. Events outside the ROI are not considered. Images are cropped according to the ROI.
Definition davis.cpp:122
bool hasImu() const override
DAVIS cameras have an IMU.
Definition davis.hpp:62
void setApsTimeInterval(uint32_t usec)
Set APS maximum time interval between subsequent transmissions.
Definition davis.cpp:179
Coarse/fine bias value, the encoding used by DAVIS cameras.
Definition davis.hpp:19