ImFusion SDK 4.3
RealSenseStream Class Reference

#include <RGBD/Include/ImFusion/RGBD/RealSenseStream.h>

Provides a stream interface for Intel RealSense RGB-D sensors. More...

+ Inheritance diagram for RealSenseStream:

Detailed Description

Provides a stream interface for Intel RealSense RGB-D sensors.

This class enables device enumeration, configuration, calibration management, and frame acquisition for a wide range of RealSense-compatible devices. It supports multiple streams (depth, color, infrared, fisheye, tracking), advanced property control, and hardware synchronization.

Typical usage involves enumerating available devices, opening a stream, configuring parameters, and acquiring synchronized depth and color frames.

if (!streams.empty())
{
auto& stream = streams.front();
stream->open();
// Acquire images, configure parameters, etc.
stream->close();
}
std::vector< Stream > streams()
Returns the currently active streams.
static std::vector< std::unique_ptr< RealSenseStream > > enumerate(bool initDefault=true)
Enumerates available RealSense devices and returns them as unique pointers.
Note
  • Supports multiple RealSense sensor models and stream types.
  • Calibration and advanced property control are available.
  • Not thread-safe.
See also
RGBDStream, TrackingStream, SignalReceiver

Classes

struct  PropertyInfo
 Structure representing information about a property configuring the sensor. More...
 
struct  Range
 Structure representing a value range. More...
 

Public Types

enum class  Stream {
  Depth , Color , Infrared , Infrared2 ,
  Fisheye , Tracking
}
 Supported stream types.
 
- Public Types inherited from RGBDStream
enum  PixelFormat {
  Rgb24 , Rgb32 , Depth16 , Gray8 ,
  Gray16 , Yuv422
}
 Pixel format enumeration for RGB-D frames. More...
 
- Public Types inherited from Stream
enum class  ThreadingMode { BaseClassRunsWorkerThread , DerivedClassHandlesThreading }
 This flag represents the two supported threading modes of a Stream. More...
 
enum class  State {
  Closed , Opening , Open , Starting ,
  Running , Pausing , Paused , Resuming ,
  Stopping , Closing
}
 
- Public Types inherited from Data
enum  Kind {
  UNKNOWN = 0 , IMAGE = 1 , VOLUME = 2 , IMAGESET = 3 ,
  VOLUMESET = 4 , IMAGESTREAM = 5 , VOLUMESTREAM = 6 , POINTSET = 7 ,
  SURFACE = 8 , TRACKINGSTREAM = 9 , LIVETRACKINGSTREAM = TRACKINGSTREAM , TRACKINGDATA = 10 ,
  TREE = 11 , TENSOR = 12 , POLYDATASTREAM = 13 , STEREOIMAGESET = 14 ,
  STEREOIMAGESTREAM = 15 , VOLUMETRICMESH = 16
}
 Kind of data. More...
 
enum  Modality {
  NA = 0 , XRAY = 1 , CT = 2 , MRI = 3 ,
  ULTRASOUND = 4 , VIDEO = 5 , NM = 6 , OCT = 7 ,
  LABEL = 8 , DISTANCE = 9
}
 Image modality of the data. More...
 

Public Member Functions

 RealSenseStream (const std::string &serial, bool initDefault=true)
 Constructs a stream for the specified sensor serial.
 
 ~RealSenseStream ()
 Destroys the stream and releases resources.
 
std::string serialNumber () const override
 Returns the serial number of the device.
 
std::vector< std::pair< int, std::string > > presets () const
 Returns available presets for sensor configuration.
 
int preset () const
 Returns the current preset.
 
bool setPreset (int preset)
 Sets the preset.
 
bool isValid () const
 Returns true if the sensor object is valid. False otherwise.
 
bool streamFormats (Stream stream, std::vector< FrameInfo > &formats)
 Returns supported formats for the given stream.
 
bool setStreamFormat (Stream stream, const FrameInfo &format)
 Sets the format for the given stream.
 
bool streamFormat (Stream stream, FrameInfo &format) const
 Returns the format for the given stream.
 
bool depthFormat (FrameInfo &format) const override
 Returns the current depth format.
 
bool colorFormat (FrameInfo &format) const override
 Returns the current color format.
 
bool depthFormats (std::vector< FrameInfo > &formats) override
 Returns supported depth formats.
 
bool colorFormats (std::vector< FrameInfo > &formats) override
 Returns supported color formats.
 
bool setDepthFormat (const FrameInfo &format) override
 Sets the depth format.
 
