Open3D (C++ API)  0.15.1
RGBDSensor.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018-2021 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <string>
30 
34 
35 namespace open3d {
36 using io::RGBDSensorConfig;
37 namespace t {
38 namespace io {
39 
41 class RGBDSensor {
42 public:
45  virtual ~RGBDSensor() {}
46 
63  virtual bool InitSensor(const RGBDSensorConfig &sensor_config,
64  size_t sensor_index = 0,
65  const std::string &filename = "") = 0;
66 
69  virtual bool StartCapture(bool start_record = false) = 0;
70 
72  virtual void PauseRecord() = 0;
73 
76  virtual void ResumeRecord() = 0;
77 
85  bool wait = true, bool align_depth_to_color = true) = 0;
86 
88  virtual uint64_t GetTimestamp() const = 0;
89 
91  virtual void StopCapture() = 0;
92 
94  virtual const RGBDVideoMetadata &GetMetadata() const = 0;
95 
97  virtual std::string GetFilename() const = 0;
98 
100  virtual const std::string ToString() const {
101  return fmt::format(
102  "RGBD sensor {} (serial {}){}{}", GetMetadata().device_name_,
103  GetMetadata().serial_number_,
104  GetTimestamp() == 0 ? ""
105  : "\nCapturing video: timestamp (us) = " +
106  std::to_string(GetTimestamp()),
107  GetFilename().empty() ? ""
108  : "\nRecording to file " + GetFilename());
109  }
110 };
111 
112 } // namespace io
113 } // namespace t
114 } // namespace open3d
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:214
Definition: RGBDSensorConfig.h:34
RGBDImage A pair of color and depth images.
Definition: RGBDImage.h:40
Interface class for control of RGBD cameras.
Definition: RGBDSensor.h:41
virtual geometry::RGBDImage CaptureFrame(bool wait=true, bool align_depth_to_color=true)=0
virtual void StopCapture()=0
Stop capturing frames.
virtual void ResumeRecord()=0
virtual std::string GetFilename() const =0
Get filename being written.
virtual ~RGBDSensor()
Definition: RGBDSensor.h:45
virtual bool InitSensor(const RGBDSensorConfig &sensor_config, size_t sensor_index=0, const std::string &filename="")=0
virtual void PauseRecord()=0
Pause recording to the file.
virtual uint64_t GetTimestamp() const =0
Get current timestamp (in us).
RGBDSensor()
Default constructor. Initialize with default settings.
Definition: RGBDSensor.h:44
virtual const std::string ToString() const
Text Description.
Definition: RGBDSensor.h:100
virtual const RGBDVideoMetadata & GetMetadata() const =0
Get const reference to the metadata of the RGBD video capture.
virtual bool StartCapture(bool start_record=false)=0
RGBD video metadata.
Definition: RGBDVideoMetadata.h:45
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:362
Definition: PinholeCameraIntrinsic.cpp:35