ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::t::io::RealSenseSensor Class Reference

RealSense camera discovery, configuration, streaming and recording. More...

#include <RealSenseSensor.h>

Inheritance diagram for cloudViewer::t::io::RealSenseSensor:
Collaboration diagram for cloudViewer::t::io::RealSenseSensor:

Public Member Functions

 RealSenseSensor ()
 Default constructor. Initialize with default settings. More...
 
 RealSenseSensor (const RealSenseSensor &)=delete
 
RealSenseSensoroperator= (const RealSenseSensor &)=delete
 
virtual ~RealSenseSensor () override
 
virtual bool InitSensor (const RealSenseSensorConfig &sensor_config=RealSenseSensorConfig{}, size_t sensor_index=0, const std::string &filename="")
 
virtual bool InitSensor (const RGBDSensorConfig &sensor_config, size_t sensor_index=0, const std::string &filename="") override
 
virtual bool StartCapture (bool start_record=false) override
 
virtual void PauseRecord () override
 
virtual void ResumeRecord () override
 
virtual geometry::RGBDImage CaptureFrame (bool wait=true, bool align_depth_to_color=true) override
 
virtual uint64_t GetTimestamp () const override
 
virtual void StopCapture () override
 Stop capturing frames. More...
 
virtual const RGBDVideoMetadataGetMetadata () const override
 Get metadata of the RealSense video capture. More...
 
virtual std::string GetFilename () const override
 Get filename being written. More...
 
virtual const std::string ToString () const
 Text Description. More...
 
- Public Member Functions inherited from cloudViewer::t::io::RGBDSensor
 RGBDSensor ()
 Default constructor. Initialize with default settings. More...
 
virtual ~RGBDSensor ()
 
virtual const std::string ToString () const
 Text Description. More...
 

Static Public Member Functions

static std::vector< RealSenseValidConfigsEnumerateDevices ()
 
static bool ListDevices ()
 

Detailed Description

RealSense camera discovery, configuration, streaming and recording.

Definition at line 28 of file RealSenseSensor.h.

Constructor & Destructor Documentation

◆ RealSenseSensor() [1/2]

cloudViewer::t::io::RealSenseSensor::RealSenseSensor ( )

Default constructor. Initialize with default settings.

Definition at line 116 of file RealSenseSensor.cpp.

References cloudViewer::t::io::RealSenseSensorConfig::ConvertToNativeConfig().

◆ RealSenseSensor() [2/2]

cloudViewer::t::io::RealSenseSensor::RealSenseSensor ( const RealSenseSensor )
delete

◆ ~RealSenseSensor()

cloudViewer::t::io::RealSenseSensor::~RealSenseSensor ( )
overridevirtual

Definition at line 123 of file RealSenseSensor.cpp.

References StopCapture().

Member Function Documentation

◆ CaptureFrame()

geometry::RGBDImage cloudViewer::t::io::RealSenseSensor::CaptureFrame ( bool  wait = true,
bool  align_depth_to_color = true 
)
overridevirtual

Acquire the next synchronized RGBD frameset from the camera.

Parameters
waitIf true wait for the next frame set, else return immediately with an empty RGBDImage if it is not yet available.
align_depth_to_colorEnable aligning WFOV depth image to the color image in visualizer.

Implements cloudViewer::t::io::RGBDSensor.

Definition at line 256 of file RealSenseSensor.cpp.

References cloudViewer::t::geometry::RGBDImage::color_, cloudViewer::t::io::RGBDVideoMetadata::color_dt_, cloudViewer::t::geometry::RGBDImage::depth_, cloudViewer::t::io::RGBDVideoMetadata::depth_dt_, error(), and LogError.

Referenced by cloudViewer::t::io::pybind_sensor().

◆ EnumerateDevices()

std::vector< RealSenseValidConfigs > cloudViewer::t::io::RealSenseSensor::EnumerateDevices ( )
static

Query all connected RealSense cameras for their capabilities.

Returns
A list of devices and their supported capabilities.

Definition at line 46 of file RealSenseSensor.cpp.

References context, format, patch::to_string(), and cloudViewer::t::io::RealSenseValidConfigs::valid_configs.

Referenced by ListDevices(), and cloudViewer::t::io::pybind_sensor().

◆ GetFilename()

virtual std::string cloudViewer::t::io::RealSenseSensor::GetFilename ( ) const
inlineoverridevirtual

Get filename being written.

Implements cloudViewer::t::io::RGBDSensor.

Definition at line 111 of file RealSenseSensor.h.

Referenced by cloudViewer::t::io::pybind_sensor().

◆ GetMetadata()

virtual const RGBDVideoMetadata& cloudViewer::t::io::RealSenseSensor::GetMetadata ( ) const
inlineoverridevirtual

Get metadata of the RealSense video capture.

Implements cloudViewer::t::io::RGBDSensor.

Definition at line 106 of file RealSenseSensor.h.

Referenced by cloudViewer::t::io::pybind_sensor().

◆ GetTimestamp()

virtual uint64_t cloudViewer::t::io::RealSenseSensor::GetTimestamp ( ) const
inlineoverridevirtual

◆ InitSensor() [1/2]

bool cloudViewer::t::io::RealSenseSensor::InitSensor ( const RealSenseSensorConfig sensor_config = RealSenseSensorConfig{},
size_t  sensor_index = 0,
const std::string &  filename = "" 
)
virtual

