DvsenseDriver  1.3.0
The SDK for dvsense products.
Loading...
Searching...
No Matches
FusionCamera.hpp
1#ifndef FUSION_CAMERA_HPP
2#define FUSION_CAMERA_HPP
3
4#include "DvsenseHal/camera/DvsCameraUtils.hpp"
5#include "DvsenseHal/EventStream/RawEventStreamFormat.hpp"
6#include "DvsenseBase/EventBase/EventTypes.hpp"
7#include "DvsenseBase/ApsBase/ApsTypes.h"
8#include "DvsenseBase/Utils/TypeUtils.hpp"
9#include "DvsenseHal/camera/tools/CameraTool.h"
10
11#ifdef _WIN32
12#define DVSENSE_API __declspec(dllexport)
13#else
14#define DVSENSE_API
15#endif // _WIN32
16namespace dvsense
17{
18
19 class DvsCameraManager;
25 class DVSENSE_API FusionCamera
26 {
27 private:
28 friend DvsCameraManager;
29
30 public:
38 {
39 cameraDesc_ = cameraDesc;
40 };
41
48 virtual const bool isConnected() = 0;
49
57 {
58 return cameraDesc_;
59 }
60
74
86
97 virtual bool removeEventsStreamHandleCallback(uint32_t callback_id) = 0;
98
107 virtual bool removeSharedEventsStreamHandleCallback(uint32_t callback_id) = 0;
108
117 virtual uint32_t addApsFrameCallback(FrameCallback cb) = 0;
118
129 virtual bool removeApsFrameCallback(uint32_t callback_id) = 0;
130
140
151 virtual bool removeSyncSignalCallback(uint32_t callback_id) = 0;
167 virtual bool getNextBatch(Event2DVector &event_batch) = 0;
168
175 virtual void setBatchEventsNum(uint64_t n) = 0;
176
183 virtual void setBatchEventsTime(TimeStamp n) = 0;
184
193 virtual int start(STREAM_TYPE type = FUSION_STREAM) = 0;
194
201 virtual int stop(STREAM_TYPE type = FUSION_STREAM) = 0;
202
203 virtual int destroy() = 0;
204
217 virtual int startRecording(std::string file_path, std::string file_name, STREAM_TYPE stream_type = FUSION_STREAM) = 0;
218
225 virtual int stopRecording(STREAM_TYPE stream_type = FUSION_STREAM) = 0;
226
233 virtual uint16_t getWidth(STREAM_TYPE type = DVS_STREAM) = 0;
234
241 virtual uint16_t getHeight(STREAM_TYPE type = DVS_STREAM) = 0;
242
249 const std::vector<ToolInfo> getAllToolsInfo();
250
260
269 const std::shared_ptr<CameraTool> getTool(ToolType type);
270
279 const std::shared_ptr<CameraTool> getTool(std::string tool_name);
280
288
289 virtual bool writeCalibrationFile(std::string file_path) = 0;
290
292
293 virtual bool getFirmwareVersion(std::string &version) = 0;
294
303 bool exportCameraConfigParams(std::string json_file_path);
304
313 bool loadCameraConfigParams(std::string json_file_path);
314
315 protected:
323
330 virtual int init() = 0;
331
332 // tools
333 std::map<ToolType, std::shared_ptr<CameraTool>> tools_;
334 };
335
336} // namespace dvsense
337
338#endif // FUSION_CAMERA_HPP
Camera Manager class.
Definition DvsCameraManager.hpp:36
virtual bool removeSharedEventsStreamHandleCallback(uint32_t callback_id)=0
Remove a shared DVS event-buffer callback by id.
virtual int destroy()=0
virtual bool getNextBatch(Event2DVector &event_batch)=0
Get the next batch of events Before using the getNextBatch function, you need to use setBatchEventsNu...
CameraDescription cameraDesc_
Get the camera description.
Definition FusionCamera.hpp:322
bool loadCameraConfigParams(std::string json_file_path)
Load camera configuration parameters from a JSON file.
FusionCamera(CameraDescription cameraDesc)
Constructor.
Definition FusionCamera.hpp:37
virtual uint16_t getHeight(STREAM_TYPE type=DVS_STREAM)=0
Get the Height of the camera sensor.
virtual uint32_t addSharedEventsStreamHandleCallback(SharedEventsStreamHandleCallback cb)=0
Add a callback that shares ownership of each decoded DVS event buffer.
const std::shared_ptr< CameraTool > getTool(ToolType type)
Get the tool.
virtual bool removeApsFrameCallback(uint32_t callback_id)=0
Remove a callback function by id.
virtual bool getFirmwareVersion(std::string &version)=0
virtual bool removeEventsStreamHandleCallback(uint32_t callback_id)=0
Remove a callback function by id.
virtual const bool isConnected()=0
Check if the camera is connected.
bool exportCameraConfigParams(std::string json_file_path)
Export camera configuration parameters to a JSON file.
virtual int startRecording(std::string file_path, std::string file_name, STREAM_TYPE stream_type=FUSION_STREAM)=0
Start recording events.
virtual uint16_t getWidth(STREAM_TYPE type=DVS_STREAM)=0
Get the Width of the camera sensor.
virtual int start(STREAM_TYPE type=FUSION_STREAM)=0
Start the camera.
virtual bool readCalibrationParam(CalibratorParameters &param)=0
virtual void setStatisticInfoCallback(DsStatisticInfoCallback cb)
set the callback function to get the statistic information
Definition FusionCamera.hpp:287
virtual bool removeSyncSignalCallback(uint32_t callback_id)=0
Remove a callback function by id.
std::map< ToolType, std::shared_ptr< CameraTool > > tools_
Definition FusionCamera.hpp:333
virtual uint32_t addEventsStreamHandleCallback(EventsStreamHandleCallback cb)=0
Add a callback function to handle events.
virtual void setBatchEventsTime(TimeStamp n)=0
Set the time interval at which events are fetched.
const CameraDescription getDescription()
Get camera description.
Definition FusionCamera.hpp:56
virtual uint32_t addApsFrameCallback(FrameCallback cb)=0
Add a callback function to handle aps data.
virtual void setBatchEventsNum(uint64_t n)=0
Set the number of events to be fetched.
const ToolInfo getToolInfo(ToolType type)
Get the tool information.
const std::vector< ToolInfo > getAllToolsInfo()
Get all the tools information.
virtual int stopRecording(STREAM_TYPE stream_type=FUSION_STREAM)=0
Stop recording events.
virtual int stop(STREAM_TYPE type=FUSION_STREAM)=0
Stop the camera.
const std::shared_ptr< CameraTool > getTool(std::string tool_name)
Get the tool by tool name.
virtual uint32_t addSyncSignalCallback(DvsTriggerInCallback cb)=0
Add a callback function to handle trigger in signal.
virtual bool writeCalibrationFile(std::string file_path)=0
virtual int init()=0
When a camera is opened, it should be initialized.
Definition ApsTypes.h:19
std::function< void(std::shared_ptr< Event2DVector >)> SharedEventsStreamHandleCallback
Event-batch callback with shared ownership, valid until its last owner releases it.
Definition EventTypes.hpp:69
std::function< void(const DsStatisticInfo)> DsStatisticInfoCallback
Definition EventTypes.hpp:71
std::function< void(ApsFrame)> FrameCallback
Definition ApsTypes.h:94
std::function< void(const EventTriggerIn)> DvsTriggerInCallback
Definition EventTypes.hpp:70
ToolType
The type of the tool.
Definition ToolInfo.h:27
std::vector< Event2D > Event2DVector
Definition EventTypes.hpp:62
std::function< void(EventIterator_t begin, EventIterator_t end)> EventsStreamHandleCallback
Definition EventTypes.hpp:64
uint64_t TimeStamp
Definition TypeUtils.hpp:10
STREAM_TYPE
Definition DvsCameraUtils.hpp:44
@ DVS_STREAM
Definition DvsCameraUtils.hpp:45
@ FUSION_STREAM
Definition DvsCameraUtils.hpp:47
Definition TypeUtils.hpp:35
A struct to describe the camera information.
Definition DvsCameraUtils.hpp:73
The information of the tool, including the type, the parameter names and the description.
Definition ToolInfo.h:46