Go to the documentation of this file.00001
00002 #ifndef NViewMatches_h_
00003 #define NViewMatches_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
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include <vnl/vnl_vector.h>
00036 #include <vcl_vector.h>
00037 #include <vcl_iosfwd.h>
00038
00039 struct NViewMatch : public vnl_vector<int>
00040 {
00041
00042 enum { nomatch = -1 };
00043
00044
00045 NViewMatch() {}
00046 NViewMatch(int n): vnl_vector<int>(n, nomatch) {}
00047
00048
00049 bool matches(const NViewMatch& b, int min_overlap) const;
00050 void incorporate(const NViewMatch& b);
00051 bool is_consistent(const NViewMatch& b) const;
00052 int count_observations() const;
00053 };
00054
00055 vcl_ostream& operator<<(vcl_ostream& s, const NViewMatch& c);
00056
00057 class NViewMatches : public vcl_vector<NViewMatch>
00058 {
00059
00060 int nviews_;
00061 int min_overlap_;
00062
00063 public:
00064
00065 NViewMatches();
00066 NViewMatches(vcl_istream& s);
00067 NViewMatches(const char* filename);
00068 NViewMatches(int nviews, int min_overlap = 2);
00069 ~NViewMatches();
00070
00071
00072
00073
00074
00075 int nviews() const { return nviews_; }
00076
00077 bool load(vcl_istream&);
00078 bool load(const char* filename);
00079
00080 bool save(vcl_ostream&);
00081 bool save(const char* filename);
00082
00083 void clear();
00084
00085 int count_matches(const NViewMatch& match);
00086 vcl_vector<int> get_matches(const NViewMatch& match);
00087 int incorporate_triplet(int base_view, int c1, int c2, int c3);
00088 int incorporate(const NViewMatch& matches);
00089 void remove_inconsistencies();
00090 NViewMatch make_triplet_match(int base_view, int c1, int c2, int c3);
00091 };
00092
00093 class OffsetNViewMatch : public NViewMatch
00094 {
00095 int min_view_;
00096 public:
00097 OffsetNViewMatch(int min_view, int max_view):
00098 NViewMatch(max_view - min_view + 1),
00099 min_view_(min_view)
00100 {
00101 }
00102
00103 OffsetNViewMatch(const OffsetNViewMatch& that):
00104 NViewMatch(that),
00105 min_view_(that.min_view_)
00106 {
00107 }
00108
00109 OffsetNViewMatch& operator=(const OffsetNViewMatch& that)
00110 {
00111 NViewMatch::operator=(that);
00112 min_view_ = that.min_view_;
00113 return *this;
00114 }
00115
00116 int& operator[] (int i) { return NViewMatch::operator[] (i - min_view_); }
00117 };
00118
00119 #endif // NViewMatches_h_