bool setColorFormat (const FrameInfo &format) override
 Sets the color format.
 
bool supportsColor () const override
 Returns true if the device supports color images.
 
std::string uuid () override
 Returns the device UUID.
 
std::string name () const override
 Returns the device name.
 
bool supportsAutoWhiteBalance () const override
 Returns true if auto white balance is supported.
 
bool setAutoWhiteBalanceEnabled (bool enable) override
 Enables or disables auto white balance.
 
bool isAutoWhiteBalanceEnabled () const override
 Returns true if auto white balance is enabled.
 
bool supportsAutoExposure () const override
 Returns true if auto exposure is supported.
 
bool setAutoExposureEnabled (bool enable) override
 Enables or disables auto exposure.
 
bool isAutoExposureEnabled () const override
 Returns true if auto exposure is enabled.
 
bool isExposureSupported () const override
 Returns true if exposure is supported.
 
bool setExposure (int value) override
 Sets the exposure value.
 
int exposure () const override
 Returns the current exposure value.
 
bool isGainSupported () const override
 Returns true if gain is supported.
 
bool setGain (int value) const
 Sets the gain value.
 
int gain () const override
 Returns the current gain value.
 
bool isMeanIntensitySetPointSupported () const
 Returns true if mean intensity set point is supported.
 
bool setMeanIntensitySetPoint (int value) const
 Sets the mean intensity set point.
 
int meanIntensitySetPoint () const
 Returns the mean intensity set point.
 
PropertyInfo meanIntensitySetPointInfo () const
 Returns property info for mean intensity set point.
 
bool isColorBackLightCompensationSupported () const
 Returns true if color back light compensation is supported.
 
bool setColorBackLightCompensation (bool enable)
 Enables or disables color back light compensation.
 
bool colorBackLightCompensation () const
 Returns true if color back light compensation is enabled.
 
bool isColorBrightnessSupported () const
 Returns true if color brightness is supported.
 
bool setColorBrightness (int value)
 Sets the color brightness.
 
int colorBrightness () const
 Returns the color brightness.
 
PropertyInfo colorBrightnessInfo () const
 Returns property info for color brightness.
 
bool isColorContrastSupported () const
 Returns true if color contrast is supported.
 
bool setColorContrast (int value)
 Sets the color contrast.
 
int colorContrast () const
 Returns the color contrast.
 
PropertyInfo colorContrastInfo () const
 Returns property info for color contrast.
 
bool isColorExposureSupported () const
 Returns true if color exposure is supported.
 
bool setColorExposure (int value)
 Sets the color exposure.
 
int colorExposure () const
 Returns the color exposure.
 
PropertyInfo colorExposureInfo () const
 Returns property info for color exposure.
 
bool setColorAutoExposure (bool enable)
 Enables or disables color auto exposure.
 
bool colorAutoExposure () const
 Returns true if color auto exposure is enabled.
 
bool isColorGainSupported () const
 Returns true if color gain is supported.
 
bool setColorGain (int value)
 Sets the color gain.
 
int colorGain () const
 Returns the color gain.
 
PropertyInfo colorGainInfo () const
 Returns property info for color gain.
 
bool isColorHueSupported () const
 Returns true if color hue is supported.
 
bool setColorHue (int value)
 Sets the color hue.
 
int colorHue () const
 Returns the color hue.
 
PropertyInfo colorHueInfo () const
 Returns property info for color hue.
 
bool isColorGammaSupported () const
 Returns true if color gamma is supported.
 
bool setColorGamma (int value)
 Sets the color gamma.
 
int colorGamma () const
 Returns the color gamma.
 
PropertyInfo colorGammaInfo () const
 Returns property info for color gamma.
 
bool isColorSaturationSupported () const
 Returns true if color saturation is supported.
 
bool setColorSaturation (int value)
 Sets the color saturation.
 
int colorSaturation () const
 Returns the color saturation.
 
PropertyInfo colorSaturationInfo () const
 Returns property info for color saturation.
 
bool isColorSharpnessSupported () const
 Returns true if color sharpness is supported.
 
bool setColorSharpness (int value)
 Sets the color sharpness.
 
int colorSharpness () const
 Returns the color sharpness.
 
PropertyInfo colorSharpnessInfo () const
 Returns property info for color sharpness.
 
bool isColorWhiteBalanceSupported () const
 Returns true if color white balance is supported.
 
bool setColorWhiteBalance (int value)
 Sets the color white balance.
 
int colorWhiteBalance () const
 Returns the color white balance.
 
