60 std::vector<double> data(fvec, fvec + m);
62 std::nth_element(data.begin(), data.begin() + (data.size() >> 1), data.end());
63 return (data[data.size() >> 1]);
72 huber(
const Eigen::Vector4f& p_src,
const Eigen::Vector4f& p_tgt,
double sigma)
74 Eigen::Array4f diff = (p_tgt.array() - p_src.array()).abs();
76 for (
int i = 0; i < 3; ++i) {
78 norm += diff[i] * diff[i];
80 norm += 2.0 * sigma * diff[i] - sigma * sigma;
90 huber(
double diff,
double sigma)
96 norm += 2.0 * sigma * diff - sigma * sigma;
107 gedikli(
double val,
double clipping,
double slope = 4)
109 return (1.0 / (1.0 + pow(std::abs(val) / clipping, slope)));
117 l1(
const Eigen::Vector4f& p_src,
const Eigen::Vector4f& p_tgt)
119 return ((p_src.array() - p_tgt.array()).abs().sum());
127 l2(
const Eigen::Vector4f& p_src,
const Eigen::Vector4f& p_tgt)
129 return ((p_src - p_tgt).norm());
137 l2Sqr(
const Eigen::Vector4f& p_src,
const Eigen::Vector4f& p_tgt)
139 return ((p_src - p_tgt).squaredNorm());
double l2Sqr(const Eigen::Vector4f &p_src, const Eigen::Vector4f &p_tgt)
Compute the squared Euclidean distance between two eigen vectors.
double gedikli(double val, double clipping, double slope=4)
Use a Gedikli kernel to estimate the distance between two vectors (for more information,...
double huber(const Eigen::Vector4f &p_src, const Eigen::Vector4f &p_tgt, double sigma)
Use a Huber kernel to estimate the distance between two vectors.
double computeMedian(double *fvec, int m)
Compute the median value from a set of doubles.
double l2(const Eigen::Vector4f &p_src, const Eigen::Vector4f &p_tgt)
Compute the Euclidean distance between two eigen vectors.
double l1(const Eigen::Vector4f &p_src, const Eigen::Vector4f &p_tgt)
Compute the Manhattan distance between two eigen vectors.