ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
RobustKernel.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 // @author Ignacio Vizzo [ivizzo@uni-bonn.de]
8 //
9 // Copyright (c) 2020 Ignacio Vizzo, Cyrill Stachniss, University of Bonn.
10 // ----------------------------------------------------------------------------
11 
12 #include "pipelines/registration/RobustKernel.h"
13 
14 #include <algorithm>
15 #include <cmath>
16 
17 namespace {
18 double inline square(double x) { return x * x; }
19 } // namespace
20 
21 namespace cloudViewer {
22 namespace pipelines {
23 namespace registration {
24 
25 double L2Loss::Weight(double /*residual*/) const { return 1.0; }
26 
27 double L1Loss::Weight(double residual) const {
28  return 1.0 / std::abs(residual);
29 }
30 
31 double HuberLoss::Weight(double residual) const {
32  const double e = std::abs(residual);
33  return k_ / std::max(e, k_);
34 }
35 
36 double CauchyLoss::Weight(double residual) const {
37  return 1.0 / (1 + square(residual / k_));
38 }
39 
40 double GMLoss::Weight(double residual) const {
41  return k_ / square(k_ + square(residual));
42 }
43 
44 double TukeyLoss::Weight(double residual) const {
45  const double e = std::abs(residual);
46  return square(1.0 - square(std::min(1.0, e / k_)));
47 }
48 
49 } // namespace registration
50 } // namespace pipelines
51 } // namespace cloudViewer
double Weight(double residual) const override
double Weight(double residual) const override
double Weight(double residual) const override
double Weight(double residual) const override
double Weight(double residual) const override
double Weight(double residual) const override
int min(int a, int b)
Definition: cutil_math.h:53
__host__ __device__ int2 abs(int2 v)
Definition: cutil_math.h:1267
int max(int a, int b)
Definition: cutil_math.h:48
Generic file read and write utility for python interface.