PropertyInfo colorWhiteBalanceInfo () const
 Returns property info for color white balance.
 
bool setColorAutoWhiteBalance (bool enable)
 Enables or disables color auto white balance.
 
bool colorAutoWhiteBalance () const
 Returns true if color auto white balance is enabled.
 
bool isInfraredExposureSupported () const
 Returns true if infrared exposure is supported.
 
bool setInfraredExposure (int value)
 Sets the infrared exposure.
 
int infraredExposure () const
 Returns the infrared exposure.
 
PropertyInfo infraredExposureInfo () const
 Returns property info for infrared exposure.
 
bool isInfraredAutoExposureSupported () const
 Returns true if infrared auto exposure is supported.
 
bool setInfraredAutoExposure (bool enable)
 Enables or disables infrared auto exposure.
 
bool infraredAutoExposure () const
 Returns true if infrared auto exposure is enabled.
 
bool isInfraredGainSupported () const
 Returns true if infrared gain is supported.
 
bool setInfraredGain (int value)
 Sets the infrared gain.
 
int infraredGain () const
 Returns the infrared gain.
 
PropertyInfo infraredGainInfo () const
 Returns property info for infrared gain.
 
bool hasEmitter () const
 Returns true if the device has an emitter.
 
bool setEmitterEnabled (bool value)
 Enables or disables the emitter.
 
bool emitterEnabled () const
 Returns true if the emitter is enabled.
 
bool isLaserPowerSupported () const
 Returns true if laser power is supported.
 
bool setLaserPower (float value)
 Sets the laser power.
 
float laserPower () const
 Returns the laser power.
 
PropertyInfo laserPowerInfo () const
 Returns property info for laser power.
 
bool isDepthUnitsSupported () const
 Returns true if depth units are supported.
 
bool setDepthUnits (float value)
 Sets the depth units.
 
float depthUnits () const
 Returns the depth units.
 
PropertyInfo depthUnitsInfo () const
 Returns property info for depth units.
 
bool isDisparityShiftSupported () const
 Returns true if disparity shift is supported.
 
bool setDisparityShift (int value)
 Sets the disparity shift.
 
int disparityShift () const
 Returns the disparity shift.
 
PropertyInfo disparityShiftInfo () const
 Returns property info for disparity shift.
 
double minDistance () const
 Returns the minimum measurable distance.
 
double maxDistance () const
 Returns the maximum measurable distance.
 
bool depthK (mat3 &K) const override
 Returns the intrinsics of the depth camera.Please note that the sensor must be opened at the time of calling of this function.
 
bool colorK (mat3 &K) const override
 Returns the intrinsics of the color camera. Please note that the sensor must be opened at the time of calling of this function.
 
bool depthToColorT (mat4 &T) const override
 Returns the transformation from depth to color camera. Please note that the sensor must be opened at the time of calling of this function.
 
bool streamIntrinsics (Stream stream, mat3 &K)
 Returns the intrinsics of the specified stream. Please note that the sensor must be opened at the time of calling of this function.
 
bool streamExtrinsics (Stream streamFrom, Stream streamTo, mat4 &T)
 Returns the extrinsics between two streams. Please note that the sensor must be opened at the time of calling of this function.
 
int depthImageWidth () const override
 Returns the width of the depth image.
 
int depthImageHeight () const override
 Returns the height of the depth image.
 
int colorImageWidth () const override
 Returns the width of the color image.
 
int colorImageHeight () const override
 Returns the height of the color image.
 
bool supportsMotionDevice () const
 Returns true if a motion device is supported.
 
bool enableMotionDevice (bool enable)
 Enables or disables the motion device.
 
bool isMotionDeviceEnabled () const
 Returns true if the motion device is enabled.
 
std::vector< StreamsupportedStreams ()
 Returns the supported stream types.
 
bool setStreams (const std::vector< Stream > &streams)
 Specifies which streams should be captured. lease note, that this call resets stream formats.
 
std::vector< Streamstreams ()
 Returns the currently active streams.
 
bool selectDefaultFrameFormat () override
 Selects the default format for each stream. Please note, that setStreams should be called first in order this function to have an effect.
 
bool grabImage (float *depthData, unsigned char *colorData, int timeOut=500) override
 Grabs a synchronized depth and color image.
 
bool saveCalibration (Properties *p) const override
 Saves the current calibration to a Properties object.
 
bool loadConfig (const std::string &config)
 Loads configuration from a file.
 
void configure (const Properties *p)
 Configures the stream from a Properties object.
 
void configuration (Properties *p) const
 Writes the current configuration to a Properties object.
 
