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 {
16[[maybe_unused]] constexpr bool USING_DAVIS_HPP = true;
17
21struct BiasValue {
22 uint8_t coarse;
23 uint8_t fine;
24 [[nodiscard]] friend std::ostream &operator<<(std::ostream &os, const struct BiasValue &value) {
25 os << "Coarse: " << static_cast<int>(value.coarse) << ", Fine: " << static_cast<int>(value.fine);
26 return os;
27 }
28};
29
33class Davis : public AbstractCamera {
34public:
35 constexpr static uint32_t DEFAULT_INTERVAL = 20000;
36 constexpr static uint32_t DEFAULT_EXPOSURE = 6500;
37
39 Davis();
40 Davis(const Davis &) = delete;
41 Davis(Davis &&) noexcept = delete;
42 Davis &operator=(const Davis &) = delete;
43 Davis &operator=(Davis &&) noexcept = delete;
45
50 void start() override;
51
56 [[nodiscard]] bool hasAps() const override {
57 return true;
58 }
59
64 [[nodiscard]] bool hasImu() const override {
65 return true;
66 }
67
72 [[nodiscard]] cv::Size getSensorSize() const override;
73
78 [[nodiscard]] std::string getSerialNumber() const override;
79
87 bool setRoi(const cv::Rect_<uint16_t> &roi) override;
88
94 BiasValue getBias(const uint8_t name) const;
95
102 bool setBias(const uint8_t name, const BiasValue &value);
103
110 [[nodiscard]] static uint32_t biasToCurrent(const BiasValue &value);
111
116 void enableDvs(bool state);
117
122 void enableAps(bool state);
123
128 void setApsTimeInterval(uint32_t usec);
129
134 [[nodiscard]] uint32_t getApsExposure() const;
135
140 void setApsExposure(uint32_t usec);
141
146 void enableApsAutoExposure(bool state);
147
152 void enableImu(bool state);
153
154private:
155 std::size_t setDvsFilterPixels(const std::vector<cv::Point> &pixels) override;
156};
157
158} // namespace ev
159
160#endif // OPENEV_DEVICES_DAVIS_HPP
Abstract camera device driver.
This is an auxiliary class. This class cannot be instanced.
Definition abstract-camera.hpp:44
This class extends AbstractCamera to operate with DAVIS event cameras. DAVIS cameras offer events (DV...
Definition davis.hpp:33
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:56
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:64
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:21