DvsenseDriver  1.0.3
The SDK for dvsense products.
DvsCamera.hpp
1 #ifndef DVSCAMERA_HPP
2 #define DVSCAMERA_HPP
3 
4 #include "DvsenseBase/EventBase/EventTypes.hpp"
5 #include "DvsenseHal/camera/DvsCameraUtils.hpp"
6 #include "DvsenseHal/EventStream/RawEventStreamFormat.hpp"
7 #include "DvsenseHal/camera/tools/CameraTool.h"
8 
9 #ifdef _WIN32
10 #ifdef DVSENSE_EXPORTS
11  #define DVSENSE_API __declspec(dllexport)
12  #else
13  #define DVSENSE_API __declspec(dllimport)
14  #endif
15 #else
16 #define DVSENSE_API
17 #endif // _WIN32
18 
19 namespace dvsense
20 {
21 
22  class DvsCameraManager;
23 
28  #ifdef _WIN32
29  enum DVSENSE_API CameraStatus
30  #else
32  #endif // _WIN32
33  {
34  STOPPED = 0,
35  STARTED = 1
36  };
37 
43  class DVSENSE_API DvsCamera
44  {
45  private:
46  friend DvsCameraManager;
47 
48  public:
56 
63  virtual const bool isConnected() = 0;
64 
72  {
73  return cameraDesc_;
74  }
75 
84  virtual uint32_t addEventsStreamHandleCallback(EventsStreamHandleCallback cb) = 0;
85 
96  virtual bool removeEventsStreamHandleCallback(uint32_t callback_id) = 0;
97 
106  virtual uint32_t addTriggerInCallback(DvsTriggerInCallback cb) = 0;
107 
118  virtual bool removeTriggerInCallback(uint32_t callback_id) = 0;
119 
135  virtual bool getNextBatch(Event2DVector& event_batch) = 0;
136 
143  virtual void setBatchEventsNum(uint64_t n) = 0;
144 
151  virtual void setBatchEventsTime(TimeStamp n) = 0;
152 
159  virtual int start() = 0;
160 
167  virtual int stop() = 0;
168 
177  virtual int startRecording(std::string file_path) = 0;
178 
185  virtual int stopRecording() = 0;
186 
193  virtual uint16_t getWidth() = 0;
194 
201  virtual uint16_t getHeight() = 0;
202 
209  const std::vector<ToolInfo> getAllToolsInfo();
210 
219  const ToolInfo getToolInfo(ToolType type);
220 
229  const std::shared_ptr<CameraTool> getTool(ToolType type);
230 
231  protected:
239 
246  virtual int init() = 0;
247 
248  // tools
249  std::map<ToolType, std::shared_ptr<CameraTool>> tools_;
250  };
251 
252 } // namespace dvsense
253 
254 #endif // DVSCAMERA_HPP
相机管理器类
Definition: DvsCameraManager.hpp:35
DVS相机的接口类
Definition: DvsCamera.hpp:44
virtual void setBatchEventsTime(TimeStamp n)=0
设置获取事件的时间间隔
virtual int startRecording(std::string file_path)=0
开始记录事件
std::map< ToolType, std::shared_ptr< CameraTool > > tools_
Definition: DvsCamera.hpp:249
virtual int start()=0
启动相机
DvsCamera(CameraDescription cameraDesc)
构造函数
const ToolInfo getToolInfo(ToolType type)
获取工具信息
virtual bool removeTriggerInCallback(uint32_t callback_id)=0
通过id移除一个回调函数
const CameraDescription getDvsDesc()
获取相机描述
Definition: DvsCamera.hpp:71
CameraDescription cameraDesc_
获取相机描述
Definition: DvsCamera.hpp:238
virtual int init()=0
打开相机时,应该初始化
virtual bool removeEventsStreamHandleCallback(uint32_t callback_id)=0
通过id移除一个回调函数
virtual int stopRecording()=0
停止记录事件
virtual uint32_t addTriggerInCallback(DvsTriggerInCallback cb)=0
添加一个回调函数来处理事件
virtual int stop()=0
停止相机
virtual uint16_t getWidth()=0
获取相机传感器的宽度
virtual const bool isConnected()=0
检查相机是否连接
virtual void setBatchEventsNum(uint64_t n)=0
设置需要获取的事件数量
virtual uint16_t getHeight()=0
获取相机传感器的高度
virtual bool getNextBatch(Event2DVector &event_batch)=0
获取下一批事件 在使用getNextBatch函数之前,您需要使用 setBatchEventsNum 设置需要获取的事件数量, 或者使用 setBatchEventsTime 设置需要获取事件的时间间...
const std::shared_ptr< CameraTool > getTool(ToolType type)
获取工具
const std::vector< ToolInfo > getAllToolsInfo()
获取所有工具的信息
virtual uint32_t addEventsStreamHandleCallback(EventsStreamHandleCallback cb)=0
添加一个回调函数来处理事件
Definition: TypeUtils.hpp:7
CameraStatus
相机状态,STOPPED 或 STARTED
Definition: DvsCamera.hpp:33
@ STOPPED
Definition: DvsCamera.hpp:34
@ STARTED
Definition: DvsCamera.hpp:35
uint64_t TimeStamp
Definition: TypeUtils.hpp:8
用于描述相机信息的结构体
Definition: DvsCameraUtils.hpp:68
工具的信息,包括类型、可以更改的参数名称和描述。
Definition: ToolInfo.h:45