std::vector< TrackingInstrumentdevices () const override
 Returns the list of tracking instruments.
 
void setApplyFiltersToDisparity (bool value)
 Enables or disables application of filters to disparity.
 
bool applyFiltersToDisparity () const
 
void setApplySpatialFilter (bool value)
 Enables or disables spatial filtering.
 
bool applySpatialFilter () const
 
void setApplyTemporalFilter (bool value)
 Enables or disables temporal filtering.
 
bool applyTemporalFilter () const
 
bool filtersSupported () const
 Returns true if filters are supported.
 
bool customConfigSupported () const
 Returns true if custom configuration is supported.
 
bool setSynchronizationMode (int v)
 Sets the hardware synchronization mode.
 
int synchronizationMode ()
 
- Public Member Functions inherited from RGBDStream
virtual bool grabSingleFrame ()
 Grabs a single RGBD frame.
 
virtual bool isOpen () const
 
virtual std::string firmwareVersion () const
 
 RGBDStream (const std::string &name="")
 
virtual bool setGain (int value)
 
virtual bool usingFactoryCalibration () const
 Returns true when the sensor has a per-sensor factory calibration and it is currently being used.
 
virtual bool depthDist (Eigen::Matrix< double, 5, 1 > &dist) const
 Retrieve depth camera distortion parameters if available.
 
virtual bool dropCorruptDepthData (bool &drop) const
 
virtual bool setDropCorruptDepthData (bool drop)
 
virtual bool colorDist (Eigen::Matrix< double, 5, 1 > &dist) const
 Retrieve color camera distortion parameters if available.
 
virtual bool setDepthK (const mat3 &K)
 
virtual bool setDepthDist (const Eigen::Matrix< double, 5, 1 > &dist)
 
virtual bool setColorK (const mat3 &K)
 
virtual bool setColorDist (const Eigen::Matrix< double, 5, 1 > &dist)
 
virtual bool setDepthToColorT (const mat4 &T)
 
virtual bool setLaserState (bool enable)
 
virtual bool laserState () const
 
virtual bool supportsSingleFrameGrab () const
 Returns if the stream supports single frame capture model; set false by default.
 
virtual bool startOnImport () const
 Returns if the stream shall be started on import; set true by default.
 
virtual bool loadCalibration (const Properties *p)
 
virtual bool createDefaultStreamController () override final
 Indicates whether a StreamController should be created for the stream.
 
std::unique_ptr< RGBDDataComponentgetRGBDDataComponentCopy ()
 Returns the copy of the RGBDDataComponent. If it wasn't present before, it is added and updated.
 
- Public Member Functions inherited from ImageStream
 ImageStream (const std::string &name="")
 
Data::Kind kind () const override final
 Returns the kind (typically IMAGESTREAM or VOLUMESTREAM)
 
void setModality (Modality m)
 Set the modality descriptor of this stream.
 
Modality modality () const override final
 Return the modality of this stream.
 
virtual bool topDown () const
 Specify whether the first line of the image data is to be displayed on top.
 
int size () const override
 Returns the number of images of the image stream per emission.
 
std::string describe () const override
 Short description of the stream including latest state and update rate information.
 
- Public Member Functions inherited from Stream
 Stream (const std::string &name="")
 Constructor with the name for this stream.
 
virtual ThreadingMode threadingMode () const
 Configures threading mode of stream.
 
virtual bool supportsAsyncOperation ()
 Returns true if xxxAsync() methods support execution in a background thread.
 
std::shared_future< bool > openAsync ()
 Open stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
 
std::shared_future< bool > closeAsync ()
 Close stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
 
std::shared_future< bool > startAsync ()
 Start stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
 
std::shared_future< bool > stopAsync ()
 Stop stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
 
std::shared_future< bool > pauseAsync ()
 Pause stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
 
std::shared_future< bool > resumeAsync ()
 Resume stream in an asynchronous fashion (wait on the returned future before taking further actions). Returns whether the operation was successful.
 
bool open ()
 Open stream and wait for the operation to complete. Returns whether the operation was successful.
 
bool close ()
 Close stream and wait for the operation to complete. Returns whether the operation was successful.
 
bool start ()
 Start stream and wait for the operation to complete. Returns whether the operation was successful.
 
bool stop ()
 Stop stream and wait for the operation to complete. Returns whether the operation was successful.
 
bool pause ()
 Pause stream and wait for the operation to complete. Returns whether the operation was successful.
 
bool resume ()
 Resume stream and wait for the operation to complete. Returns whether the operation was successful.
 
