point_cloud_fusion v1.6.0
Loading...
Searching...
No Matches
point_cloud_fusion::FeatureMapping Struct Reference

#include <feature_calibration.hpp>

Public Member Functions

float apply (float value) const
 Map a source value to the calibrated target distribution.
 

Public Attributes

std::vector< float > source
 
std::vector< float > target
 

Detailed Description

Definition at line 21 of file feature_calibration.hpp.

Member Function Documentation

◆ apply()

float point_cloud_fusion::FeatureMapping::apply ( float value) const

Map a source value to the calibrated target distribution.

Parameters
valueSource feature value.
Returns
Piecewise-linearly mapped target value.

Definition at line 70 of file feature_calibration.cpp.

70 {
71 if (source.size() < 2 || source.size() != target.size() || !std::isfinite(value)) return value;
72 if (value <= source.front()) return target.front();
73 if (value >= source.back()) return target.back();
74 const auto upper = std::upper_bound(source.begin(), source.end(), value);
75 const std::size_t index = static_cast<std::size_t>(upper - source.begin());
76 const float denominator = source[index] - source[index - 1];
77 if (denominator <= 0.0F) return target[index];
78 const float alpha = (value - source[index - 1]) / denominator;
79 return target[index - 1] + alpha * (target[index] - target[index - 1]);
80}

Member Data Documentation

◆ source

std::vector<float> point_cloud_fusion::FeatureMapping::source

Definition at line 22 of file feature_calibration.hpp.

◆ target

std::vector<float> point_cloud_fusion::FeatureMapping::target

Definition at line 23 of file feature_calibration.hpp.


The documentation for this struct was generated from the following files: