KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
g2_ransac_line_fitting.h
Go to the documentation of this file.
1 /* $Id: g2_ransac_line_fitting.h 17393 2014-08-23 20:19:14Z predoehl $ */
2 /* {{{=========================================================================== *
3  |
4  | Copyright (c) 1994-2011 by Kobus Barnard (author)
5  |
6  | Personal and educational use of this code is granted, provided that this
7  | header is kept intact, and that the authorship is not misrepresented, that
8  | its use is acknowledged in publications, and relevant papers are cited.
9  |
10  | For other use contact the author (kobus AT cs DOT arizona DOT edu).
11  |
12  | Please note that the code in this file has not necessarily been adequately
13  | tested. Naturally, there is no guarantee of performance, support, or fitness
14  | for any particular task. Nonetheless, I am interested in hearing about
15  | problems that you encounter.
16  |
17  | Author: Jinyan Guan
18  * =========================================================================== }}}*/
19 
20 #ifndef KJB_CPP_G_RANSAC_LINE_FITTING_H
21 #define KJB_CPP_G_RANSAC_LINE_FITTING_H
22 
23 #include <m_cpp/m_vector.h>
24 #include <g_cpp/g_line.h>
25 
26 #include <vector>
27 
28 namespace kjb
29 {
30 
36 {
37 public:
38 
47  (
48  const std::vector<Vector>& observations_,
49  size_t num_inliers_required_,
50  double threshold_
51  ) : observations(observations_),
52  num_inliers_required(num_inliers_required_),
53  threshold(threshold_),
54  best_error(DBL_MAX)
55  {}
56 
61  bool run(size_t max_num_iter);
62 
63  Line get_best_line() const { return best_line; }
64  double get_best_fitting_error() const { return best_error; }
65  const std::vector<Vector>& get_consensus_set() const { return consensus_set; }
66 
67 private:
68  const std::vector<Vector>& observations;
69  std::vector<Vector> consensus_set;
70  Line best_line;
71  size_t num_inliers_required;
72  double threshold;
73  double best_error;
74 
75 };
76 
77 } //namespace kjb
78 #endif /*KJB_CPP_G_RANSAC_LINE_FITTING_H */
79 
Definition: g2_ransac_line_fitting.h:35
Line get_best_line() const
Definition: g2_ransac_line_fitting.h:63
bool run(size_t max_num_iter)
Definition: g2_ransac_line_fitting.cpp:28
double get_best_fitting_error() const
Definition: g2_ransac_line_fitting.h:64
Declarations for Line class.
const std::vector< Vector > & get_consensus_set() const
Definition: g2_ransac_line_fitting.h:65
Parametric representation of a 2D line in terms of three parameters (a,b,c) (as in ax+by+c = 0)...
Definition: g_line.h:30
Ransac_line_fitting(const std::vector< Vector > &observations_, size_t num_inliers_required_, double threshold_)
Definition: g2_ransac_line_fitting.h:47
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...