virtual bool supportsPausing () const
 Override and return true if this stream implements the pausing and resume operations.
 
bool restart ()
 Stops, closes, opens and starts the stream. Returns whether the operation was successful.
 
virtual bool reset ()
 Reverts stream to first frame, if possible. Returns whether the operation was successful.
 
virtual bool isRunning () const
 Return whether stream is currently running.
 
State currentState () const
 
bool isStateOneOf (const std::vector< State > &states) const
 
Geometry::AlignedBox bounds () const override
 Per default a Stream has empty/invalid bounds.
 
Pose::TransformationConvention matrixConvention () const override
 Matrices of streams by default map to the world coordinate system.
 
double updateRate () const
 Average update rate in Hz of the signalStreamData.
 
- Public Member Functions inherited from Data
 Data (const std::string &name="")
 
 Data (const Data &other)
 
Dataoperator= (const Data &other)
 
virtual ~Data ()
 Mandatory virtual destructor.
 
const std::stringname () const
 Return the name of this data.
 
void setName (const std::string &name)
 Sets the name of this data.
 
virtual bool isAnnotationType () const
 Return whether this data type is visualized through an annotation (e.g. mesh)
 
const DataComponentListcomponents () const
 Returns the list of DataComponents for this data.
 
DataComponentListcomponents ()
 
virtual void setMatrixFromWorld (const mat4 &m)
 Set matrix mapping from the world coordinate system to the data coordinate system.
 
virtual void setMatrixToWorld (const mat4 &m)
 Set matrix mapping from the data coordinate system to the world coordinate system.
 
virtual mat4 matrixFromWorld () const
 Get matrix mapping from the world coordinate system to the data coordinate system.
 
virtual mat4 matrixToWorld () const
 Get matrix mapping from the data coordinate system to the world coordinate system.
 
virtual mat4 matrix () const
 Return the transformation matrix.
 
virtual void setMatrix (const mat4 &m)
 Set the transformation matrix.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 
- Public Member Functions inherited from Selectable
 Selectable (const Selectable &)
 
 Selectable (Selectable &&)
 
Selectableoperator= (const Selectable &)
 
Selectableoperator= (Selectable &&)
 
virtual Selection selection () const
 
virtual int focus () const
 
virtual void setSelection (const Selection &sel)
 Set the underlying selection.
 
virtual void setFocus (int index)
 Set focus of the selection.
 
- Public Member Functions inherited from TrackingStream
 TrackingStream (const std::string &name="Tracking Stream")
 
virtual std::vector< TrackingInstrumentinstruments () const
 Returns a copy of all tracking instruments (active and inactive) with their last status.
 
virtual std::vector< TrackingInstrumentactiveInstruments () const
 Returns a copy of all active tracking instruments with their last status.
 
virtual int numInstruments (bool activeOnly=false) const
 Returns the number of instruments (all or only active instruments).
 
Kind kind () const override
 Returns the kind of stream.
 
void setMainInstrument (unsigned int index)
 Sets the index of the main tracking target.
 
virtual bool supportsMainInstrumentSelection () const
 Returns true if main instrument can be set from outside.
 
void setMainInstrumentById (const std::string &id)
 Sets the main tracking target by the ID of the TrackingInstrument (TrackerID::m_id).
 
unsigned int mainInstrumentIndex () const
 Returns the index of the main tracking target in the instruments array.
 
std::string mainInstrumentId () const
 Returns the unique ID of the main instrument.
 
std::string mainInstrumentName () const
 Returns the name of the main instrument.
 
virtual bool supportsInstrumentRenaming () const
 Returns true if the name of an instrument can be set from outside.
 
void setInstrumentName (const std::string &id, const std::string &name)
 Sets the name of the TrackingInstrument for the specified id.
 
void setInstrumentActive (const std::string &id, bool active)
 Sets the tracking instrument with the given ID as either active or inactive.
 
bool isInstrumentActive (const std::string &id) const
 Returns whether the instrument with the given ID is active.
 
std::optional< TrackingInstrumentqueryInstrument (const std::string &id) const
 Queries the instrument with the given ID from m_instruments.
 
std::string describe () const override
 Provides a short description of the stream, including the number of instruments, latest stream state, and update rate information.
 
- Public Member Functions inherited from SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
 
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
 
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.
 

Static Public Member Functions

static RealSenseStreamcreateFromSerial (const std::string &serial, bool initDefault=true)
 Creates a stream from the sensor serial.
 
