ImFusion SDK 4.3
RGBDCalibrationAlgorithm Class Reference

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

RGBDCalibrationAlgorithm estimates intrinsic and extrinsic calibration parameters for RGB-D camera systems. More...

+ Inheritance diagram for RGBDCalibrationAlgorithm:

Detailed Description

RGBDCalibrationAlgorithm estimates intrinsic and extrinsic calibration parameters for RGB-D camera systems.

The algorithm is designed to calibrate IR, depth, and color sensors using chessboard patterns and marker planes. It supports flexible input configurations and provides access to calibration results for downstream processing.

The class does not take ownership of the input image sets; their lifetime is not managed by the algorithm. The caller must ensure that the image sets remain valid for the entire time the algorithm is used. Calibration results are stored in the RGBDCalibration struct and can be queried or set externally.

Typical usage:

// Setup calibration algorithm with image sets
calib.compute();
if (calib.calibration(result))
{
// Use calibration parameters
}
RGBDCalibrationAlgorithm(SharedImageSet *irImages, SharedImageSet *depthImages, SharedImageSet *colorImages=nullptr)
Constructs the calibration algorithm with IR, depth, and optionally color image sets.
SharedImageSet * depthImages() const
Returns the depth image set (ownership not transferred).
Definition RGBDCalibrationAlgorithm.h:86
SharedImageSet * irImages() const
Returns the IR image set (ownership not transferred).
Definition RGBDCalibrationAlgorithm.h:83
SharedImageSet * colorImages() const
Returns the color image set (ownership not transferred).
Definition RGBDCalibrationAlgorithm.h:89
Struct holding all calibration results for an RGBD sensor.
Definition RGBDCalibrationAlgorithm.h:102

Important aspects:

  • Input image sets must remain valid for the lifetime of the algorithm.
  • All images must be compatible in resolution and calibration.
  • Not thread-safe.
  • Error handling is via return codes; no exceptions are thrown.
  • Depth corruption handling and undistortion can be configured.
  • The algorithm is intended for use in RGBD sensor calibration pipelines.
See also
ImFusion::CameraCalibrationAlgorithm

Classes

struct  RGBDCalibration
 Struct holding all calibration results for an RGBD sensor. More...
 

Public Member Functions

 RGBDCalibrationAlgorithm (SharedImageSet *irImages, SharedImageSet *depthImages, SharedImageSet *colorImages=nullptr)
 Constructs the calibration algorithm with IR, depth, and optionally color image sets.
 
SharedImageSetirImages () const
 Returns the IR image set (ownership not transferred).
 
SharedImageSetdepthImages () const
 Returns the depth image set (ownership not transferred).
 
SharedImageSetcolorImages () const
 Returns the color image set (ownership not transferred).
 
void compute () override
 Runs the calibration algorithm.
 
CameraCalibrationAlgorithmirCalibration ()
 Returns the calibration object for configuring standard chessboard calibration (IR sensor).
 
CameraCalibrationAlgorithmcolorCalibration ()
 Returns the calibration object for configuring standard chessboard calibration (color sensor).
 
bool calibration (RGBDCalibration &calib) const
 Returns the current calibration results.
 
void setCalibration (const RGBDCalibration &calib)
 Sets the calibration results.
 
void clearCalibration ()
 Clears the current calibration results.
 
void setDropCorruptDepthData (bool drop)
 Enables or disables dropping of corrupt depth data.
 
bool dropCorruptDepthData () const
 Returns whether corrupt depth data is dropped.
 
void setCorruptDepthRange (std::array< float, 2 > range)
 Sets the range for corrupt depth values (world units, usually in mm).
 
std::array< float, 2 > corruptDepthRange () const
 Returns the range for corrupt depth values (world units, usually in mm).
 
void setIrDepthYShift (int shift)
 Sets the vertical shift for IR/depth image alignment (pixels).
 
int irDepthYShift () const
 Returns the vertical shift for IR/depth image alignment (pixels).
 
void setUndistort (bool v)
 Enables or disables undistortion of images.
 
bool undistort () const
 Returns whether undistortion is enabled.
 
void setDontCalibrate (bool v)
 Enables or disables calibration (for testing or debugging).
 
bool dontCalibrate () const
 Returns whether calibration is disabled.
 
bool fittingError (std::vector< vec4 > &planes, std::vector< bool > &selection) const
 Computes the fitting error for marker planes.
 
OwningDataList takeOutput () override
 Returns the output data list containing calibration results.
 
