ImFusion SDK 4.3
RGBDReconstructionAlgorithm Class Reference

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

Algorithm for surface reconstruction from RGB-D data streams. More...

+ Inheritance diagram for RGBDReconstructionAlgorithm:

Detailed Description

Algorithm for surface reconstruction from RGB-D data streams.

This class performs volumetric surface reconstruction using one or more RGB-D streams. It supports live sensor input and playback, pose tracking, relocalization, and keyframe management. The reconstruction process is highly configurable, supporting frame selection, buffering, integration, and synchronization.

Usage:

  • Construct with a list of RGBDStream pointers.
  • Configure reconstruction parameters as needed (e.g., relocalization, frame buffering).
  • SurfaceReconstructionData enables further and extensive configuration of the reconstruction process.
  • Call compute() or start() to begin reconstruction.
  • Use takeOutput() to retrieve results such as meshes or point clouds.
  • Register listeners via addListener() for frame-level callbacks.

Important aspects:

  • Supports both live and playback streams.
  • Pose tracking and relocalization are integrated.
  • By default it used RGBDRelocalization for relocalization, but a custom instance can be set.
  • Keyframe selection is configurable by rotation and translation thresholds.
  • Frame buffering and integration can be tuned for performance and memory usage.
  • Provides signals for reconstruction lifecycle events.
  • Configuration and serialization are supported via Properties.
  • Not thread-safe.

Example:

std::vector<RGBDStream*> streams; // Stream vector must be filled with valid streams here
RGBDReconstructionAlgorithm algo(streams);
auto recData = algo.surfaceReconstructionData();
recData->setVolumeSize(vec3(1000, 1000, 000)); // in mm
recData->setVolumeResolution(256, 256, 256); // in voxels
recData->setVolumeIncludeColor(false);
algo.setUseRelocalization(true);
algo.setKeyframeRotationDifference(30.0);
algo.start(); // starts reconstruction
// wait until enough frames have been processed
// for playback streams, use isReconstructing() to check when playback has ended and reconstruction is done
algo.stop(); // stops reconstruction, optional if isReconstructing() is used for playback streams
auto mesh = algo.getMesh();
std::vector< RGBDStream * > streams() const
Returns the list of active streams used for reconstruction.
Definition RGBDReconstructionAlgorithm.h:116
See also
RGBDStream, RGBDPlayback, SurfaceReconstructionData, SurfaceReconstruction, Relocalization, RGBDRelocalization

Classes

struct  Keyframe
 Keyframe structure containing depth, color, and camera data. More...
 

Public Member Functions

 RGBDReconstructionAlgorithm (const std::vector< RGBDStream * > &streams)
 
bool initialized () const
 Returns whether the algorithm has been initialized.
 
std::vector< RGBDStream * > streams () const
 Returns the list of active streams used for reconstruction.
 
std::vector< RGBDStream * > inputStreams () const
 Returns the input streams provided to the algorithm.
 
void setRelocalization (std::unique_ptr< Relocalization > reloc)
 Sets a custom relocalization instance. Must be called before starting reconstruction.
 
Relocalizationrelocalization () const
 Returns the current relocalization instance.
 
bool start ()
 Starts the reconstruction process.
 
void stop (bool aborted=false)
 Stops the reconstruction process.
 
void compute () override
 Calls start().
 
OwningDataList takeOutput () override
 Returns the output data list containing reconstruction results.
 
std::unique_ptr< MeshgetMesh ()
 Returns a mesh of the reconstructed surface. Ownership is transferred to the caller.
 
SurfaceReconstructionDatasurfaceReconstructionData () const
 Returns the reconstruction data object.
 
SurfaceReconstructionsurfaceReconstruction () const
 Returns the surface reconstruction instance.
 
bool isReconstructing () const
 Returns true if reconstruction is currently running.
 
bool trackingState (int idx) const
 Returns the tracking state for the specified sensor index.
 
void setForceFirstFramePerSensor (bool force)
 Forces the first frame per sensor to be used for reconstruction.
 
bool forceFirstFramePerSensor () const
 
void setUseFramePose (bool use)
 Sets whether to use the frame pose for reconstruction.
 
bool useFramePose () const
 
void setUseFramePoseAsHint (bool use)
 Sets whether to use the frame pose as a hint for tracking.
 
bool useFramePoseAsHint () const
 
void setUseStableFrameHint (bool use)
 Sets whether to use stable frame hints for tracking.
 
bool useStableFrameHint () const
 
void setUseRelocalization (bool use)
 Sets whether to use relocalization during reconstruction.
 
bool userRelocalization () const
 
void setSyncLasers (bool sync)
 Enables or disables laser synchronization for multi-sensor setups.
 
bool syncLasers () const
 
void setSyncLaserWaitTime (int waitTimeMs)
 Sets the wait time (ms) for laser synchronization.
 
int syncLaserWaitTime () const
 
void configure (const Properties *p) override
 Configures the algorithm from a Properties object.
 
void configuration (Properties *p) const override
 Serializes the algorithm configuration to a Properties object.
 