static std::string streamName (Stream s)
 Returns the name of the stream type.
 
static int enumerateDevices (std::vector< RealSenseStream * > &sensors, bool initDefault=true)
 Enumerates available RealSense devices (deprecated, use enumerate()).
 
static std::vector< std::unique_ptr< RealSenseStream > > enumerate (bool initDefault=true)
 Enumerates available RealSense devices and returns them as unique pointers.
 
- Static Public Member Functions inherited from Stream
static std::string stateToString (State state)
 
- Static Public Member Functions inherited from Data
static std::string modalityString (Data::Modality m)
 Return the name of an image modality.
 
static Data::Modality stringToModality (const std::string &s)
 Returns the modality corresponding to a modality string or NA if nothing matches.
 

Public Attributes

Signal disconnected
 Signal emitted when the sensor gets disconnected.
 
- Public Attributes inherited from ImageStream
Signal< Data::KindsignalKindChanged
 Is emitted when the stream changes between IMAGESTREAM and VOLUMESTREAM, before the next ImageStreamData is emitted.
 
- Public Attributes inherited from Stream
ProtectedSignal< StateChangesignalStateChanged
 Emitted after a state change has been completed with the old and new state.
 
ProtectedSignal signalEnded
 Indicates that the stream reached the end of its data, e.g. when a video stream has played to the end.
 
ProtectedSignal< std::shared_ptr< const StreamData > > signalStreamData
 Signal that is emitted by the stream when a new StreamData is available.
 
DeprecatedSignal< ProtectedSignal< std::shared_ptr< const StreamData > >, const StreamData & > signalNewData
 Signal that is emitted by the stream when a new StreamData is available.
 
- Public Attributes inherited from Data
Signal< const Data * > signalDeleted
 Signal emitted when this instance is deleted.
 
Signal< const Data * > signalMatrixChanged
 Signal emitted when the transformation of this Data has changed.
 
Signal< std::stringsignalNameChanged
 Signal emitted when the name changed.
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Public Attributes inherited from Selectable
ProtectedSignal signalSelectionChanged
 Signals that the selection or size might have changed.
 
- Public Attributes inherited from TrackingStream
ProtectedSignalsignalTrackingDevicesUpdated
 Emitted when the list of instruments is updated.
 
ProtectedSignal signalInstrumentsUpdated
 Emitted when the list of instruments is altered (instrument added, instrument removed, or list cleared).
 
ProtectedSignal< const std::string & > signalMainInstrumentChanged
 Emitted when the main instrument has changed, with the new instrument ID.
 

Protected Member Functions

bool defaultColorResolution (int &width, int &height) override
 Returns the default color resolution.
 
bool defaultDepthResolution (int &width, int &height) override
 Returns the default depth resolution.
 
void computeCalibration ()
 Computes the calibration.
 
bool openImpl () override
 Opens the sensor.
 
bool closeImpl () override
 Close stream.
 
bool startImpl () override
 Start stream.
 
bool stopImpl () override
 Stop stream.
 
std::optional< WorkContinuationdoWork () override
 Create one StreamData and publish it (this function will be called at the desired frame rate) If this is not desired, you can do the following: return std::nullopt;.
 
- Protected Member Functions inherited from RGBDStream
virtual void onRGBDDataComponentChanged ()
 Called when the RGBDDataComponent changes.
 
- Protected Member Functions inherited from ImageStream
void setKind (Kind k)
 Sets the kind (typically IMAGESTREAM or VOLUMESTREAM) and emits signalKindChanged.
 
bool workerThreadRequiresOpenGl () const override
 Ensure the thread has an GL context before the main loop starts.
 
- Protected Member Functions inherited from Stream
virtual bool pauseImpl ()
 Pause stream (not required to be supported).
 
virtual bool resumeImpl ()
 Resume stream from pause (only required to be supported when pauseImpl() is supported).
 
virtual bool worksWhilePaused () const
 Override if doWork() should be called also in the Paused state.
 
void changeState (State newState)
 
std::shared_future< bool > attemptStateChange (std::function< bool()> work, State stateWorking, State stateSuccess, State stateError)
 
- Protected Member Functions inherited from Data
void swapWith (Data &other)
 Swaps the data and emits a matrix and name changed signal for both.
 
- Protected Member Functions inherited from TrackingStream
void emitSignals (const InstrumentUpdate &update)
 Convenience method to be called after any instrument modification.
 
std::unique_ptr< TrackingStreamDatacreateTrackingStreamData ()
 Creates the TrackingStreamData with a copy of all instruments and sets the timestamps.
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 

