This is an example of how to use the Davis class.
#include "openev/containers/vector.hpp"
#include <cstdlib>
#include <iostream>
#include <memory>
#include <opencv2/core.hpp>
#include <opencv2/core/cvstd.inl.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/core/mat.inl.hpp>
#include <opencv2/core/matx.hpp>
#include <opencv2/core/saturate.hpp>
#include <opencv2/core/traits.hpp>
#include <opencv2/core/types.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <string>
 
  cv::resize(evhist.
render(), resized, 
ev::Size(), 2, 2, cv::INTER_NEAREST);
  cv::imshow("example-davis: dvs", resized);
  cv::waitKey(1);
}
 
static inline void show2(cv::Mat &img) {
  cv::Mat resized;
  cv::resize(img, resized, 
ev::Size(), 2, 2, cv::INTER_NEAREST);
  cv::imshow("example-davis: aps", resized);
  cv::waitKey(1);
}
 
int main(int , const char * []) {
  camera.
setRoi(cv::Rect(20, 20, 250, 200));
  std::cout << camera.
getRoi() << 
'\n';
 
  ev::Vector events;
 
  while(true) {
    events.clear();
    evhist.clear();
 
    std::cout << events.size() << 
", " << !img.empty() << 
", " << !imu.
empty() << 
'\n';
 
    if(!events.empty()) {
      evhist.insert(events);
      show1(evhist);
    }
    if(!img.empty()) {
      show2(img);
    }
    if(!imu.empty()) {
      std::cout << imu << '\n';
    }
  }
 
  return 0;
}
Abstract camera device driver.
cv::Size getSensorSize() const
Get device sensor size.
Definition abstract-camera.cpp:25
bool setRoi(const cv::Rect_< uint16_t > &roi)
Set current ROI. Events outside the ROI are not considered. Images are cropped according to the ROI.
Definition abstract-camera.cpp:38
void start()
Start reading data.
Definition abstract-camera.cpp:16
cv::Rect_< uint16_t > getRoi() const
Get current ROI.
Definition abstract-camera.cpp:30
This class extends AbstractCamera to operate with DAVIS event cameras. DAVIS cameras offer events (DV...
Definition davis.hpp:20
void enableDvs(bool state)
Enable DVS.
Definition davis.cpp:78
void enableAps(bool state)
Enable APS.
Definition davis.cpp:92
void setDvsEventsPerPacket(uint32_t n)
Set DVS maximum number of events per transmission.
Definition davis.cpp:87
void setDvsTimeInterval(uint32_t usec)
Set DVS maximum time interval between subsequent transmissions.
Definition davis.cpp:82
bool getData(Vector &events) override
Get DVS data.
Definition davis.cpp:110
void enableImu(bool state)
Enable IMU.
Definition davis.cpp:104
cv::Mat & render()
Render event histogram matrix.
This class extends cv::Mat to include timestamp.
Definition abstract-camera.hpp:54
Camera device driver for DAVIS cameras.
EventHistogram_< cv::Vec3b > EventHistogram3b
Definition event-histogram.hpp:81
This struct is used to store IMU data from a DAVIS event camera.
Definition abstract-camera.hpp:92
Basic event-based vision structures based on OpenCV components.
Size2 Size
Definition types.hpp:272