DvsenseDriver  1.3.0
The SDK for dvsense products.
Loading...
Searching...
No Matches
ApsTypes.h
1#ifndef __APS_TYPES_HPP__
2#define __APS_TYPES_HPP__
3
4#include <cstddef>
5#include <cstdint>
6#include <vector>
7#include <functional>
8#include <memory>
9#include <vector>
10#include "DvsenseBase/Utils/TypeUtils.hpp"
11#include "DvsenseBase/EventBase/EventTypes.hpp"
12
13#ifdef _WIN32
14#define DVSENSE_API __declspec(dllexport)
15#else
16#define DVSENSE_API
17#endif // _WIN32
18namespace dvsense
19{
20 enum class ApsPixelType
21 {
23 };
24
33 class DVSENSE_API ApsFrame
34 {
35 public:
36 ApsFrame(int width = 3840, int height = 2160, TimeStamp start_ts = 0, TimeStamp end_ts = 0);
37
46 ApsFrame(int width, int height, TimeStamp start_ts, TimeStamp end_ts,
47 uint8_t *external_data, size_t data_size,
48 bool own_data = false);
49
58 ApsFrame(int width, int height, TimeStamp start_ts, TimeStamp end_ts,
59 std::shared_ptr<std::vector<uint8_t>> shared_data);
60
61 ApsFrame(const ApsFrame &other);
62
63 ApsFrame &operator=(const ApsFrame &other);
64
69 ApsFrame clone() const;
70
71 uint8_t *data();
72
73 const uint8_t *data() const;
74
75 size_t getDataSize() const;
76
77 int width() const;
78
79 int height() const;
80
82
85
86 private:
87 int width_;
88 int height_;
89 ApsPixelType pixel_type_;
90 std::shared_ptr<uint8_t[]> data_;
91 std::shared_ptr<std::vector<uint8_t>> shared_data_owner_;
92 };
93
94 using FrameCallback = std::function<void(ApsFrame)>;
95 using DsFusionDataCallback = std::function<void(ApsFrame &, EventIterator_t begin, EventIterator_t end)>;
96} // namespace dvsense
97
98#endif // __EVENT_TYPES_HPP__
Contiguous BGR888 APS image with exposure timestamps.
Definition ApsTypes.h:34
ApsFrame(int width, int height, TimeStamp start_ts, TimeStamp end_ts, uint8_t *external_data, size_t data_size, bool own_data=false)
Wrap external BGR888 pixels, optionally copying them.
int height() const
const uint8_t * data() const
ApsFrame & operator=(const ApsFrame &other)
ApsFrame(int width, int height, TimeStamp start_ts, TimeStamp end_ts, std::shared_ptr< std::vector< uint8_t > > shared_data)
Retain shared BGR888 storage without copying pixels.
ApsFrame clone() const
Return a deep copy with independent pixel storage.
TimeStamp exposure_end_timestamp
Definition ApsTypes.h:84
uint8_t * data()
ApsFrame(const ApsFrame &other)
int width() const
size_t getDataSize() const
ApsFrame(int width=3840, int height=2160, TimeStamp start_ts=0, TimeStamp end_ts=0)
ApsPixelType pixelType() const
TimeStamp exposure_start_timestamp
Definition ApsTypes.h:83
Definition ApsTypes.h:19
Event2D * EventIterator_t
Definition EventTypes.hpp:63
std::function< void(ApsFrame)> FrameCallback
Definition ApsTypes.h:94
std::function< void(ApsFrame &, EventIterator_t begin, EventIterator_t end)> DsFusionDataCallback
Definition ApsTypes.h:95
ApsPixelType
Definition ApsTypes.h:21
@ BGR888
Definition ApsTypes.h:22
uint64_t TimeStamp
Definition TypeUtils.hpp:10