Static Protected Member Functions

static bool supportedByOS ()
 Returns true if the sensor is supported by the OS.
 

Additional Inherited Members

- Protected Attributes inherited from Data
mat4 m_matrix
 Transformation matrix.
 
std::recursive_mutexm_matrixMutex
 Used to internally synchronize access to the matrix of data.
 
DataComponentList m_dataComponentList
 The list of DataComponents for this data.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 
- Protected Attributes inherited from Selectable
std::mutex m_selectionMutex
 Mutex protecting the selection.
 
Selection m_sel
 
- Protected Attributes inherited from TrackingStream
std::unique_ptr< ThreadSafeInstrumentsBasem_instruments
 Container for TrackingInstruments of this tracking stream.
 

Constructor & Destructor Documentation

◆ RealSenseStream()

RealSenseStream ( const std::string & serial,
bool initDefault = true )

Constructs a stream for the specified sensor serial.

Parameters
serialSerial number of the sensor.
initDefaultIf true, initializes with default streams and formats.

Member Function Documentation

◆ createFromSerial()

static RealSenseStream * createFromSerial ( const std::string & serial,
bool initDefault = true )
static

Creates a stream from the sensor serial.

Parameters
serialSerial number of the sensor.
initDefaultIf true, initializes with default streams and formats.
Returns
Pointer to RealSenseStream if successful, nullptr otherwise.

◆ enumerateDevices()

static int enumerateDevices ( std::vector< RealSenseStream * > & sensors,
bool initDefault = true )
static

Enumerates available RealSense devices (deprecated, use enumerate()).

Parameters
sensorsVector to be filled with new sensors.
initDefaultIf true, initializes with default streams and formats.
Deprecated
"Use enumerate() instead, which makes ownership explicit"

◆ serialNumber()

std::string serialNumber ( ) const
overridevirtual

Returns the serial number of the device.

Reimplemented from RGBDStream.

◆ depthFormat()

bool depthFormat ( FrameInfo & format) const
overridevirtual

Returns the current depth format.

Reimplemented from RGBDStream.

◆ colorFormat()

bool colorFormat ( FrameInfo & format) const
overridevirtual

Returns the current color format.

Reimplemented from RGBDStream.

◆ depthFormats()

bool depthFormats ( std::vector< FrameInfo > & formats)
overridevirtual

Returns supported depth formats.

Reimplemented from RGBDStream.

◆ colorFormats()

bool colorFormats ( std::vector< FrameInfo > & formats)
overridevirtual

Returns supported color formats.

Reimplemented from RGBDStream.

◆ setDepthFormat()

bool setDepthFormat ( const FrameInfo & format)
overridevirtual

Sets the depth format.

Reimplemented from RGBDStream.

◆ setColorFormat()

bool setColorFormat ( const FrameInfo & format)
overridevirtual

Sets the color format.

Reimplemented from RGBDStream.

◆ supportsColor()

bool supportsColor ( ) const
overridevirtual

Returns true if the device supports color images.

Implements RGBDStream.

◆ uuid()

std::string uuid ( )
overridevirtual

Returns the device UUID.

Implements Stream.

◆ name()

std::string name ( ) const
overridevirtual

Returns the device name.

Reimplemented from RGBDStream.

◆ supportsAutoWhiteBalance()

bool supportsAutoWhiteBalance ( ) const
overridevirtual

Returns true if auto white balance is supported.

Reimplemented from RGBDStream.

◆ setAutoWhiteBalanceEnabled()

bool setAutoWhiteBalanceEnabled ( bool enable)
overridevirtual

Enables or disables auto white balance.

Reimplemented from RGBDStream.

◆ isAutoWhiteBalanceEnabled()

bool isAutoWhiteBalanceEnabled ( ) const
overridevirtual

Returns true if auto white balance is enabled.

Reimplemented from RGBDStream.

◆ supportsAutoExposure()

bool supportsAutoExposure ( ) const
overridevirtual

Returns true if auto exposure is supported.

Reimplemented from RGBDStream.

◆ setAutoExposureEnabled()

bool setAutoExposureEnabled ( bool enable)
overridevirtual

Enables or disables auto exposure.

Reimplemented from RGBDStream.

◆ isAutoExposureEnabled()

bool isAutoExposureEnabled ( ) const
overridevirtual

Returns true if auto exposure is enabled.

Reimplemented from RGBDStream.

◆ isExposureSupported()

bool isExposureSupported ( ) const
overridevirtual

Returns true if exposure is supported.

