KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pt_position_prior.h
Go to the documentation of this file.
1 /* =========================================================================== *
2 |
3 | Copyright (c) 1994-2008 by Kobus Barnard (author).
4 |
5 | Personal and educational use of this code is granted, provided that this
6 | header is kept intact, and that the authorship is not misrepresented, that
7 | its use is acknowledged in publications, and relevant papers are cited.
8 |
9 | For other use contact the author (kobus AT cs DOT arizona DOT edu).
10 |
11 | Please note that the code in this file has not necessarily been adequately
12 | tested. Naturally, there is no guarantee of performance, support, or fitness
13 | for any particular task. Nonetheless, I am interested in hearing about
14 | problems that you encounter.
15 |
16 * =========================================================================== */
17 
18 /* $Id: pt_position_prior.h 18921 2015-04-20 23:26:14Z ernesto $ */
19 
20 #ifndef PT_POSITION_PRIOR_H_
21 #define PT_POSITION_PRIOR_H_
22 
25 #include <gp_cpp/gp_prior.h>
26 #include <gp_cpp/gp_normal.h>
27 
28 namespace kjb {
29 namespace pt {
30 
35 {
36 private:
37  typedef gp::Prior<gp::Zero, gp::Squared_exponential> Gpp;
38 
39 public:
41  Position_prior(double sc, double sv, size_t local_sz) :
42  gpsc_(sc),
43  gpsv_(sv),
44  local_dist_(
45  gp::Zero(),
46  gp::Sqex(gpsc_, gpsv_),
47  gp::Inputs::const_iterator(),
48  gp::Inputs::const_iterator()),
49  sweight_(25.0),
50  m_local_sz(local_sz)
51  {
52  if(m_local_sz % 2 == 0)
53  {
54  m_local_sz++;
55  }
56 
57  if(m_local_sz <= 1)
58  {
59  m_local_sz = 3;
60  }
61  }
62 
64  Position_prior(double sc, double sv) :
65  gpsc_(sc),
66  gpsv_(sv),
67  local_dist_(
68  gp::Zero(),
69  gp::Sqex(gpsc_, gpsv_),
70  gp::Inputs::const_iterator(),
71  gp::Inputs::const_iterator()),
72  sweight_(25.0),
73  m_local_sz(8*gpsc_)
74  {
75  if(m_local_sz % 2 == 0)
76  {
77  m_local_sz++;
78  }
79 
80  if(m_local_sz <= 1)
81  {
82  m_local_sz = 3;
83  }
84  }
85 
87  double operator()(const Scene& scene) const;
88 
90  double at_space(const Scene& scene) const;
91 
93  double at_trajectory(const Target& target) const;
94 
96  double local(const Target& target, size_t t) const;
97 
99  double local_space(const Scene& scene, const Target& target, size_t t) const;
100 
102  size_t local_size() const { return m_local_sz; }
103 
105  double scale() const { return gpsc_; }
106 
108  double signal_variance() const { return gpsv_; }
109 
110 private:
111  double gpsc_;
112  double gpsv_;
113  mutable Gpp local_dist_;
114  double sweight_;
115  size_t m_local_sz;
116 };
117 
118 }} //namespace kjb::pt
119 
120 #endif /*PT_POSITION_PRIOR_H_ */
121 
Position_prior(double sc, double sv, size_t local_sz)
Construct a prior.
Definition: pt_position_prior.h:41
double signal_variance() const
Return the GP signal variance.
Definition: pt_position_prior.h:108
size_t local_size() const
Return the local window size.
Definition: pt_position_prior.h:102
Class that represents a full scene in the PT universe.
Definition: pt_scene.h:40
double at_trajectory(const Target &target) const
Evaluate this prior on the given trajectory.
Definition: pt_position_prior.cpp:98
double operator()(const Scene &scene) const
Evaluate this prior on the given scene.
Definition: pt_position_prior.cpp:44
double local_space(const Scene &scene, const Target &target, size_t t) const
Approximate this space prior around a frame.
Definition: pt_position_prior.cpp:178
Class that represents the prior distribution of a trajectory.
Definition: pt_position_prior.h:34
Class that represents a target moving through space.
Definition: pt_target.h:50
double local(const Target &target, size_t t) const
Approximate this prior around a frame.
Definition: pt_position_prior.cpp:120
double at_space(const Scene &scene) const
Evaluate prior on space occupation.
Definition: pt_position_prior.cpp:60
Position_prior(double sc, double sv)
Construct a prior.
Definition: pt_position_prior.h:64
double scale() const
Return the GP scale.
Definition: pt_position_prior.h:105