ImFusion C++ SDK 4.4.0
ImFusion::RGBDStream Class Referenceabstract

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

Base class for RGB-D streams. More...

Inheritance diagram for ImFusion::RGBDStream:

Detailed Description

Base class for RGB-D streams.

Provides an abstract interface for RGB-D sensor streams, including configuration, frame acquisition, calibration, and device-specific controls.

Classes

struct  FrameInfo
 Structure describing frame format and resolution. More...

Public Types

enum  PixelFormat {
  Rgb24 , Rgb32 , Depth16 , Gray8 ,
  Gray16 , Yuv422
}
 Pixel format enumeration for RGB-D frames. More...
Public Types inherited from ImFusion::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 ImFusion::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

virtual bool depthFormats (std::vector< FrameInfo > &formats)
virtual bool colorFormats (std::vector< FrameInfo > &formats)
virtual bool depthFormat (FrameInfo &format) const
virtual bool colorFormat (FrameInfo &format) const
virtual bool setDepthFormat (const FrameInfo &format)
virtual bool setColorFormat (const FrameInfo &format)
virtual bool grabSingleFrame ()
 Grabs a single RGBD frame.
virtual bool isOpen () const
virtual std::string name () const
virtual std::string serialNumber () const
virtual std::string firmwareVersion () const
virtual bool isExposureSupported () const
virtual bool setExposure (int value)
virtual int exposure () const
 RGBDStream (const std::string &name="")
virtual bool supportsColor () const =0
virtual bool supportsAutoWhiteBalance () const
virtual bool setAutoWhiteBalanceEnabled (bool enable)
virtual bool isAutoWhiteBalanceEnabled () const
virtual bool supportsAutoExposure () const
virtual bool setAutoExposureEnabled (bool enable)
virtual bool isAutoExposureEnabled () const
virtual bool isGainSupported () const
virtual bool setGain (int value)
virtual int gain () const
virtual bool grabImage (float *depthData, unsigned char *colorData, int timeOut=500)
virtual bool usingFactoryCalibration () const
 Returns true when the sensor has a per-sensor factory calibration and it is currently being used.
virtual bool depthK (mat3 &K) const
 Retrieve depth camera intrinsics if available.
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 colorK (mat3 &K) const
 Retrieve color camera intrinsics if available.
virtual bool colorDist (Eigen::Matrix< double, 5, 1 > &dist) const
 Retrieve color camera distortion parameters if available.
virtual bool depthToColorT (mat4 &T) const
 Retrieve depth to color camera coordinate transformation 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 int depthImageWidth () const =0
virtual int depthImageHeight () const =0
virtual int colorImageWidth () const =0
virtual int colorImageHeight () const =0
virtual bool loadCalibration (const Properties *p)
virtual bool saveCalibration (Properties *p) const
virtual bool selectDefaultFrameFormat ()
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 ImFusion::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 ImFusion::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.
virtual std::string uuid ()
 Unique identifier for stream.
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.
std::string describe () const override
 Short description of the stream including latest state and update rate information.
Public Member Functions inherited from ImFusion::Data
 Data (const std::string &name="")
 Data (const Data &other)
