![]() |
ImFusion SDK 4.3
|
#include <RGBD/Include/ImFusion/RGBD/SurfaceReconstructionGPU.h>
GPU-accelerated volumetric surface reconstruction from RGB-D data. More...
Inheritance diagram for SurfaceReconstructionGPU:GPU-accelerated volumetric surface reconstruction from RGB-D data.
This class implements a dense or hashed volumetric fusion algorithm for reconstructing surfaces from depth and color images. It uses OpenCL for parallel processing and supports integration, pose tracking, mesh extraction, and volume management.
Usage:
init().addFrame() to update the volume and track pose.currentPose() and setCurrentPose() to manage camera pose.getMesh().cleanup() and resetReconstruction() to release or reset resources.Important aspects:
addFrame() and other methods provide detailed feedback.Example:
Public Member Functions | |
| SurfaceReconstructionGPU (ClEnvironment *env=nullptr) | |
| Constructs the surface reconstruction object. | |
| ~SurfaceReconstructionGPU () | |
| Destructor. | |
| bool | init (SurfaceReconstructionData &data) |
| Initializes the object based on reconstruction parameters. | |
| bool | initialized () const |
| Returns true if the surface reconstruction object is initialized and ready for use. | |
| void | cleanup () |
| Cleans up all reconstruction data and resources. | |
| int | addFrame (const TypedImage< float > *imgDepth, const TypedImage< unsigned char > *imgColor, int sensor, const TypedImage< float > *imgDepthToColorMap=0, mat4 *T=0, bool poseHint=false, TypedImage< unsigned char > *imgScene=0, bool updateVolume=true, mat4 *sensorT=0, bool forceFirstFrame=false, bool ortho=false, int *icpMatches=nullptr, bool *isKeyframe=nullptr, double *timestamp=nullptr, const TypedImage< unsigned char > *mask=nullptr) |
| Adds a frame to the reconstruction. | |
| mat4f | currentPose () const |
| Returns the current pose (world to camera). | |
| void | setCurrentPose (const mat4f &T) |
| Sets the current pose. | |
| const ClImage * | getVolume () const |
| Returns the reconstruction volume as an OpenCL buffer (TSDF). | |
| const ClImage * | getColorVolume () const |
| Returns the reconstruction color volume as an OpenCL buffer. | |
| const ClImage * | getWeightVolume () const |
| Returns the reconstruction weight volume as an OpenCL buffer. | |
| void | resetReconstruction () |
| Resets the reconstruction volume. All other settings are left unchanged. | |
| void | detachVolumes (ClImage *&tsdf, ClImage *&color, ClImage *&weights) |
| Detaches TSDF and color volume. | |
| std::unique_ptr< Mesh > | getMesh () const override |
| Retrieves the reconstructed mesh. Ownership is transferred to the caller. | |
| void | stopReconstruction () override |
| Stops all reconstruction threads. | |
Public Member Functions inherited from SurfaceReconstruction | |
| virtual | ~SurfaceReconstruction () |
| Virtual destructor. | |
| SurfaceReconstructionGPU | ( | ClEnvironment * | env = nullptr | ) |
Constructs the surface reconstruction object.
| env | Pointer to OpenCL environment to use. If not provided, the default environment is used. |
| std::runtime_error | if the OpenCL context could not be initialized. |
|
virtual |
Initializes the object based on reconstruction parameters.
| [out] | data | Reconstruction parameters. |
Implements SurfaceReconstruction.
|
virtual |
Cleans up all reconstruction data and resources.
Implements SurfaceReconstruction.
|
virtual |
Adds a frame to the reconstruction.
| imgDepth | Depth map. | |
| imgColor | RGB color image. | |
| sensor | Sensor index. | |
| imgDepthToColorMap | Depth-to-color mapping. | |
| T | Pose. | |
| poseHint | If true, parameter T is used as the initial pose estimate and refined using ICP. If false, T is used as ground-truth pose. | |
| [out] | imgScene | Rendered reconstruction volume from current viewpoint (4 channel image). |
| updateVolume | If true, volume is updated. | |
| sensorT | Sensor transformation. | |
| forceFirstFrame | If true, forces integration of first frame. | |
| ortho | If true, uses orthographic projection for rendering imgScene. | |
| [out] | icpMatches | Number of ICP matches. |
| [out] | isKeyframe | True if frame is a keyframe. |
| timestamp | Frame timestamp. | |
| mask | Mask image. |
Implements SurfaceReconstruction.
|
inlinevirtual |
|
inlinevirtual |
Sets the current pose.
Don't use from different thread.
| T | Current pose. |
Implements SurfaceReconstruction.
| const ClImage * getVolume | ( | ) | const |
Returns the reconstruction volume as an OpenCL buffer (TSDF).
Note: only experimental implementation for hashed representation, use getMesh directly.
|
inline |
Returns the reconstruction color volume as an OpenCL buffer.
Note: for the hashed representation getVolume() needs to be executed first.
|
virtual |
Resets the reconstruction volume. All other settings are left unchanged.
Implements SurfaceReconstruction.
Detaches TSDF and color volume.
It is the caller's responsibility to release the buffers. After this call, addFrame will not succeed until initBuffers is called again. (Note: for the hashed representation getVolume() needs to be executed first.)
|
overridevirtual |
Retrieves the reconstructed mesh. Ownership is transferred to the caller.
Implements SurfaceReconstruction.
|
overridevirtual |
Stops all reconstruction threads.
Implements SurfaceReconstruction.