Open3D (C++ API)  0.18.0
RealSenseSensor.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <string>
11 
16 
17 namespace rs2 {
18 class pipeline;
19 class align;
20 class config;
21 } // namespace rs2
22 
23 namespace open3d {
24 namespace t {
25 namespace io {
26 
28 class RealSenseSensor : public RGBDSensor {
29 public:
33  static std::vector<RealSenseValidConfigs> EnumerateDevices();
37  static bool ListDevices();
38 
41  RealSenseSensor(const RealSenseSensor &) = delete;
43  virtual ~RealSenseSensor() override;
44 
60  virtual bool InitSensor(const RealSenseSensorConfig &sensor_config =
62  size_t sensor_index = 0,
63  const std::string &filename = "");
64  virtual bool InitSensor(const RGBDSensorConfig &sensor_config,
65  size_t sensor_index = 0,
66  const std::string &filename = "") override {
67  return InitSensor(
68  dynamic_cast<const RealSenseSensorConfig &>(sensor_config),
69  sensor_index, filename);
70  }
71 
74  virtual bool StartCapture(bool start_record = false) override;
75 
80  virtual void PauseRecord() override;
81 
84  virtual void ResumeRecord() override;
85 
93  bool wait = true, bool align_depth_to_color = true) override;
94 
100  virtual uint64_t GetTimestamp() const override { return timestamp_; }
101 
103  virtual void StopCapture() override;
104 
106  virtual const RGBDVideoMetadata &GetMetadata() const override {
107  return metadata_;
108  }
109 
111  virtual std::string GetFilename() const override { return filename_; };
112 
114  using RGBDSensor::ToString;
115 
116 private:
117  bool enable_recording_ = false;
118  bool is_recording_ = false;
119  bool is_capturing_ = false;
120  std::string filename_;
121  geometry::RGBDImage current_frame_;
122  uint64_t timestamp_ = 0;
123  RGBDVideoMetadata metadata_;
124  std::unique_ptr<rs2::pipeline> pipe_;
125  std::unique_ptr<rs2::align> align_to_color_;
126  std::unique_ptr<rs2::config> rs_config_;
127 
128  static const uint64_t MILLISEC_TO_MICROSEC = 1000;
129 };
130 
131 } // namespace io
132 } // namespace t
133 } // namespace open3d
Definition: RGBDSensorConfig.h:15
RGBDImage A pair of color and depth images.
Definition: RGBDImage.h:21
Interface class for control of RGBD cameras.
Definition: RGBDSensor.h:22
virtual const std::string ToString() const
Text Description.
Definition: RGBDSensor.h:81
RGBD video metadata.
Definition: RGBDVideoMetadata.h:26
Definition: RealSenseSensorConfig.h:62
RealSense camera discovery, configuration, streaming and recording.
Definition: RealSenseSensor.h:28
virtual void StopCapture() override
Stop capturing frames.
Definition: RealSenseSensor.cpp:288
virtual void PauseRecord() override
Definition: RealSenseSensor.cpp:227
virtual void ResumeRecord() override
Definition: RealSenseSensor.cpp:234
RealSenseSensor()
Default constructor. Initialize with default settings.
Definition: RealSenseSensor.cpp:115
virtual geometry::RGBDImage CaptureFrame(bool wait=true, bool align_depth_to_color=true) override
Definition: RealSenseSensor.cpp:255
virtual ~RealSenseSensor() override
Definition: RealSenseSensor.cpp:122
RealSenseSensor(const RealSenseSensor &)=delete
static std::vector< RealSenseValidConfigs > EnumerateDevices()
Definition: RealSenseSensor.cpp:45
virtual const RGBDVideoMetadata & GetMetadata() const override
Get metadata of the RealSense video capture.
Definition: RealSenseSensor.h:106
static bool ListDevices()
Definition: RealSenseSensor.cpp:24
virtual bool StartCapture(bool start_record=false) override
Definition: RealSenseSensor.cpp:197
virtual bool InitSensor(const RGBDSensorConfig &sensor_config, size_t sensor_index=0, const std::string &filename="") override
Definition: RealSenseSensor.h:64
virtual uint64_t GetTimestamp() const override
Definition: RealSenseSensor.h:100
RealSenseSensor & operator=(const RealSenseSensor &)=delete
virtual std::string GetFilename() const override
Get filename being written.
Definition: RealSenseSensor.h:111
virtual bool InitSensor(const RealSenseSensorConfig &sensor_config=RealSenseSensorConfig{}, size_t sensor_index=0, const std::string &filename="")
Definition: RealSenseSensor.cpp:124
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample uint64_t
Definition: K4aPlugin.cpp:343
Definition: PinholeCameraIntrinsic.cpp:16
Definition: RealSenseSensor.h:17