OutlierFilter.cpp
Go to the documentation of this file.
1 // kate: replace-tabs off; indent-width 4; indent-mode normal
2 // vim: ts=4:sw=4:noexpandtab
3 /*
4 
5 Copyright (c) 2010--2012,
6 François Pomerleau and Stephane Magnenat, ASL, ETHZ, Switzerland
7 You can contact the authors at <f dot pomerleau at gmail dot com> and
8 <stephane at magnenat dot net>
9 
10 All rights reserved.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright
15  notice, this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in the
18  documentation and/or other materials provided with the distribution.
19  * Neither the name of the <organization> nor the
20  names of its contributors may be used to endorse or promote products
21  derived from this software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL ETH-ASL BE LIABLE FOR ANY
27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #include "PointMatcher.h"
37 #include "PointMatcherPrivate.h"
38 #include <limits>
39 
40 using namespace std;
41 
43 template<typename T>
45 {}
46 
48 template<typename T>
50  Parametrizable(className,paramsDoc,params)
51 {}
52 
54 template<typename T>
56 {}
57 
60 
61 
63 template<typename T>
65  const DataPoints& filteredReading,
66  const DataPoints& filteredReference,
67  const Matches& input)
68 {
69  //FIXME: Why we filter infinit distance only when no filter?
70  if (this->empty())
71  {
72  // we do not have any filter, therefore we must put 0 weights for infinite distances
73  OutlierWeights w(input.dists.rows(), input.dists.cols());
74  for (int x = 0; x < w.cols(); ++x)
75  {
76  for (int y = 0; y < w.rows(); ++y)
77  {
78  if (input.dists(y, x) == numeric_limits<T>::infinity())
79  w(y, x) = 0;
80  else
81  w(y, x) = 1;
82  }
83  }
84  return w;
85  }
86  else
87  {
88  // apply filters, they should take care of infinite distances
89  //LOG_INFO_STREAM("Applying " << this->size() << " Outlier filters" );
90  OutlierWeights w = (*this->begin())->compute(filteredReading, filteredReference, input);
91  //LOG_INFO_STREAM("* " << (*this->begin())->className );
92  if (this->size() > 1)
93  {
94  for (OutlierFiltersConstIt it = (this->begin() + 1); it != this->end(); ++it)
95  {
96  w = w.array() * (*it)->compute(filteredReading, filteredReference, input).array();
97  //LOG_INFO_STREAM("* " << (*it)->className );
98  }
99  }
100 
101  return w;
102  }
103 }
104 
105 
106 
Matrix OutlierWeights
Weights of the associations between the points in Matches and the points in the reference.
Definition: PointMatcher.h:397
virtual OutlierWeights compute(const DataPoints &filteredReading, const DataPoints &filteredReference, const Matches &input)=0
Detect outliers using features.
public interface
x
::std::string string
Definition: gtest.h:1979
OutlierWeights compute(const DataPoints &filteredReading, const DataPoints &filteredReference, const Matches &input)
Apply outlier-detection chain.
std::map< std::string, Parameter > Parameters
Parameters stored as a map of string->string.
Functions and classes that are dependant on scalar type are defined in this templatized class...
Definition: PointMatcher.h:130
Result of the data-association step (Matcher::findClosests), before outlier rejection.
Definition: PointMatcher.h:371
An outlier filter removes or weights links between points in reading and their matched points in refe...
Definition: PointMatcher.h:499
The superclass of classes that are constructed using generic parameters. This class provides the para...
std::vector< ParameterDoc > ParametersDoc
The documentation of all parameters.
A chain of OutlierFilter.
Definition: PointMatcher.h:512
virtual ~OutlierFilter()
virtual destructor
OutlierFilter()
Construct without parameter.
Dists dists
squared distances to closest points
Definition: PointMatcher.h:384
OutlierFilters::const_iterator OutlierFiltersConstIt
alias
Definition: PointMatcher.h:519


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:38:02