Reimplemented from RGBDStream.

◆ setExposure()

bool setExposure ( int value)
overridevirtual

Sets the exposure value.

Reimplemented from RGBDStream.

◆ exposure()

int exposure ( ) const
overridevirtual

Returns the current exposure value.

Reimplemented from RGBDStream.

◆ isGainSupported()

bool isGainSupported ( ) const
overridevirtual

Returns true if gain is supported.

Reimplemented from RGBDStream.

◆ gain()

int gain ( ) const
overridevirtual

Returns the current gain value.

Reimplemented from RGBDStream.

◆ depthK()

bool depthK ( mat3 & K) const
overridevirtual

Returns the intrinsics of the depth camera.Please note that the sensor must be opened at the time of calling of this function.

Reimplemented from RGBDStream.

◆ colorK()

bool colorK ( mat3 & K) const
overridevirtual

Returns the intrinsics of the color camera. Please note that the sensor must be opened at the time of calling of this function.

Reimplemented from RGBDStream.

◆ depthToColorT()

bool depthToColorT ( mat4 & T) const
overridevirtual

Returns the transformation from depth to color camera. Please note that the sensor must be opened at the time of calling of this function.

Reimplemented from RGBDStream.

◆ depthImageWidth()

int depthImageWidth ( ) const
overridevirtual

Returns the width of the depth image.

Implements RGBDStream.

◆ depthImageHeight()

int depthImageHeight ( ) const
overridevirtual

Returns the height of the depth image.

Implements RGBDStream.

◆ colorImageWidth()

int colorImageWidth ( ) const
overridevirtual

Returns the width of the color image.

Implements RGBDStream.

◆ colorImageHeight()

int colorImageHeight ( ) const
overridevirtual

Returns the height of the color image.

Implements RGBDStream.

◆ selectDefaultFrameFormat()

bool selectDefaultFrameFormat ( )
overridevirtual

Selects the default format for each stream. Please note, that setStreams should be called first in order this function to have an effect.

Reimplemented from RGBDStream.

◆ grabImage()

bool grabImage ( float * depthData,
unsigned char * colorData,
int timeOut = 500 )
overridevirtual

Grabs a synchronized depth and color image.

Reimplemented from RGBDStream.

◆ saveCalibration()

bool saveCalibration ( Properties * p) const
overridevirtual

Saves the current calibration to a Properties object.

Reimplemented from RGBDStream.

◆ configure()

void configure ( const Properties * p)
virtual

Configures the stream from a Properties object.

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
virtual

Writes the current configuration to a Properties object.

Reimplemented from Configurable.

◆ devices()

std::vector< TrackingInstrument > devices ( ) const
overridevirtual

Returns the list of tracking instruments.

Reimplemented from TrackingStream.

◆ setSynchronizationMode()

bool setSynchronizationMode ( int v)

Sets the hardware synchronization mode.

0 = default, 1 = sync master, 2 = sync slave

◆ defaultColorResolution()

bool defaultColorResolution ( int & width,
int & height )
overrideprotectedvirtual

Returns the default color resolution.

Reimplemented from RGBDStream.

◆ defaultDepthResolution()

bool defaultDepthResolution ( int & width,
int & height )
overrideprotectedvirtual

Returns the default depth resolution.

Reimplemented from RGBDStream.

◆ openImpl()

bool openImpl ( )
overrideprotectedvirtual

Opens the sensor.

Implements Stream.

◆ closeImpl()

bool closeImpl ( )
overrideprotectedvirtual

Close stream.

Returns whether the operation was successful. This method should be used to free any resources that were allocated during the openImpl() call and to disconnect from any devices. Implementers must ensure that all resources are properly released to avoid memory leaks.

Implements Stream.

◆ startImpl()

bool startImpl ( )
overrideprotectedvirtual

Start stream.

Returns whether the operation was successful. This method is intended to initiate the actual data readout process or to connect a callback function for data handling. Implementers should ensure that the stream is ready and producing data after this call.

Implements Stream.

◆ stopImpl()

bool stopImpl ( )
overrideprotectedvirtual

Stop stream.

Returns whether the operation was successful. This method should halt any ongoing data readouts or callbacks, effectively pausing the data flow to reduce CPU load. Implementers should ensure that the stream can be restarted after this call.

Implements Stream.

◆ doWork()

std::optional< WorkContinuation > doWork ( )
overrideprotectedvirtual

Create one StreamData and publish it (this function will be called at the desired frame rate) If this is not desired, you can do the following: return std::nullopt;.

Implements Stream.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close