Initialize sensor (optional).

Configure sensor with custom settings. If this is skipped, default settings will be used. You can enable recording to a bag file by specifying a filename.

Parameters
sensor_configCamera configuration, such as resolution and framerate. A serial number can be entered here to connect to a specific camera.
sensor_indexConnect to a camera at this position in the enumeration of RealSense cameras that are currently connected. Use EnumerateDevices() or ListDevices() to obtain a list of connected cameras. This is ignored if sensor_config contains a serial entry.
filenameSave frames to a bag file
Returns
true if a camera was found and initialized with the given settings, else false.

Definition at line 125 of file RealSenseSensor.cpp.

References cloudViewer::t::io::RealSenseSensorConfig::config_, context, cloudViewer::t::io::RGBDVideoMetadata::ConvertFromJsonValue(), cloudViewer::t::io::RealSenseSensorConfig::ConvertToNativeConfig(), cloudViewer::utility::filesystem::DirectoryExists(), cloudViewer::utility::filesystem::FileExists(), filename, cloudViewer::utility::filesystem::GetFileParentDirectory(), cloudViewer::t::io::RealSenseSensorConfig::GetMetadataJson(), cloudViewer::t::io::RealSenseSensorConfig::GetPixelDtypes(), LogError, cloudViewer::utility::filesystem::MakeDirectoryHierarchy(), and profile.

Referenced by InitSensor(), and cloudViewer::t::io::pybind_sensor().

◆ InitSensor() [2/2]

virtual bool cloudViewer::t::io::RealSenseSensor::InitSensor ( const RGBDSensorConfig sensor_config,
size_t  sensor_index = 0,
const std::string &  filename = "" 
)
inlineoverridevirtual

Initialize sensor (optional).

Configure sensor with custom settings. If this is skipped, default settings will be used. You can enable recording to a file by specifying a filename.

Parameters
sensor_configCamera configuration, such as resolution and framerate. A serial number can be entered here to connect to a specific camera.
sensor_indexConnect to a camera at this position in the enumeration of RealSense cameras that are currently connected. Use EnumerateDevices() or ListDevices() to obtain a list of connected cameras and their capabilities. This is ignored if sensor_config contains a "serial" entry.
filenameSave frames to this file.
Returns
true if a camera was found and initialized with the given settings, else false.

Implements cloudViewer::t::io::RGBDSensor.

Definition at line 64 of file RealSenseSensor.h.

References filename, and InitSensor().

◆ ListDevices()

bool cloudViewer::t::io::RealSenseSensor::ListDevices ( )
static

List all RealSense cameras connected to the system along with their capabilities. Use this listing to select an appropriate configuration for a camera.

Definition at line 24 of file RealSenseSensor.cpp.

References EnumerateDevices(), LogInfo, and LogWarning.

Referenced by cloudViewer::t::io::pybind_sensor().

◆ operator=()

RealSenseSensor& cloudViewer::t::io::RealSenseSensor::operator= ( const RealSenseSensor )
delete

◆ PauseRecord()

void cloudViewer::t::io::RealSenseSensor::PauseRecord ( )
overridevirtual

Pause recording to the bag file.

Warning
If this is called immediately after StartCapture(), the bag file may have an incorrect end time.

Implements cloudViewer::t::io::RGBDSensor.

Definition at line 228 of file RealSenseSensor.cpp.

References LogDebug.

Referenced by cloudViewer::t::io::pybind_sensor().

◆ ResumeRecord()

void cloudViewer::t::io::RealSenseSensor::ResumeRecord ( )
overridevirtual

Resume recording to the bag file. The file will contain discontinuous segments.

Implements cloudViewer::t::io::RGBDSensor.

Definition at line 235 of file RealSenseSensor.cpp.

References error(), LogDebug, and LogError.

Referenced by cloudViewer::t::io::pybind_sensor().

◆ StartCapture()

bool cloudViewer::t::io::RealSenseSensor::StartCapture ( bool  start_record = false)
overridevirtual

Start capturing synchronized depth and color frames.

Parameters
start_recordstart recording to the specified bag file as well.

Implements cloudViewer::t::io::RGBDSensor.

Definition at line 198 of file RealSenseSensor.cpp.

References cloudViewer::t::io::RGBDVideoMetadata::ConvertFromJsonValue(), error(), cloudViewer::t::io::RealSenseSensorConfig::GetMetadataJson(), cloudViewer::t::io::RealSenseSensorConfig::GetPixelDtypes(), LogError, LogInfo, LogWarning, and profile.

Referenced by cloudViewer::t::io::pybind_sensor().

◆ StopCapture()

void cloudViewer::t::io::RealSenseSensor::StopCapture ( )
overridevirtual

Stop capturing frames.

Implements cloudViewer::t::io::RGBDSensor.

Definition at line 289 of file RealSenseSensor.cpp.

References LogInfo.

Referenced by cloudViewer::t::io::pybind_sensor(), and ~RealSenseSensor().

◆ ToString()

virtual const std::string cloudViewer::t::io::RGBDSensor::ToString
inline

Text Description.

Definition at line 81 of file RGBDSensor.h.

Referenced by cloudViewer::t::io::pybind_sensor().


The documentation for this class was generated from the following files: