-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAbstractModel.hpp
44 lines (37 loc) · 1.3 KB
/
AbstractModel.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include <array>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <vector>
namespace GRANSAC {
typedef float VPFloat;
// Each abstract model is made of abstract parameters
// Could be anything from a point (that make a 2D line or 3D plane or image
// correspondences) to a line
class AbstractParameter {
public:
virtual ~AbstractParameter(
void){}; // To make this polymorphic we add dummy destructor
};
// Abstract model type for generic RANSAC model fitting
template <int t_NumParams> /* Minimum number of parameters required to define
this model*/
class AbstractModel {
protected:
std::array<std::shared_ptr<AbstractParameter>, t_NumParams> m_MinModelParams;
virtual VPFloat ComputeDistanceMeasure(
std::shared_ptr<AbstractParameter> Param) = 0;
public:
virtual void Initialize(
const std::vector<std::shared_ptr<AbstractParameter>> &InputParams) = 0;
virtual std::pair<VPFloat, std::vector<std::shared_ptr<AbstractParameter>>>
Evaluate(
const std::vector<std::shared_ptr<AbstractParameter>> &EvaluateParams,
VPFloat Threshold) = 0;
virtual std::array<std::shared_ptr<AbstractParameter>, t_NumParams>
GetModelParams(void) {
return m_MinModelParams;
};
};
} // namespace GRANSAC