00001 #ifndef VOCABULARY_TREE_GENERIC_TREE_H
00002 #define VOCABULARY_TREE_GENERIC_TREE_H
00003
00004 #include "vocabulary_tree/vocabulary_tree.h"
00005 #include <opencv/cv.h>
00006
00007 namespace vt {
00008
00009 namespace distance {
00015 template<> struct L2<cv::Mat>
00016 {
00017 typedef double result_type;
00018
00019 result_type operator()(const cv::Mat& a, const cv::Mat& b) const
00020 {
00021 return cv::norm(a, b);
00022 }
00023 };
00024
00025 }
00026
00034 class GenericTree : public VocabularyTree<cv::Mat>
00035 {
00036 public:
00038 GenericTree();
00040 GenericTree(const std::string& file);
00041
00043 void save(const std::string& file) const;
00045 void load(const std::string& file);
00046
00048 size_t dimension() const;
00049 };
00050
00051 }
00052
00053 #endif