Classes | |
class | PooledAllocator |
struct | AutotunedIndexParams |
class | AutotunedIndex |
struct | CompositeIndexParams |
class | CompositeIndex |
struct | ZeroIterator |
struct | SavedIndexParams |
class | Index |
struct | DistType |
struct | DistType< unsigned char > |
struct | DistType< int > |
class | FLANNException |
struct | IndexParams |
struct | SearchParams |
class | Heap |
struct | KDTreeIndexParams |
class | KDTreeIndex |
struct | KMeansIndexParams |
class | KMeansIndex |
struct | LinearIndexParams |
class | LinearIndex |
class | Logger |
class | Matrix |
class | UntypedMatrix |
class | NNIndex |
class | ObjectFactory |
class | UniqueRandom |
struct | BranchStruct |
class | ResultSet |
class | KNNResultSet |
class | RadiusResultSet |
struct | Datatype |
struct | Datatype< char > |
struct | Datatype< short > |
struct | Datatype< int > |
struct | Datatype< unsigned char > |
struct | Datatype< unsigned short > |
struct | Datatype< unsigned int > |
struct | Datatype< float > |
struct | Datatype< double > |
struct | IndexHeader |
class | StartStopTimer |
Typedefs | |
typedef ObjectFactory < IndexParams, flann_algorithm_t > | ParamsFactory |
Enumerations | |
enum | flann_algorithm_t { FLANN_INDEX_LINEAR = 0, FLANN_INDEX_KDTREE = 1, FLANN_INDEX_KMEANS = 2, FLANN_INDEX_COMPOSITE = 3, FLANN_INDEX_SAVED = 254, FLANN_INDEX_AUTOTUNED = 255 } |
enum | flann_centers_init_t { FLANN_CENTERS_RANDOM = 0, FLANN_CENTERS_GONZALES = 1, FLANN_CENTERS_KMEANSPP = 2 } |
enum | flann_distance_t { FLANN_DIST_EUCLIDEAN = 1, FLANN_DIST_L2 = 1, FLANN_DIST_MANHATTAN = 2, FLANN_DIST_L1 = 2, FLANN_DIST_MINKOWSKI = 3, FLANN_DIST_MAX = 4, FLANN_DIST_HIST_INTERSECT = 5, FLANN_DIST_HELLINGER = 6, FLANN_DIST_CHI_SQUARE = 7, FLANN_DIST_CS = 7, FLANN_DIST_KULLBACK_LEIBLER = 8, FLANN_DIST_KL = 8 } |
enum | flann_datatype_t { FLANN_INT8 = 0, FLANN_INT16 = 1, FLANN_INT32 = 2, FLANN_INT64 = 3, FLANN_UINT8 = 4, FLANN_UINT16 = 5, FLANN_UINT32 = 6, FLANN_UINT64 = 7, FLANN_FLOAT32 = 8, FLANN_FLOAT64 = 9 } |
enum | flann_log_level_t { FLANN_LOG_NONE = 0, FLANN_LOG_FATAL = 1, FLANN_LOG_ERROR = 2, FLANN_LOG_WARN = 3, FLANN_LOG_INFO = 4 } |
Functions | |
template<typename T > | |
NNIndex< T > * | create_index_by_type (const Matrix< T > &dataset, const IndexParams ¶ms) |
template<typename T > | |
T * | allocate (size_t count=1) |
template<typename Iterator1 , typename Iterator2 > | |
double | euclidean_dist (Iterator1 first1, Iterator1 last1, Iterator2 first2, double acc=0) |
CV_EXPORTS double | euclidean_dist (const unsigned char *first1, const unsigned char *last1, unsigned char *first2, double acc) |
template<typename Iterator1 , typename Iterator2 > | |
double | manhattan_dist (Iterator1 first1, Iterator1 last1, Iterator2 first2, double acc=0) |
CV_EXPORTS int | flann_minkowski_order () |
template<typename Iterator1 , typename Iterator2 > | |
double | minkowski_dist (Iterator1 first1, Iterator1 last1, Iterator2 first2, double acc=0) |
template<typename Iterator1 , typename Iterator2 > | |
double | max_dist (Iterator1 first1, Iterator1 last1, Iterator2 first2, double acc=0) |
template<typename Iterator1 , typename Iterator2 > | |
double | hist_intersection_kernel (Iterator1 first1, Iterator1 last1, Iterator2 first2) |
template<typename Iterator1 , typename Iterator2 > | |
double | hist_intersection_dist_sq (Iterator1 first1, Iterator1 last1, Iterator2 first2, double acc=0) |
template<typename Iterator1 , typename Iterator2 > | |
double | hellinger_dist (Iterator1 first1, Iterator1 last1, Iterator2 first2, double acc=0) |
template<typename Iterator1 , typename Iterator2 > | |
double | chi_square_dist (Iterator1 first1, Iterator1 last1, Iterator2 first2, double acc=0) |
template<typename Iterator1 , typename Iterator2 > | |
double | kl_divergence (Iterator1 first1, Iterator1 last1, Iterator2 first2, double acc=0) |
CV_EXPORTS flann_distance_t | flann_distance_type () |
template<typename Iterator1 , typename Iterator2 > | |
double | custom_dist (Iterator1 first1, Iterator1 last1, Iterator2 first2, double acc=0) |
CV_EXPORTS ZeroIterator< float > & | zero () |
CV_EXPORTS void | log_verbosity (int level) |
CV_EXPORTS void | set_distance_type (flann_distance_t distance_type, int order) |
template<typename T > | |
NNIndex< T > * | load_saved_index (const Matrix< T > &dataset, const std::string &filename) |
template<typename ELEM_TYPE , typename DIST_TYPE > | |
int | hierarchicalClustering (const Matrix< ELEM_TYPE > &features, Matrix< DIST_TYPE > ¢ers, const KMeansIndexParams ¶ms) |
CV_EXPORTS ParamsFactory & | ParamsFactory_instance () |
template<typename T > | |
void | find_nearest (const Matrix< T > &dataset, T *query, int *matches, int nn, int skip=0) |
template<typename T > | |
void | compute_ground_truth (const Matrix< T > &dataset, const Matrix< T > &testset, Matrix< int > &matches, int skip=0) |
template<typename T > | |
void | save_to_file (const cvflann::Matrix< T > &flann_dataset, const std::string &filename, const std::string &name) |
template<typename T > | |
void | load_from_file (cvflann::Matrix< T > &flann_dataset, const std::string &filename, const std::string &name) |
CV_EXPORTS int | countCorrectMatches (int *neighbors, int *groundTruth, int n) |
template<typename ELEM_TYPE > | |
float | computeDistanceRaport (const Matrix< ELEM_TYPE > &inputData, ELEM_TYPE *target, int *neighbors, int *groundTruth, int veclen, int n) |
template<typename ELEM_TYPE > | |
float | search_with_ground_truth (NNIndex< ELEM_TYPE > &index, const Matrix< ELEM_TYPE > &inputData, const Matrix< ELEM_TYPE > &testData, const Matrix< int > &matches, int nn, int checks, float &time, float &dist, int skipMatches) |
template<typename ELEM_TYPE > | |
float | test_index_checks (NNIndex< ELEM_TYPE > &index, const Matrix< ELEM_TYPE > &inputData, const Matrix< ELEM_TYPE > &testData, const Matrix< int > &matches, int checks, float &precision, int nn=1, int skipMatches=0) |
template<typename ELEM_TYPE > | |
float | test_index_precision (NNIndex< ELEM_TYPE > &index, const Matrix< ELEM_TYPE > &inputData, const Matrix< ELEM_TYPE > &testData, const Matrix< int > &matches, float precision, int &checks, int nn=1, int skipMatches=0) |
template<typename ELEM_TYPE > | |
float | test_index_precisions (NNIndex< ELEM_TYPE > &index, const Matrix< ELEM_TYPE > &inputData, const Matrix< ELEM_TYPE > &testData, const Matrix< int > &matches, float *precisions, int precisions_length, int nn=1, int skipMatches=0, float maxTime=0) |
CV_EXPORTS Logger & | logger () |
template<typename BaseClass , typename DerivedClass > | |
BaseClass * | createObject () |
CV_EXPORTS void | seed_random (unsigned int seed) |
CV_EXPORTS double | rand_double (double high=1.0, double low=0) |
CV_EXPORTS int | rand_int (int high=RAND_MAX, int low=0) |
template<typename T > | |
Matrix< T > | random_sample (Matrix< T > &srcMatrix, long size, bool remove=false) |
template<typename T > | |
Matrix< T > | random_sample (const Matrix< T > &srcMatrix, size_t size) |
CV_EXPORTS const char * | FLANN_SIGNATURE () |
CV_EXPORTS const char * | FLANN_VERSION () |
template<typename ELEM_TYPE > | |
void | save_header (FILE *stream, const NNIndex< ELEM_TYPE > &index) |
CV_EXPORTS IndexHeader | load_header (FILE *stream) |
template<typename T > | |
void | save_value (FILE *stream, const T &value, int count=1) |
template<typename T > | |
void | load_value (FILE *stream, T &value, int count=1) |
template<typename T > | |
void | addValue (int pos, float val, float *vals, T *point, T *points, int n) |
template<typename T , typename F > | |
float | optimizeSimplexDownhill (T *points, int n, F func, float *vals=NULL) |
Variables | |
const size_t | WORDSIZE = 16 |
const size_t | BLOCKSIZE = 8192 |
NNIndex<T>* cvflann::create_index_by_type | ( | const Matrix< T > & | dataset, |
const IndexParams & | params | ||
) |
T* cvflann::allocate | ( | size_t | count = 1 | ) |
Allocates (using C's malloc) a generic type T.
Params: count = number of instances to allocate. Returns: pointer (of type T*) to memory buffer
double cvflann::euclidean_dist | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2, | ||
double | acc = 0 |
||
) |
Compute the squared Euclidean distance between two vectors.
This is highly optimised, with loop unrolling, as it is one of the most expensive inner loops.
The computation of squared root at the end is omitted for efficiency.
CV_EXPORTS double cvflann::euclidean_dist | ( | const unsigned char * | first1, |
const unsigned char * | last1, | ||
unsigned char * | first2, | ||
double | acc | ||
) |
double cvflann::manhattan_dist | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2, | ||
double | acc = 0 |
||
) |
Compute the Manhattan (L_1) distance between two vectors.
This is highly optimised, with loop unrolling, as it is one of the most expensive inner loops.
CV_EXPORTS int cvflann::flann_minkowski_order | ( | ) |
double cvflann::minkowski_dist | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2, | ||
double | acc = 0 |
||
) |
Compute the Minkowski (L_p) distance between two vectors.
This is highly optimised, with loop unrolling, as it is one of the most expensive inner loops.
The computation of squared root at the end is omitted for efficiency.
double cvflann::max_dist | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2, | ||
double | acc = 0 |
||
) |
double cvflann::hist_intersection_kernel | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2 | ||
) |
double cvflann::hist_intersection_dist_sq | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2, | ||
double | acc = 0 |
||
) |
double cvflann::hellinger_dist | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2, | ||
double | acc = 0 |
||
) |
double cvflann::chi_square_dist | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2, | ||
double | acc = 0 |
||
) |
double cvflann::kl_divergence | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2, | ||
double | acc = 0 |
||
) |
CV_EXPORTS flann_distance_t cvflann::flann_distance_type | ( | ) |
double cvflann::custom_dist | ( | Iterator1 | first1, |
Iterator1 | last1, | ||
Iterator2 | first2, | ||
double | acc = 0 |
||
) |
Custom distance function. The distance computed is dependent on the value of the 'flann_distance_type' global variable.
If the last argument 'acc' is passed, the result is accumulated to the value of this argument.
CV_EXPORTS ZeroIterator<float>& cvflann::zero | ( | ) |
CV_EXPORTS void cvflann::log_verbosity | ( | int | level | ) |
Sets the log level used for all flann functions
Params: level = verbosity level
CV_EXPORTS void cvflann::set_distance_type | ( | flann_distance_t | distance_type, |
int | order | ||
) |
Sets the distance type to use throughout FLANN. If distance type specified is MINKOWSKI, the second argument specifies which order the minkowski distance should have.
NNIndex<T>* cvflann::load_saved_index | ( | const Matrix< T > & | dataset, |
const std::string & | filename | ||
) |
int cvflann::hierarchicalClustering | ( | const Matrix< ELEM_TYPE > & | features, |
Matrix< DIST_TYPE > & | centers, | ||
const KMeansIndexParams & | params | ||
) |
CV_EXPORTS ParamsFactory& cvflann::ParamsFactory_instance | ( | ) |
void cvflann::find_nearest | ( | const Matrix< T > & | dataset, |
T * | query, | ||
int * | matches, | ||
int | nn, | ||
int | skip = 0 |
||
) |
void cvflann::compute_ground_truth | ( | const Matrix< T > & | dataset, |
const Matrix< T > & | testset, | ||
Matrix< int > & | matches, | ||
int | skip = 0 |
||
) |
void cvflann::save_to_file | ( | const cvflann::Matrix< T > & | flann_dataset, |
const std::string & | filename, | ||
const std::string & | name | ||
) |
void cvflann::load_from_file | ( | cvflann::Matrix< T > & | flann_dataset, |
const std::string & | filename, | ||
const std::string & | name | ||
) |
CV_EXPORTS int cvflann::countCorrectMatches | ( | int * | neighbors, |
int * | groundTruth, | ||
int | n | ||
) |
float cvflann::computeDistanceRaport | ( | const Matrix< ELEM_TYPE > & | inputData, |
ELEM_TYPE * | target, | ||
int * | neighbors, | ||
int * | groundTruth, | ||
int | veclen, | ||
int | n | ||
) |
float cvflann::search_with_ground_truth | ( | NNIndex< ELEM_TYPE > & | index, |
const Matrix< ELEM_TYPE > & | inputData, | ||
const Matrix< ELEM_TYPE > & | testData, | ||
const Matrix< int > & | matches, | ||
int | nn, | ||
int | checks, | ||
float & | time, | ||
float & | dist, | ||
int | skipMatches | ||
) |
float cvflann::test_index_checks | ( | NNIndex< ELEM_TYPE > & | index, |
const Matrix< ELEM_TYPE > & | inputData, | ||
const Matrix< ELEM_TYPE > & | testData, | ||
const Matrix< int > & | matches, | ||
int | checks, | ||
float & | precision, | ||
int | nn = 1 , |
||
int | skipMatches = 0 |
||
) |
float cvflann::test_index_precision | ( | NNIndex< ELEM_TYPE > & | index, |
const Matrix< ELEM_TYPE > & | inputData, | ||
const Matrix< ELEM_TYPE > & | testData, | ||
const Matrix< int > & | matches, | ||
float | precision, | ||
int & | checks, | ||
int | nn = 1 , |
||
int | skipMatches = 0 |
||
) |
float cvflann::test_index_precisions | ( | NNIndex< ELEM_TYPE > & | index, |
const Matrix< ELEM_TYPE > & | inputData, | ||
const Matrix< ELEM_TYPE > & | testData, | ||
const Matrix< int > & | matches, | ||
float * | precisions, | ||
int | precisions_length, | ||
int | nn = 1 , |
||
int | skipMatches = 0 , |
||
float | maxTime = 0 |
||
) |
CV_EXPORTS Logger& cvflann::logger | ( | ) |
BaseClass* cvflann::createObject | ( | ) |
CV_EXPORTS void cvflann::seed_random | ( | unsigned int | seed | ) |
Seeds the random number generator
CV_EXPORTS double cvflann::rand_double | ( | double | high = 1.0 , |
double | low = 0 |
||
) |
CV_EXPORTS int cvflann::rand_int | ( | int | high = RAND_MAX , |
int | low = 0 |
||
) |
Matrix<T> cvflann::random_sample | ( | Matrix< T > & | srcMatrix, |
long | size, | ||
bool | remove = false |
||
) |
Matrix<T> cvflann::random_sample | ( | const Matrix< T > & | srcMatrix, |
size_t | size | ||
) |
CV_EXPORTS const char* cvflann::FLANN_SIGNATURE | ( | ) |
CV_EXPORTS const char* cvflann::FLANN_VERSION | ( | ) |
void cvflann::save_header | ( | FILE * | stream, |
const NNIndex< ELEM_TYPE > & | index | ||
) |
Saves index header to stream
stream | - Stream to save to |
index | - The index to save |
CV_EXPORTS IndexHeader cvflann::load_header | ( | FILE * | stream | ) |
stream | - Stream to load from |
void cvflann::save_value | ( | FILE * | stream, |
const T & | value, | ||
int | count = 1 |
||
) |
void cvflann::load_value | ( | FILE * | stream, |
T & | value, | ||
int | count = 1 |
||
) |
void cvflann::addValue | ( | int | pos, |
float | val, | ||
float * | vals, | ||
T * | point, | ||
T * | points, | ||
int | n | ||
) |
Adds val to array vals (and point to array points) and keeping the arrays sorted by vals.
float cvflann::optimizeSimplexDownhill | ( | T * | points, |
int | n, | ||
F | func, | ||
float * | vals = NULL |
||
) |
Simplex downhill optimization function. Preconditions: points is a 2D mattrix of size (n+1) x n func is the cost function taking n an array of n params and returning float vals is the cost function in the n+1 simplex points, if NULL it will be computed
Postcondition: returns optimum value and points[0..n] are the optimum parameters
const size_t cvflann::WORDSIZE = 16 |
Pooled storage allocator
The following routines allow for the efficient allocation of storage in small chunks from a specified pool. Rather than allowing each structure to be freed individually, an entire pool of storage is freed at once. This method has two advantages over just using malloc() and free(). First, it is far more efficient for allocating small objects, as there is no overhead for remembering all the information needed to free each object or consolidating fragmented memory. Second, the decision about how long to keep an object is made at the time of allocation, and there is no need to track down all the objects to free them.
const size_t cvflann::BLOCKSIZE = 8192 |