00001
00019 #ifndef __FV_H
00020 #define __FV_H
00021 #include <vector>
00022 #include <iostream>
00023 #include <assert.h>
00024
00025 using namespace std;
00026
00027
00032 class Coords : public pair<float,float>{
00033 public :
00034 Coords( float a=0, float b=0 ) { first = a; second = b; }
00035
00036 float x() { return first; }
00037 float y() { return second; }
00038 void set(float in1, float in2 ) {
00039 first = in1;
00040 second = in2;
00041 }
00042 void print() {
00043 cerr<<" "<<x()<<" "<<y()<<" ";
00044 }
00045 };
00046
00053 class Feature : public Coords {
00054 public:
00055
00056 vector<float> descriptor;
00057
00058
00059 float orientation;
00060 float dx;
00061 float dy;
00062 float magnitude;
00063
00064 Feature() {
00065 descriptor.reserve(128*sizeof(float));
00066 }
00068 double norm() {
00069 double n=0.0;
00070 for( int i=0 ;i<128; i++ ) {
00071 n += descriptor[i]*descriptor[i];
00072 }
00073 return sqrt(n);
00074 }
00075 };
00076
00078 class Scene {
00079 public:
00080 vector<Feature> features;
00081 };
00082
00083
00084
00086 class Match : public pair<Feature *, Feature *> {
00087 public:
00088 Match( Feature *a, Feature *b ) : pair<Feature *,Feature*>( a, b ) {}
00089
00091 bool Match::operator==(Match op) {
00092 return ( ( first==op.first )&&( second==op.second ) );
00093 }
00094 };
00095
00097 typedef vector<Match> Matches ;
00098
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180 #endif