OrbbecSDK 1.10.18
OrbbecSDK: Software-Development-Kit for Orbbec 3D Cameras
Loading...
Searching...
No Matches
StreamProfile.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include "Types.hpp"
8
9#include <iostream>
10#include <memory>
11
12struct StreamProfileImpl;
13struct StreamProfileListImpl;
14
15namespace ob {
16
17class VideoStreamProfile;
18class GyroStreamProfile;
19class AccelStreamProfile;
20class Config;
21
22class OB_EXTENSION_API StreamProfile : public std::enable_shared_from_this<StreamProfile> {
23protected:
24 std::unique_ptr<StreamProfileImpl> impl_;
25
26public:
27 StreamProfile(std::unique_ptr<StreamProfileImpl> impl);
29 virtual ~StreamProfile() noexcept;
30
36 OBFormat format() const;
37
43 OBStreamType type() const;
44
50 OBExtrinsic getExtrinsicTo(std::shared_ptr<StreamProfile> target);
51
58 template <typename T> bool is();
59
66 template <typename T> std::shared_ptr<T> as() {
67 if(!is<T>()) {
68 throw std::runtime_error("Unsupported operation. Object's type is not the required type.");
69 }
70
71 return std::static_pointer_cast<T>(std::const_pointer_cast<StreamProfile>(shared_from_this()));
72 }
73
74 friend class Sensor;
75 friend class Config;
76 friend class Pipeline;
77};
78
83public:
85
86 explicit VideoStreamProfile(std::unique_ptr<StreamProfileImpl> impl);
87
88 ~VideoStreamProfile() noexcept override;
89
95 uint32_t fps() const;
96
102 uint32_t width() const;
103
109 uint32_t height() const;
110
116 OBCameraIntrinsic getIntrinsic();
117
124 OBCameraDistortion getDistortion();
125};
126
131public:
133
134 explicit AccelStreamProfile(std::unique_ptr<StreamProfileImpl> impl);
135
136 ~AccelStreamProfile() noexcept override;
137
143 OBAccelFullScaleRange fullScaleRange() const;
144
150 OBAccelSampleRate sampleRate() const;
151
157 OBAccelIntrinsic getIntrinsic();
158};
159
164public:
166
167 explicit GyroStreamProfile(std::unique_ptr<StreamProfileImpl> impl);
168 ~GyroStreamProfile() noexcept override;
169
175 OBGyroFullScaleRange fullScaleRange() const;
176
182 OBGyroSampleRate sampleRate() const;
183
189 OBGyroIntrinsic getIntrinsic();
190};
191
192template <typename T> bool StreamProfile::is() {
193 switch(this->type()) {
194 case OB_STREAM_VIDEO:
195 case OB_STREAM_IR:
198 case OB_STREAM_COLOR:
199 case OB_STREAM_DEPTH:
201 return typeid(T) == typeid(VideoStreamProfile);
202 case OB_STREAM_ACCEL:
203 return typeid(T) == typeid(AccelStreamProfile);
204 case OB_STREAM_GYRO:
205 return typeid(T) == typeid(GyroStreamProfile);
206 default:
207 break;
208 }
209 return false;
210}
211
213protected:
214 std::unique_ptr<StreamProfileListImpl> impl_;
215
216public:
217 explicit StreamProfileList(std::unique_ptr<StreamProfileListImpl> impl);
219
225 uint32_t count() const;
226
233 const std::shared_ptr<StreamProfile> getProfile(uint32_t index);
234
245 const std::shared_ptr<VideoStreamProfile> getVideoStreamProfile(int width = OB_WIDTH_ANY, int height = OB_HEIGHT_ANY, OBFormat format = OB_FORMAT_ANY,
246 int fps = OB_FPS_ANY);
247
255 const std::shared_ptr<AccelStreamProfile> getAccelStreamProfile(OBAccelFullScaleRange fullScaleRange, OBAccelSampleRate sampleRate);
256
264 const std::shared_ptr<GyroStreamProfile> getGyroStreamProfile(OBGyroFullScaleRange fullScaleRange, OBGyroSampleRate sampleRate);
265};
266
267} // namespace ob
OBGyroFullScaleRange
Enumeration of gyroscope ranges.
Definition ObTypes.h:607
OBFormat
Enumeration value describing the pixel format.
Definition ObTypes.h:216
enum OBGyroSampleRate OBAccelSampleRate
OBGyroSampleRate
Enumeration of IMU sample rate values (gyroscope or accelerometer)
Definition ObTypes.h:584
OBStreamType
Enumeration value describing the type of data stream.
Definition ObTypes.h:179
@ OB_STREAM_RAW_PHASE
Definition ObTypes.h:189
@ OB_STREAM_GYRO
Definition ObTypes.h:186
@ OB_STREAM_IR
Definition ObTypes.h:182
@ OB_STREAM_DEPTH
Definition ObTypes.h:184
@ OB_STREAM_IR_RIGHT
Definition ObTypes.h:188
@ OB_STREAM_IR_LEFT
Definition ObTypes.h:187
@ OB_STREAM_VIDEO
Definition ObTypes.h:181
@ OB_STREAM_ACCEL
Definition ObTypes.h:185
@ OB_STREAM_COLOR
Definition ObTypes.h:183
OBAccelFullScaleRange
Enumeration of accelerometer ranges.
Definition ObTypes.h:623
#define OB_WIDTH_ANY
Definition ObTypes.h:74
#define OB_EXTENSION_API
Definition ObTypes.h:28
#define OB_FPS_ANY
Definition ObTypes.h:76
#define OB_HEIGHT_ANY
Definition ObTypes.h:75
#define OB_FORMAT_ANY
Definition ObTypes.h:77
Provides SDK structure and enumeration constant definitions (depending on libobsensor/h/ObTypes....
Class representing an accelerometer stream profile.
~AccelStreamProfile() noexcept override
AccelStreamProfile(std::unique_ptr< StreamProfileImpl > impl)
AccelStreamProfile(StreamProfile &profile)
Config class for configuring pipeline parameters.
Definition Pipeline.hpp:210
Class representing a gyroscope stream profile.
GyroStreamProfile(StreamProfile &profile)
GyroStreamProfile(std::unique_ptr< StreamProfileImpl > impl)
~GyroStreamProfile() noexcept override
~StreamProfileList() noexcept
std::unique_ptr< StreamProfileListImpl > impl_
StreamProfileList(std::unique_ptr< StreamProfileListImpl > impl)
virtual ~StreamProfile() noexcept
std::unique_ptr< StreamProfileImpl > impl_
StreamProfile(StreamProfile &streamProfile)
StreamProfile(std::unique_ptr< StreamProfileImpl > impl)
Class representing a video stream profile.
VideoStreamProfile(std::unique_ptr< StreamProfileImpl > impl)
~VideoStreamProfile() noexcept override
VideoStreamProfile(StreamProfile &profile)
Definition Context.hpp:16
Structure for accelerometer intrinsic parameters.
Definition ObTypes.h:392
Structure for distortion parameters.
Definition ObTypes.h:417
Structure for camera intrinsic parameters.
Definition ObTypes.h:380
Structure for rotation/transformation.
Definition ObTypes.h:454
Structure for gyroscope intrinsic parameters.
Definition ObTypes.h:405