void configure (const Properties *p) override
 Configures the algorithm from a properties object.
 
void configuration (Properties *p) const override
 Writes the current configuration to a properties object.
 
- 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
 

Static Public Member Functions

static bool createCompatible (const DataList &data, Algorithm **a=0)
 Factory method for compatibility checking and creation.
 
static bool getMarkerMask (TypedImage< float > *imgDepth, const std::vector< vec2 > &cornersImg, TypedImage< unsigned char > *mask)
 Creates a binary mask image with pixels inside the rectangle defined by given corners set to 1.
 
static bool getMarkerPlane (TypedImage< float > *imgDepth, const mat3 &depthK, const std::vector< vec2 > &cornersImg, vec4 &plane, TypedImage< unsigned char > *mask=nullptr, double minInlierRatio=0.8)
 Fits a plane to a depth image using pixels inside a rectangle defined by given corners.
 
- 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.
 

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...
 
- 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.
 
- 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 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.
 

Constructor & Destructor Documentation

◆ RGBDCalibrationAlgorithm()

RGBDCalibrationAlgorithm ( SharedImageSet * irImages,
SharedImageSet * depthImages,
SharedImageSet * colorImages = nullptr )

Constructs the calibration algorithm with IR, depth, and optionally color image sets.

Ownership of image sets is not transferred; they must remain valid for the algorithm's lifetime.

Parameters
irImagesPointer to IR image set.
depthImagesPointer to depth image set.
colorImagesPointer to color image set (optional).

Member Function Documentation

◆ getMarkerMask()

static bool getMarkerMask ( TypedImage< float > * imgDepth,
const std::vector< vec2 > & cornersImg,
TypedImage< unsigned char > * mask )
static

Creates a binary mask image with pixels inside the rectangle defined by given corners set to 1.

Parameters
imgDepthPointer to depth image.
cornersImgRectangle corners in image coordinates.
maskOutput mask image (pixels inside rectangle set to 1).
Returns
True if successful.

◆ getMarkerPlane()

static bool getMarkerPlane ( TypedImage< float > * imgDepth,
const mat3 & depthK,
const std::vector< vec2 > & cornersImg,
vec4 & plane,
TypedImage< unsigned char > * mask = nullptr,
double minInlierRatio = 0.8 )
static

Fits a plane to a depth image using pixels inside a rectangle defined by given corners.

Parameters
imgDepthPointer to depth image.
depthKIntrinsic matrix of depth camera.
cornersImgRectangle corners in image coordinates.
planeOutput plane parameters (ax + by + cz + d = 0).
maskOptional output mask image.
minInlierRatioMinimum ratio of inliers required for a valid fit.
Returns
True if successful.

◆ compute()

void compute ( )
overridevirtual

Runs the calibration algorithm.

Implements Algorithm.

◆ calibration()

bool calibration ( RGBDCalibration & calib) const

Returns the current calibration results.

Parameters
calibOutput calibration struct.
Returns
True if calibration is valid.

◆ setCalibration()

void setCalibration ( const RGBDCalibration & calib)

Sets the calibration results.

Parameters
calibCalibration struct to set.

◆ setDropCorruptDepthData()

void setDropCorruptDepthData ( bool drop)
inline

Enables or disables dropping of corrupt depth data.

Parameters
dropTrue to drop corrupt data.

◆ setCorruptDepthRange()

void setCorruptDepthRange ( std::array< float, 2 > range)
inline

Sets the range for corrupt depth values (world units, usually in mm).

Parameters
rangeArray specifying [min, max] corrupt depth values.

◆ setIrDepthYShift()

void setIrDepthYShift ( int shift)
inline

Sets the vertical shift for IR/depth image alignment (pixels).

Parameters
shiftY-axis shift in pixels.

◆ setUndistort()

void setUndistort ( bool v)
inline

Enables or disables undistortion of images.

Parameters
vTrue to enable undistortion.

◆ setDontCalibrate()

void setDontCalibrate ( bool v)
inline

Enables or disables calibration (for testing or debugging).

Parameters
vTrue to disable calibration.

◆ fittingError()

bool fittingError ( std::vector< vec4 > & planes,
std::vector< bool > & selection ) const

Computes the fitting error for marker planes.

Parameters
planesOutput vector of plane parameters.
selectionOutput vector indicating selected planes.
Returns
True if fitting error was computed.

◆ takeOutput()

OwningDataList takeOutput ( )
overridevirtual

Returns the output data list containing calibration 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

Writes the current 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