void addListener (RGBDReconstructionCallback *listener)
 Registers a callback listener for frame events.
 
void removeListener (const RGBDReconstructionCallback *listener)
 Removes a previously registered callback listener.
 
void cleanup ()
 Cleans up internal resources and state.
 
void setReconstructAllFrames (bool v)
 Forces reconstruction of all received frames (default for playback).
 
void setReconstructAllBufferedFrames (bool v)
 Forces reconstruction of all buffered frames after stop() is called.
 
void setMaxFrameBufferSize (int frames)
 Sets the maximum number of frames to buffer in memory.
 
void setSkipEverySecondFrame (bool v)
 Skips every second frame for performance optimization.
 
void setIntegrateFrames (bool integrate, int sensorId)
 Sets whether to integrate frames into the reconstruction for a given sensor.
 
std::unique_ptr< TrackingSequencetrackingSequence (int sensor) const
 Returns a copy of the tracking sequence for the specified sensor.
 
TrackingStreamliveTrackingStream () const
 Returns the live tracking stream, if available.
 
PointCloudlivePointCloud () const
 Returns the live point cloud, if available.
 
TrackingSequenceliveTrackingSequence () const
 Returns the live tracking sequence, if available.
 
std::vector< Keyframekeyframes ()
 Returns the list of keyframes used in reconstruction.
 
void setKeyframeRotationDifference (double v)
 Sets the minimum rotation difference (degrees) for keyframe selection.
 
double keyframeRotationDifference () const
 
void setKeyframeTranslationDifference (double v)
 Sets the minimum translation difference (mm) for keyframe selection.
 
double keyframeTranslationDifference () const
 
- Public Member Functions inherited from Algorithm
 Algorithm ()
 Default constructor will registers a single "compute" action that calls compute() and returns status().
 
virtual void setProgress (Progress *progress)
 Sets a Progress interface the algorithm can use to notify observers about its computing progress.
 
Progressprogress () const
 Returns the progress interface if set.
 
virtual int status () const
 Indicates the status of the last call to compute().
 
virtual bool survivesDataDeletion (const Data *) const
 Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list.
 
const FactoryInfofactoryInfo () const
 Returns the record describing how this Algorithm was instantiated by the AlgorithmFactory.
 
void setFactoryInfo (const FactoryInfo &value)
 Sets the record describing how this Algorithm was instantiated by the AlgorithmFactory.
 
Status runAction (const std::string &id)
 Run the action with name id if it exists.
 
const std::vector< Action > & actions ()
 Get a mapping from Action id to Action as registered in this algorithm.
 
- 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 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 bool createCompatible (const DataList &data, Algorithm **a=0)
 Factory method for compatibility checking and creation.
 
- Static Public Member Functions inherited from Algorithm
static bool createCompatible (const DataList &data, Algorithm **a=nullptr)
 Factory function to check algorithm compatibility with input data and optionally instantiate it.
 

Public Attributes

Signal signalReconstructionStarted
 Signal emitted when reconstruction starts.
 
Signal< bool > signalReconstructionStopped
 Signal emitted when reconstruction stops.
 
Signal signalUpdateDisplay
 Signal emitted when display should be updated.
 
- Public Attributes inherited from Algorithm
Signal signalOutputChanged
 Signal should be emitted by Algorithms when their output/result has changed.
 
Signal signalParametersChanged
 Signal should be emitted by Algorithms when their parameter configuration has changed.
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 

Additional Inherited Members

- Public Types inherited from Algorithm
enum  Status {
  Unknown = -1 , Success = 0 , Error = 1 , InvalidInput ,
  IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU ,
  UnknownAction , AbortedByUser , User = 1000
}
 Status codes. More...
 
- Protected Member Functions inherited from Algorithm
void loadDefaults ()
 
void registerAction (const std::string &id, const std::string &guiName, const std::function< Algorithm::Status(void)> &action)
 Register an action to be run via runAction.
 
template<typename D>
void registerAction (const std::string &id, const std::string &guiName, Algorithm::Status(D::*action)(void))
 Template version of runAction that can be used with a pointer to a member function.
 
void registerAction (const Action &action)
 Register an action.
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 
- Protected Attributes inherited from Algorithm
std::string m_name
 Algorithm name.
 
Progressm_progress = nullptr
 Non-owing pointer to a progress interface. May be a nullptr.
 
FactoryInfo m_factoryInfo = {}
 Record describing how this algorithm was instantiated by the AlgorithmFactory.
 
int m_status = Status::Unknown
 Algorithm status after last call to compute()
 
std::vector< Actionm_actions
 Map of key given by the id of the action, of the available actions of this algorithm.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Function Documentation

◆ compute()

void compute ( )
overridevirtual

Calls start().

Implements Algorithm.

◆ takeOutput()

OwningDataList takeOutput ( )
overridevirtual

Returns the output data list containing reconstruction results.

Reimplemented from Algorithm.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configures the algorithm from a Properties object.

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Serializes the algorithm configuration to a Properties object.

Reimplemented from Configurable.


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