Data & operator= (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 ImFusion::Configurable
virtual void configure (const Properties *p)
 Configure this object instance by de-serializing the given Properties.
virtual void configuration (Properties *p) const
 Serialize the current object configuration into the given Properties object.
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
Configurable & operator= (const Configurable &)
Configurable & operator= (Configurable &&) noexcept
Public Member Functions inherited from ImFusion::Selectable
 Selectable (const Selectable &)
 Selectable (Selectable &&)
Selectable & operator= (const Selectable &)
Selectable & operator= (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.

Protected Member Functions

virtual void onRGBDDataComponentChanged ()
 Called when the RGBDDataComponent changes.
virtual bool defaultColorResolution (int &width, int &height)
 Returns default color resolution.
virtual bool defaultDepthResolution (int &width, int &height)
 Returns default depth resolution.
Protected Member Functions inherited from ImFusion::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 ImFusion::Stream
virtual bool openImpl ()=0
 Open stream.
virtual bool closeImpl ()=0
 Close stream.
virtual bool startImpl ()=0
 Start stream.
virtual bool stopImpl ()=0
 Stop 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 std::optional< WorkContinuationdoWork ()=0
 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;.
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 ImFusion::Data
void swapWith (Data &other)
 Swaps the data and emits a matrix and name changed signal for both.

Additional Inherited Members

Static Public Member Functions inherited from ImFusion::Stream
static std::string stateToString (State state)
Static Public Member Functions inherited from ImFusion::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 inherited from ImFusion::ImageStream
Signal< Data::KindsignalKindChanged
 Is emitted when the stream changes between IMAGESTREAM and VOLUMESTREAM, before the next ImageStreamData is emitted.
Public Attributes inherited from ImFusion::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 ImFusion::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 ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
Public Attributes inherited from ImFusion::Selectable
ProtectedSignal signalSelectionChanged
 Signals that the selection or size might have changed.
Protected Attributes inherited from ImFusion::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 ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
Protected Attributes inherited from ImFusion::Selectable
std::mutex m_selectionMutex
 Mutex protecting the selection.
Selection m_sel

Member Enumeration Documentation

◆ PixelFormat

Pixel format enumeration for RGB-D frames.

Enumerator
Rgb24 

24-bit RGB

Rgb32 

32-bit RGB

Depth16 

16-bit depth

Gray8 

8-bit grayscale

Gray16 

16-bit grayscale

Yuv422 

YUV 4:2:2.

Member Function Documentation

◆ depthFormats()

virtual bool ImFusion::RGBDStream::depthFormats ( std::vector< FrameInfo > & formats)
inlinevirtual

◆ colorFormats()

virtual bool ImFusion::RGBDStream::colorFormats ( std::vector< FrameInfo > & formats)
inlinevirtual

◆ depthFormat()

virtual bool ImFusion::RGBDStream::depthFormat ( FrameInfo & format) const
inlinevirtual

◆ colorFormat()

virtual bool ImFusion::RGBDStream::colorFormat ( FrameInfo & format) const
inlinevirtual

◆ setDepthFormat()

virtual bool ImFusion::RGBDStream::setDepthFormat ( const FrameInfo & format)
inlinevirtual

◆ setColorFormat()

virtual bool ImFusion::RGBDStream::setColorFormat ( const FrameInfo & format)
inlinevirtual

◆ name()

virtual std::string ImFusion::RGBDStream::name ( ) const
inlinevirtual

◆ serialNumber()

virtual std::string ImFusion::RGBDStream::serialNumber ( ) const
inlinevirtual

◆ firmwareVersion()

virtual std::string ImFusion::RGBDStream::firmwareVersion ( ) const
inlinevirtual

Reimplemented in ImFusion::OrbbecRGBDStream.

◆ isExposureSupported()

virtual bool ImFusion::RGBDStream::isExposureSupported ( ) const
inlinevirtual

◆ setExposure()

virtual bool ImFusion::RGBDStream::setExposure ( int value)
inlinevirtual

◆ exposure()

virtual int ImFusion::RGBDStream::exposure ( ) const
inlinevirtual

◆ supportsColor()

virtual bool ImFusion::RGBDStream::supportsColor ( ) const
pure virtual

◆ supportsAutoWhiteBalance()

virtual bool ImFusion::RGBDStream::supportsAutoWhiteBalance ( ) const
inlinevirtual

◆ setAutoWhiteBalanceEnabled()

virtual bool ImFusion::RGBDStream::setAutoWhiteBalanceEnabled ( bool enable)
inlinevirtual

◆ isAutoWhiteBalanceEnabled()

virtual bool ImFusion::RGBDStream::isAutoWhiteBalanceEnabled ( ) const
inlinevirtual

◆ supportsAutoExposure()

virtual bool ImFusion::RGBDStream::supportsAutoExposure ( ) const
inlinevirtual

◆ setAutoExposureEnabled()

virtual bool ImFusion::RGBDStream::setAutoExposureEnabled ( bool enable)
inlinevirtual

◆ isAutoExposureEnabled()

virtual bool ImFusion::RGBDStream::isAutoExposureEnabled ( ) const
inlinevirtual

◆ isGainSupported()

virtual bool ImFusion::RGBDStream::isGainSupported ( ) const
inlinevirtual

◆ setGain()

virtual bool ImFusion::RGBDStream::setGain ( int value)
inlinevirtual

◆ gain()

virtual int ImFusion::RGBDStream::gain ( ) const
inlinevirtual

◆ grabImage()

virtual bool ImFusion::RGBDStream::grabImage ( float * depthData,
unsigned char * colorData,
int timeOut = 500 )
inlinevirtual

◆ usingFactoryCalibration()

virtual bool ImFusion::RGBDStream::usingFactoryCalibration ( ) const
inlinevirtual

Returns true when the sensor has a per-sensor factory calibration and it is currently being used.

Reimplemented in ImFusion::KinectAzureStream, and ImFusion::OpenNI2RGBDStream.

◆ depthK()

virtual bool ImFusion::RGBDStream::depthK ( mat3 & K) const
inlinevirtual

◆ depthDist()

virtual bool ImFusion::RGBDStream::depthDist ( Eigen::Matrix< double, 5, 1 > & dist) const
inlinevirtual

Retrieve depth camera distortion parameters if available.

Reimplemented in ImFusion::OpenNI2RGBDStream, and ImFusion::ROS::ROSTopicRGBDStream.

◆ dropCorruptDepthData()

virtual bool ImFusion::RGBDStream::dropCorruptDepthData ( bool & drop) const
inlinevirtual

Reimplemented in ImFusion::OpenNI2RGBDStream.

◆ setDropCorruptDepthData()

virtual bool ImFusion::RGBDStream::setDropCorruptDepthData ( bool drop)
inlinevirtual

Reimplemented in ImFusion::OpenNI2RGBDStream.

◆ colorK()

virtual bool ImFusion::RGBDStream::colorK ( mat3 & K) const
inlinevirtual

◆ colorDist()

virtual bool ImFusion::RGBDStream::colorDist ( Eigen::Matrix< double, 5, 1 > & dist) const
inlinevirtual

Retrieve color camera distortion parameters if available.

Reimplemented in ImFusion::OpenNI2RGBDStream, and ImFusion::ROS::ROSTopicRGBDStream.

◆ depthToColorT()

virtual bool ImFusion::RGBDStream::depthToColorT ( mat4 & T) const
inlinevirtual

◆ setDepthK()

virtual bool ImFusion::RGBDStream::setDepthK ( const mat3 & K)
inlinevirtual

Reimplemented in ImFusion::OpenNI2RGBDStream.

◆ setDepthDist()

virtual bool ImFusion::RGBDStream::setDepthDist ( const Eigen::Matrix< double, 5, 1 > & dist)
inlinevirtual

Reimplemented in ImFusion::OpenNI2RGBDStream.

◆ setColorK()

virtual bool ImFusion::RGBDStream::setColorK ( const mat3 & K)
inlinevirtual

Reimplemented in ImFusion::OpenNI2RGBDStream.

◆ setColorDist()

virtual bool ImFusion::RGBDStream::setColorDist ( const Eigen::Matrix< double, 5, 1 > & dist)
inlinevirtual

Reimplemented in ImFusion::OpenNI2RGBDStream.

◆ setDepthToColorT()

virtual bool ImFusion::RGBDStream::setDepthToColorT ( const mat4 & T)
inlinevirtual

Reimplemented in ImFusion::OpenNI2RGBDStream.

◆ setLaserState()

virtual bool ImFusion::RGBDStream::setLaserState ( bool enable)
inlinevirtual

◆ laserState()

virtual bool ImFusion::RGBDStream::laserState ( ) const
inlinevirtual

◆ depthImageWidth()

virtual int ImFusion::RGBDStream::depthImageWidth ( ) const
pure virtual

◆ depthImageHeight()

virtual int ImFusion::RGBDStream::depthImageHeight ( ) const
pure virtual

◆ colorImageWidth()

virtual int ImFusion::RGBDStream::colorImageWidth ( ) const
pure virtual

◆ colorImageHeight()

virtual int ImFusion::RGBDStream::colorImageHeight ( ) const
pure virtual

◆ loadCalibration()

virtual bool ImFusion::RGBDStream::loadCalibration ( const Properties * p)
inlinevirtual

Reimplemented in ImFusion::OpenNI2RGBDStream.

◆ saveCalibration()

virtual bool ImFusion::RGBDStream::saveCalibration ( Properties * p) const
inlinevirtual

◆ selectDefaultFrameFormat()

virtual bool ImFusion::RGBDStream::selectDefaultFrameFormat ( )
virtual

◆ createDefaultStreamController()

virtual bool ImFusion::RGBDStream::createDefaultStreamController ( )
finaloverridevirtual

Indicates whether a StreamController should be created for the stream.

Returns false, since we don't want the StreamController to be created in addition to our custom RGBDStreamController

Reimplemented from ImFusion::Stream.

◆ onRGBDDataComponentChanged()

virtual void ImFusion::RGBDStream::onRGBDDataComponentChanged ( )
protectedvirtual

Called when the RGBDDataComponent changes.

Reimplemented in ImFusion::RGBDPlayback.

◆ defaultColorResolution()

virtual bool ImFusion::RGBDStream::defaultColorResolution ( int & width,
int & height )
inlineprotectedvirtual

Returns default color resolution.

Reimplemented in ImFusion::OpenNI2RGBDStream, ImFusion::OrbbecRGBDStream, and ImFusion::RealSenseStream.

◆ defaultDepthResolution()

virtual bool ImFusion::RGBDStream::defaultDepthResolution ( int & width,
int & height )
inlineprotectedvirtual

Returns default depth resolution.

Reimplemented in ImFusion::OpenNI2RGBDStream, ImFusion::OrbbecRGBDStream, and ImFusion::RealSenseStream.


The documentation for this class was generated from the following file:
  • RGBD/Include/ImFusion/RGBD/RGBDStream.h
Search Tab / S to search, Esc to close