00001 #include <vocabulary_tree/distance.h> 00002 #include <vector> 00003 #include <boost/array.hpp> 00004 #include <cstdio> 00005 00006 int main(int argc, char** argv) 00007 { 00008 { 00009 typedef Eigen::Vector4i Feature; 00010 Feature a(0, 0, 0, 0), b(1, 1, 1, 1); 00011 vt::distance::L2<Feature> distance; 00012 printf("Distance = %d\n", distance(a, b)); 00013 } 00014 { 00015 typedef Eigen::Vector4f Feature; 00016 Feature a(0, 0, 0, 0), b(1.6, 2.24, 5.3, -0.512); 00017 vt::distance::L2<Feature> distance; 00018 printf("Distance = %f\n", distance(a, b)); 00019 } 00020 { 00021 typedef boost::array<double, 2> Feature; 00022 Feature a, b; 00023 a[0] = 0.0; a[1] = 3.0; 00024 b[0] = 4.0; b[1] = 0.0; 00025 vt::distance::L2<Feature> distance; 00026 printf("Distance = %f\n", distance(a, b)); 00027 } 00028 { 00029 typedef std::vector<uint8_t> Feature; 00030 Feature a(2), b(2); 00031 a[0] = 0; a[1] = 3; 00032 b[0] = 4; b[1] = 0; 00033 vt::distance::L2<Feature> distance; 00034 printf("Distance = %d\n", distance(a, b)); 00035 } 00036 }