DVSenseDriver  1.0.1
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/ToolInfo.h"
8 #include "DvsenseHal/camera/tools/CameraTool.h"
9 
10 #ifdef _WIN32
11 #define DVSENSE_API __declspec(dllexport)
12 #else
13 #define DVSENSE_API
14 #endif // _WIN32
15 namespace dvsense
16 {
17 
18  class DvsCameraManager;
19 
24  #ifdef _WIN32
25  enum DVSENSE_API BatchConditionType
26  #else
28  #endif // _WIN32
29  {
32  N_US
33  };
34 
39  #ifdef _WIN32
40  enum DVSENSE_API CameraStatus
41  #else
43  #endif // _WIN32
44  {
45  STOPPED = 0,
46  STARTED = 1
47  };
48 
54  class DVSENSE_API DvsCamera
55  {
56  private:
57  friend DvsCameraManager;
58 
59  public:
67 
74  virtual const bool isConnected() = 0;
75 
83  {
84  return cameraDesc_;
85  }
86 
95  virtual uint32_t addEventsStreamHandleCallback(EventsStreamHandleCallback cb) = 0;
96 
107  virtual bool removeEventsStreamHandleCallback(uint32_t callback_id) = 0;
108 
124  virtual bool getNextBatch(Event2DVector& event_batch) = 0;
125 
132  virtual void setBatchEventsNum(uint64_t n) = 0;
133 
140  virtual void setBatchEventsTime(TimeStamp n) = 0;
141 
148  virtual int start() = 0;
149 
156  virtual int stop() = 0;
157 
166  virtual int startRecording(std::string file_path) = 0;
167 
174  virtual int stopRecording() = 0;
175 
182  virtual uint16_t getWidth() = 0;
183 
190  virtual uint16_t getHeight() = 0;
191 
198  const std::vector<ToolInfo> getAllToolsInfo();
199 
208  const ToolInfo getToolInfo(ToolType type);
209 
218  const std::shared_ptr<CameraTool> getTool(ToolType type);
219 
220  protected:
228 
235  virtual int init() = 0;
236 
237  // tools
238  std::map<ToolType, std::shared_ptr<CameraTool>> tools_;
239  };
240 
241 } // namespace dvsense
242 
243 #endif // DVSCAMERA_HPP
相机管理器类
Definition: DvsCameraManager.hpp:29
DVS相机的接口类
Definition: DvsCamera.hpp:55
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:238
virtual int start()=0
启动相机
DvsCamera(CameraDescription cameraDesc)
构造函数
const ToolInfo getToolInfo(ToolType type)
获取工具信息
const CameraDescription getDvsDesc()
获取相机描述
Definition: DvsCamera.hpp:82
CameraDescription cameraDesc_
获取相机描述
Definition: DvsCamera.hpp:227
virtual int init()=0
打开相机时,应该初始化
virtual bool removeEventsStreamHandleCallback(uint32_t callback_id)=0
通过id移除一个回调函数
virtual int stopRecording()=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:44
@ STOPPED
Definition: DvsCamera.hpp:45
@ STARTED
Definition: DvsCamera.hpp:46
BatchConditionType
事件批次的切割条件,n个事件(N_EVENTS) 或 固定事件(N_US)
Definition: DvsCamera.hpp:29
@ NO_CONDITION
Definition: DvsCamera.hpp:30
@ N_US
Definition: DvsCamera.hpp:32
@ N_EVENTS
Definition: DvsCamera.hpp:31
uint64_t TimeStamp
Definition: TypeUtils.hpp:8
用于描述相机信息的结构体
Definition: DvsCameraUtils.hpp:39
工具的信息,包括类型、可以更改的参数名称和描述。
Definition: ToolInfo.h:32