Namespaces | |
anyimpl | |
lsh | |
Typedefs | |
typedef std::map< std::string, any > | IndexParams |
Functions | |
flann_distance_t | flann_distance_type () |
FLANN_DEPRECATED void | set_distance_type (flann_distance_t distance_type, int order) |
void | log_verbosity (int level) |
template<typename Distance > | |
NNIndex< Distance > * | load_saved_index (const Matrix< typename Distance::ElementType > &dataset, const std::string &filename, Distance distance) |
template<typename Distance > | |
int | hierarchicalClustering (const Matrix< typename Distance::ElementType > &points, Matrix< typename Distance::ResultType > ¢ers, const KMeansIndexParams ¶ms, Distance d=Distance()) |
template<typename T > | |
T * | allocate (size_t count=1) |
template<typename Distance > | |
NNIndex< Distance > * | create_index_by_type (const Matrix< typename Distance::ElementType > &dataset, const IndexParams ¶ms, const Distance &distance) |
void | seed_random (unsigned int seed) |
double | rand_double (double high=1.0, double low=0) |
int | rand_int (int high=RAND_MAX, int low=0) |
template<typename Distance > | |
void | save_header (FILE *stream, const NNIndex< Distance > &index) |
IndexHeader | load_header (FILE *stream) |
template<typename T > | |
void | save_value (FILE *stream, const T &value, size_t count=1) |
template<typename T > | |
void | save_value (FILE *stream, const cvflann::Matrix< T > &value) |
template<typename T > | |
void | save_value (FILE *stream, const std::vector< T > &value) |
template<typename T > | |
void | load_value (FILE *stream, T &value, size_t count=1) |
template<typename T > | |
void | load_value (FILE *stream, cvflann::Matrix< T > &value) |
template<typename T > | |
void | load_value (FILE *stream, std::vector< T > &value) |
template<typename Distance > | |
void | find_nearest (const Matrix< typename Distance::ElementType > &dataset, typename Distance::ElementType *query, int *matches, int nn, int skip=0, Distance distance=Distance()) |
template<typename Distance > | |
void | compute_ground_truth (const Matrix< typename Distance::ElementType > &dataset, const Matrix< typename Distance::ElementType > &testset, Matrix< int > &matches, int skip=0, Distance d=Distance()) |
template<typename T > | |
void | save_to_file (const cvflann::Matrix< T > &dataset, const std::string &filename, const std::string &name) |
template<typename T > | |
void | load_from_file (cvflann::Matrix< T > &dataset, const std::string &filename, const std::string &name) |
std::ostream & | operator<< (std::ostream &out, const any &any_val) |
template<typename T > | |
T | get_param (const IndexParams ¶ms, std::string name, const T &default_value) |
template<typename T > | |
T | get_param (const IndexParams ¶ms, std::string name) |
void | print_params (const IndexParams ¶ms, std::ostream &stream) |
void | print_params (const IndexParams ¶ms) |
int | countCorrectMatches (int *neighbors, int *groundTruth, int n) |
template<typename Distance > | |
Distance::ResultType | computeDistanceRaport (const Matrix< typename Distance::ElementType > &inputData, typename Distance::ElementType *target, int *neighbors, int *groundTruth, int veclen, int n, const Distance &distance) |
template<typename Distance > | |
float | search_with_ground_truth (NNIndex< Distance > &index, const Matrix< typename Distance::ElementType > &inputData, const Matrix< typename Distance::ElementType > &testData, const Matrix< int > &matches, int nn, int checks, float &time, typename Distance::ResultType &dist, const Distance &distance, int skipMatches) |
template<typename Distance > | |
float | test_index_checks (NNIndex< Distance > &index, const Matrix< typename Distance::ElementType > &inputData, const Matrix< typename Distance::ElementType > &testData, const Matrix< int > &matches, int checks, float &precision, const Distance &distance, int nn=1, int skipMatches=0) |
template<typename Distance > | |
float | test_index_precision (NNIndex< Distance > &index, const Matrix< typename Distance::ElementType > &inputData, const Matrix< typename Distance::ElementType > &testData, const Matrix< int > &matches, float precision, int &checks, const Distance &distance, int nn=1, int skipMatches=0) |
template<typename Distance > | |
void | test_index_precisions (NNIndex< Distance > &index, const Matrix< typename Distance::ElementType > &inputData, const Matrix< typename Distance::ElementType > &testData, const Matrix< int > &matches, float *precisions, int precisions_length, const Distance &distance, int nn=1, int skipMatches=0, float maxTime=0) |
template<typename T > | |
T | abs (T x) |
template<> | |
int | abs< int > (int x) |
template<> | |
float | abs< float > (float x) |
template<> | |
double | abs< double > (double x) |
template<typename Distance > | |
Distance::ResultType | ensureSquareDistance (typename Distance::ResultType dist) |
template<typename Distance > | |
Distance::ResultType | ensureSimpleDistance (typename Distance::ResultType dist) |
void | dummyfunc () |
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) |
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 |
typedef std::map<std::string, any> cvflann::IndexParams |
|
inline |
|
inline |
|
inline |
|
inline |
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.
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
void cvflann::compute_ground_truth | ( | const Matrix< typename Distance::ElementType > & | dataset, |
const Matrix< typename Distance::ElementType > & | testset, | ||
Matrix< int > & | matches, | ||
int | skip = 0 , |
||
Distance | d = Distance() |
||
) |
Distance::ResultType cvflann::computeDistanceRaport | ( | const Matrix< typename Distance::ElementType > & | inputData, |
typename Distance::ElementType * | target, | ||
int * | neighbors, | ||
int * | groundTruth, | ||
int | veclen, | ||
int | n, | ||
const Distance & | distance | ||
) |
NNIndex< Distance > * cvflann::create_index_by_type | ( | const Matrix< typename Distance::ElementType > & | dataset, |
const IndexParams & | params, | ||
const Distance & | distance | ||
) |
void cvflann::dummyfunc | ( | ) |
Distance::ResultType cvflann::ensureSimpleDistance | ( | typename Distance::ResultType | dist | ) |
Distance::ResultType cvflann::ensureSquareDistance | ( | typename Distance::ResultType | dist | ) |
void cvflann::find_nearest | ( | const Matrix< typename Distance::ElementType > & | dataset, |
typename Distance::ElementType * | query, | ||
int * | matches, | ||
int | nn, | ||
int | skip = 0 , |
||
Distance | distance = Distance() |
||
) |
flann_distance_t cvflann::flann_distance_type | ( | ) |
T cvflann::get_param | ( | const IndexParams & | params, |
std::string | name, | ||
const T & | default_value | ||
) |
T cvflann::get_param | ( | const IndexParams & | params, |
std::string | name | ||
) |
int cvflann::hierarchicalClustering | ( | const Matrix< typename Distance::ElementType > & | points, |
Matrix< typename Distance::ResultType > & | centers, | ||
const KMeansIndexParams & | params, | ||
Distance | d = Distance() |
||
) |
Performs a hierarchical clustering of the points passed as argument and then takes a cut in the the clustering tree to return a flat clustering.
[in] | points | Points to be clustered |
centers | The computed cluster centres. Matrix should be preallocated and centers.rows is the number of clusters requested. | |
params | Clustering parameters (The same as for cvflann::KMeansIndex) | |
d | Distance to be used for clustering (eg: cvflann::L2) |
void cvflann::load_from_file | ( | cvflann::Matrix< T > & | dataset, |
const std::string & | filename, | ||
const std::string & | name | ||
) |
|
inline |
stream | - Stream to load from |
NNIndex<Distance>* cvflann::load_saved_index | ( | const Matrix< typename Distance::ElementType > & | dataset, |
const std::string & | filename, | ||
Distance | distance | ||
) |
void cvflann::load_value | ( | FILE * | stream, |
T & | value, | ||
size_t | count = 1 |
||
) |
void cvflann::load_value | ( | FILE * | stream, |
cvflann::Matrix< T > & | value | ||
) |
void cvflann::load_value | ( | FILE * | stream, |
std::vector< T > & | value | ||
) |
Sets the log level used for all flann functions
level | Verbosity level |
|
inline |
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
|
inline |
|
inline |
|
inline |
Generates a random double value.
high | Upper limit |
low | Lower limit |
Generates a random integer value.
high | Upper limit |
low | Lower limit |
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 | ||
) |
void cvflann::save_header | ( | FILE * | stream, |
const NNIndex< Distance > & | index | ||
) |
Saves index header to stream
stream | - Stream to save to |
index | - The index to save |
void cvflann::save_to_file | ( | const cvflann::Matrix< T > & | dataset, |
const std::string & | filename, | ||
const std::string & | name | ||
) |
void cvflann::save_value | ( | FILE * | stream, |
const T & | value, | ||
size_t | count = 1 |
||
) |
void cvflann::save_value | ( | FILE * | stream, |
const cvflann::Matrix< T > & | value | ||
) |
void cvflann::save_value | ( | FILE * | stream, |
const std::vector< T > & | value | ||
) |
float cvflann::search_with_ground_truth | ( | NNIndex< Distance > & | index, |
const Matrix< typename Distance::ElementType > & | inputData, | ||
const Matrix< typename Distance::ElementType > & | testData, | ||
const Matrix< int > & | matches, | ||
int | nn, | ||
int | checks, | ||
float & | time, | ||
typename Distance::ResultType & | dist, | ||
const Distance & | distance, | ||
int | skipMatches | ||
) |
Seeds the random number generator
seed | Random seed |
FLANN_DEPRECATED void cvflann::set_distance_type | ( | flann_distance_t | distance_type, |
int | order | ||
) |
float cvflann::test_index_checks | ( | NNIndex< Distance > & | index, |
const Matrix< typename Distance::ElementType > & | inputData, | ||
const Matrix< typename Distance::ElementType > & | testData, | ||
const Matrix< int > & | matches, | ||
int | checks, | ||
float & | precision, | ||
const Distance & | distance, | ||
int | nn = 1 , |
||
int | skipMatches = 0 |
||
) |
float cvflann::test_index_precision | ( | NNIndex< Distance > & | index, |
const Matrix< typename Distance::ElementType > & | inputData, | ||
const Matrix< typename Distance::ElementType > & | testData, | ||
const Matrix< int > & | matches, | ||
float | precision, | ||
int & | checks, | ||
const Distance & | distance, | ||
int | nn = 1 , |
||
int | skipMatches = 0 |
||
) |
void cvflann::test_index_precisions | ( | NNIndex< Distance > & | index, |
const Matrix< typename Distance::ElementType > & | inputData, | ||
const Matrix< typename Distance::ElementType > & | testData, | ||
const Matrix< int > & | matches, | ||
float * | precisions, | ||
int | precisions_length, | ||
const Distance & | distance, | ||
int | nn = 1 , |
||
int | skipMatches = 0 , |
||
float | maxTime = 0 |
||
) |
const size_t cvflann::BLOCKSIZE =8192 |
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.