Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TrackerSynth.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 #ifndef _TrackerSynth_hh_
25 #define _TrackerSynth_hh_
26 
27 #include <bias_config.h>
28 
29 #include <Matcher2D/Tracker.hh>
30 
31 #include <vector>
32 #include <string>
33 
34 #define D_TS_READ 0x80000000
35 #define D_TS_REPLACE 0x40000000
36 
37 namespace BIAS{
38 
39  /** @class TrackerSynth
40  @brief returns ground truth tracks read from file, for debugging
41  @author woelk 01/2006 */
42  template <class StorageType, class CalculationType>
43  class BIASMatcher2D_EXPORT TrackerSynth
44  : public Tracker<StorageType, CalculationType>
45  {
46  public:
47  TrackerSynth();
48  virtual ~TrackerSynth();
49 
50  /** Tracks all points from the internal data structure Points_ and
51  afterwards replaces them by the nearest track read from file
52  @author woelk 01/2006 */
53  virtual int Track(PyramidImageInterface<CalculationType>& pim,
56 
57  /** Tracks all points in Points_ using prediction as previous knowledge
58  and afterwards replaces them by the nearest track read from file.
59  @author woelk 01/2006 */
60  virtual int Track(PyramidImageInterface<CalculationType>& pim,
63  const std::vector<HomgPoint2D>& prediction,
64  const std::vector<Matrix2x2<KLT_TYPE> >&affineprediction=
65  std::vector<Matrix2x2<KLT_TYPE> >());
66 
69 
70  protected:
71  //BIAS_EXPORT_STL_VECTOR( BIASMatcher2D_EXPORT, BIAS::HomgPoint2D )
72 
73  /// tracks read from file by ReadTracks_
74  std::vector<std::vector<BIAS::HomgPoint2D> > Tracks_;
75 
76  /// current frame number
77  int Frame_;
78 
79  /** reads tracks from file and stores them in Tracks_ */
80  void ReadTracks_(const std::string& filename);
81 
82  /** finds the nearest point to p in all frames in Tracks_.
83  Returns nearest_frame_index and nearest_track_index */
84  void FindNearest_(HomgPoint2D& p, int &nearest_frame_index,
85  int &nearest_track_index);
86 
87  /** Finds the nearest point to p in Tracks_[frame]. Returns the
88  track index, i.e. the nearest point to p i Tracks_[frame][track index]
89  */
90  int FindNearest_(HomgPoint2D& p, const int frame);
91 
92  /** for all succesfully tracked points p in Points_[*PyIndex]
93  it calls FindNearest_(p, Frame_) and replaces
94  Points_[*PyIndex] by the so found track.
95  Adds Gaussian Noise and outlier to the replaced points. */
96  void Track_();
97 
98  /** adds spatial gaussian noise to Points_[*PyIndex_] */
99  void AddGaussianNoise_();
100 
101  /** adds outliers to Points_[*PyIndex_] */
102  void AddOutlier_();
103 
104  };
105 }
106 
107 #endif // _TrackerSynth_hh_
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Definition: HomgPoint2D.hh:67
returns ground truth tracks read from file, for debugging
Definition: TrackerSynth.hh:43
std::vector< std::vector< BIAS::HomgPoint2D > > Tracks_
tracks read from file by ReadTracks_
Definition: TrackerSynth.hh:74
int Frame_
current frame number
Definition: TrackerSynth.hh:77
High level tracking class.
Definition: Tracker.hh:72