Go to the documentation of this file.00001
00002 #ifndef mvl_multi_view_matches_h_
00003 #define mvl_multi_view_matches_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <vcl_functional.h>
00025 #include <vcl_vector.h>
00026 #include <vcl_iosfwd.h>
00027 #include <vcl_map.h>
00028
00029 class mvl_multi_view_matches
00030 {
00031 public:
00032 typedef vcl_map<unsigned int, unsigned int, vcl_less<unsigned int> > Map;
00033
00034 mvl_multi_view_matches(char const* filename);
00035 mvl_multi_view_matches(vcl_vector<int> const& views);
00036 mvl_multi_view_matches(int start, int end, int step = 1);
00037 mvl_multi_view_matches(int N);
00038
00039 ~mvl_multi_view_matches();
00040
00041
00042 void set_views(vcl_vector<int> const& views);
00043 void set_views(int start, int end, int step = 1);
00044 void set_views(int N);
00045
00046
00047 void add_pair(int view1, int corner1, int view2, int corner2);
00048 void add_triplet(int view1, int corner1, int view2, int corner2, int view3, int corner3);
00049 void add_track(vcl_vector<int> const& views, vcl_vector<int> const& corners);
00050
00051
00052 void add_matches(mvl_multi_view_matches const& matches);
00053
00054 int num_views() const { return views_.size(); }
00055 int num_tracks() const { return tracks_.size(); }
00056
00057
00058 Map& get_track(int i) { return tracks_[i]; }
00059
00060 vcl_vector<int>& get_view_indices () { return views_; }
00061
00062
00063 vcl_ostream& print(vcl_ostream&) const;
00064 vcl_istream& read(vcl_istream&);
00065 vcl_ostream& write(vcl_ostream&) const;
00066
00067
00068 void read(char const* file);
00069 void write(char const* file) const;
00070
00071 protected:
00072 vcl_vector<int> views_;
00073 Map view_to_internal_map_;
00074 vcl_vector<Map> tracks_;
00075 vcl_vector<Map> corner_to_track_maps_;
00076
00077 void init();
00078 void update_maps(int track_index);
00079
00080 void remove_maps(int track_index);
00081 };
00082
00083 inline vcl_ostream& operator<<(vcl_ostream& s, mvl_multi_view_matches const& v) { return v.print(s); }
00084 inline vcl_istream& operator>>(vcl_istream& s, mvl_multi_view_matches& v) { return v.read(s); }
00085
00086 #endif // mvl_multi_view_matches_h_