Go to the documentation of this file.00001
00002
00003
00004
00005
00006
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 #ifndef _OPENCV_GENERAL_H_
00032 #define _OPENCV_GENERAL_H_
00033
00034 #ifdef __cplusplus
00035
00036 #include <stdexcept>
00037 #include <cassert>
00038 #include "opencv2/flann/object_factory.h"
00039 #include "opencv2/flann/logger.h"
00040
00041 namespace cvflann {
00042
00043 #undef ARRAY_LEN
00044 #define ARRAY_LEN(a) (sizeof(a)/sizeof(a[0]))
00045
00046
00047 enum flann_algorithm_t {
00048 FLANN_INDEX_LINEAR = 0,
00049 FLANN_INDEX_KDTREE = 1,
00050 FLANN_INDEX_KMEANS = 2,
00051 FLANN_INDEX_COMPOSITE = 3,
00052 FLANN_INDEX_SAVED = 254,
00053 FLANN_INDEX_AUTOTUNED = 255
00054 };
00055
00056 enum flann_centers_init_t {
00057 FLANN_CENTERS_RANDOM = 0,
00058 FLANN_CENTERS_GONZALES = 1,
00059 FLANN_CENTERS_KMEANSPP = 2
00060 };
00061
00062
00063 enum flann_distance_t {
00064 FLANN_DIST_EUCLIDEAN = 1,
00065 FLANN_DIST_L2 = 1,
00066 FLANN_DIST_MANHATTAN = 2,
00067 FLANN_DIST_L1 = 2,
00068 FLANN_DIST_MINKOWSKI = 3,
00069 FLANN_DIST_MAX = 4,
00070 FLANN_DIST_HIST_INTERSECT = 5,
00071 FLANN_DIST_HELLINGER = 6,
00072 FLANN_DIST_CHI_SQUARE = 7,
00073 FLANN_DIST_CS = 7,
00074 FLANN_DIST_KULLBACK_LEIBLER = 8,
00075 FLANN_DIST_KL = 8
00076 };
00077
00078 enum flann_datatype_t {
00079 FLANN_INT8 = 0,
00080 FLANN_INT16 = 1,
00081 FLANN_INT32 = 2,
00082 FLANN_INT64 = 3,
00083 FLANN_UINT8 = 4,
00084 FLANN_UINT16 = 5,
00085 FLANN_UINT32 = 6,
00086 FLANN_UINT64 = 7,
00087 FLANN_FLOAT32 = 8,
00088 FLANN_FLOAT64 = 9
00089 };
00090
00091 template <typename ELEM_TYPE>
00092 struct DistType
00093 {
00094 typedef ELEM_TYPE type;
00095 };
00096
00097 template <>
00098 struct DistType<unsigned char>
00099 {
00100 typedef float type;
00101 };
00102
00103 template <>
00104 struct DistType<int>
00105 {
00106 typedef float type;
00107 };
00108
00109
00110 class FLANNException : public std::runtime_error {
00111 public:
00112 FLANNException(const char* message) : std::runtime_error(message) { }
00113
00114 FLANNException(const std::string& message) : std::runtime_error(message) { }
00115 };
00116
00117
00118 struct CV_EXPORTS IndexParams {
00119 protected:
00120 IndexParams(flann_algorithm_t algorithm_) : algorithm(algorithm_) {};
00121
00122 public:
00123 virtual ~IndexParams() {}
00124 virtual flann_algorithm_t getIndexType() const { return algorithm; }
00125
00126 virtual void print() const = 0;
00127
00128 flann_algorithm_t algorithm;
00129 };
00130
00131
00132 typedef ObjectFactory<IndexParams, flann_algorithm_t> ParamsFactory;
00133 CV_EXPORTS ParamsFactory& ParamsFactory_instance();
00134
00135 struct CV_EXPORTS SearchParams {
00136 SearchParams(int checks_ = 32) :
00137 checks(checks_) {};
00138
00139 int checks;
00140 };
00141
00142 }
00143
00144 #endif
00145
00146 #endif