OpenCV  3.0.0
Open Source Computer Vision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
cvflann Namespace Reference

Namespaces

 anyimpl
 
 lsh
 

Classes

struct  Accumulator
 
struct  Accumulator< char >
 
struct  Accumulator< int >
 
struct  Accumulator< short >
 
struct  Accumulator< unsigned char >
 
struct  Accumulator< unsigned int >
 
struct  Accumulator< unsigned short >
 
struct  any
 
class  AutotunedIndex
 
struct  AutotunedIndexParams
 
struct  BranchStruct
 
struct  ChiSquareDistance
 
class  CompositeIndex
 
struct  CompositeIndexParams
 
class  CreatorNotFound
 
struct  Datatype
 
struct  Datatype< char >
 
struct  Datatype< double >
 
struct  Datatype< float >
 
struct  Datatype< int >
 
struct  Datatype< short >
 
struct  Datatype< unsigned char >
 
struct  Datatype< unsigned int >
 
struct  Datatype< unsigned short >
 
class  DynamicBitset
 
class  False
 
class  FLANNException
 
struct  Hamming
 
struct  Hamming2
 
struct  HammingLUT
 
class  Heap
 
struct  HellingerDistance
 
class  HierarchicalClusteringIndex
 
struct  HierarchicalClusteringIndexParams
 
struct  HistIntersectionDistance
 
class  Index
 
struct  index_creator
 
struct  index_creator< False, False, Distance >
 
struct  index_creator< False, VectorSpace, Distance >
 
struct  IndexHeader
 
class  KDTreeIndex
 
struct  KDTreeIndexParams
 
class  KDTreeSingleIndex
 
struct  KDTreeSingleIndexParams
 
struct  KL_Divergence
 
class  KMeansIndex
 
struct  KMeansIndexParams
 
class  KNNRadiusUniqueResultSet
 
class  KNNResultSet
 
class  KNNSimpleResultSet
 
class  KNNUniqueResultSet
 
struct  L1
 
struct  L2
 
struct  L2_Simple
 
class  LinearIndex
 
struct  LinearIndexParams
 
class  Logger
 
class  LshIndex
 
struct  LshIndexParams
 
class  Matrix
 
struct  MaxDistance
 
struct  MinkowskiDistance
 
class  NNIndex
 
class  ObjectFactory
 
class  PooledAllocator
 
class  RadiusResultSet
 
class  RadiusUniqueResultSet
 
class  ResultSet
 
struct  SavedIndexParams
 
struct  SearchParams
 
struct  simpleDistance
 
struct  simpleDistance< ChiSquareDistance< ElementType >, ElementType >
 
struct  simpleDistance< HellingerDistance< ElementType >, ElementType >
 
struct  simpleDistance< L2< ElementType >, ElementType >
 
struct  simpleDistance< L2_Simple< ElementType >, ElementType >
 
struct  simpleDistance< MinkowskiDistance< ElementType >, ElementType >
 
struct  squareDistance
 
struct  squareDistance< ChiSquareDistance< ElementType >, ElementType >
 
struct  squareDistance< HellingerDistance< ElementType >, ElementType >
 
struct  squareDistance< L2< ElementType >, ElementType >
 
struct  squareDistance< L2_Simple< ElementType >, ElementType >
 
struct  squareDistance< MinkowskiDistance< ElementType >, ElementType >
 
class  StartStopTimer
 
class  True
 
class  UniqueRandom
 
class  UniqueResultSet
 
class  UntypedMatrix
 
struct  ZeroIterator
 

Typedefs

typedef std::map< cv::String, anyIndexParams
 

Enumerations

enum  {
  FLANN_CHECKS_UNLIMITED = -1,
  FLANN_CHECKS_AUTOTUNED = -2
}
 
enum  flann_algorithm_t {
  FLANN_INDEX_LINEAR = 0,
  FLANN_INDEX_KDTREE = 1,
  FLANN_INDEX_KMEANS = 2,
  FLANN_INDEX_COMPOSITE = 3,
  FLANN_INDEX_KDTREE_SINGLE = 4,
  FLANN_INDEX_HIERARCHICAL = 5,
  FLANN_INDEX_LSH = 6,
  FLANN_INDEX_SAVED = 254,
  FLANN_INDEX_AUTOTUNED = 255,
  LINEAR = 0,
  KDTREE = 1,
  KMEANS = 2,
  COMPOSITE = 3,
  KDTREE_SINGLE = 4,
  SAVED = 254,
  AUTOTUNED = 255
}
 
enum  flann_centers_init_t {
  FLANN_CENTERS_RANDOM = 0,
  FLANN_CENTERS_GONZALES = 1,
  FLANN_CENTERS_KMEANSPP = 2,
  FLANN_CENTERS_GROUPWISE = 3,
  CENTERS_RANDOM = 0,
  CENTERS_GONZALES = 1,
  CENTERS_KMEANSPP = 2
}
 
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_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,
  FLANN_DIST_HAMMING = 9,
  EUCLIDEAN = 1,
  MANHATTAN = 2,
  MINKOWSKI = 3,
  MAX_DIST = 4,
  HIST_INTERSECT = 5,
  HELLINGER = 6,
  CS = 7,
  KL = 8,
  KULLBACK_LEIBLER = 8
}
 
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 >
abs (T x)
 
template<>
double abs< double > (double x)
 
template<>
float abs< float > (float x)
 
template<typename T >
void addValue (int pos, float val, float *vals, T *point, T *points, int n)
 
template<typename T >
T * allocate (size_t count=1)
 
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 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)
 
int countCorrectMatches (int *neighbors, int *groundTruth, int n)
 
template<typename Distance >
NNIndex< Distance > * create_index_by_type (const Matrix< typename Distance::ElementType > &dataset, const IndexParams &params, const Distance &distance)
 
void dummyfunc ()
 
template<typename Distance >
Distance::ResultType ensureSimpleDistance (typename Distance::ResultType dist)
 
template<typename Distance >
Distance::ResultType ensureSquareDistance (typename Distance::ResultType dist)
 
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())
 
flann_distance_t flann_distance_type ()
 
template<typename T >
get_param (const IndexParams &params, cv::String name, const T &default_value)
 
template<typename T >
get_param (const IndexParams &params, cv::String name)
 
template<typename Distance >
int hierarchicalClustering (const Matrix< typename Distance::ElementType > &points, Matrix< typename Distance::ResultType > &centers, const KMeansIndexParams &params, Distance d=Distance())
 
template<typename T >
void load_from_file (cvflann::Matrix< T > &dataset, const String &filename, const String &name)
 
IndexHeader load_header (FILE *stream)
 
template<typename Distance >
NNIndex< Distance > * load_saved_index (const Matrix< typename Distance::ElementType > &dataset, const cv::String &filename, Distance distance)
 
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)
 
void log_verbosity (int level)
 
std::ostream & operator<< (std::ostream &out, const any &any_val)
 
template<typename T , typename F >
float optimizeSimplexDownhill (T *points, int n, F func, float *vals=NULL)
 
void print_params (const IndexParams &params, std::ostream &stream)
 
void print_params (const IndexParams &params)
 
double rand_double (double high=1.0, double low=0)
 
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)
 
template<typename Distance >
void save_header (FILE *stream, const NNIndex< Distance > &index)
 
template<typename T >
void save_to_file (const cvflann::Matrix< T > &dataset, const String &filename, const String &name)
 
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 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)
 
void seed_random (unsigned int seed)
 
void set_distance_type (flann_distance_t distance_type, int order)
 
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)
 

Variables

const size_t BLOCKSIZE =8192
 
const size_t WORDSIZE =16
 

Typedef Documentation

typedef std::map<cv::String, any> cvflann::IndexParams

Enumeration Type Documentation

anonymous enum
Enumerator
FLANN_CHECKS_UNLIMITED 
FLANN_CHECKS_AUTOTUNED 
Enumerator
FLANN_INDEX_LINEAR 
FLANN_INDEX_KDTREE 
FLANN_INDEX_KMEANS 
FLANN_INDEX_COMPOSITE 
FLANN_INDEX_KDTREE_SINGLE 
FLANN_INDEX_HIERARCHICAL 
FLANN_INDEX_LSH 
FLANN_INDEX_SAVED 
FLANN_INDEX_AUTOTUNED 
LINEAR 
KDTREE 
KMEANS 
COMPOSITE 
KDTREE_SINGLE 
SAVED 
AUTOTUNED 
Enumerator
FLANN_CENTERS_RANDOM 
FLANN_CENTERS_GONZALES 
FLANN_CENTERS_KMEANSPP 
FLANN_CENTERS_GROUPWISE 
CENTERS_RANDOM 
CENTERS_GONZALES 
CENTERS_KMEANSPP 
Enumerator
FLANN_INT8 
FLANN_INT16 
FLANN_INT32 
FLANN_INT64 
FLANN_UINT8 
FLANN_UINT16 
FLANN_UINT32 
FLANN_UINT64 
FLANN_FLOAT32 
FLANN_FLOAT64 
Enumerator
FLANN_DIST_EUCLIDEAN 
FLANN_DIST_L2 
FLANN_DIST_MANHATTAN 
FLANN_DIST_L1 
FLANN_DIST_MINKOWSKI 
FLANN_DIST_MAX 
FLANN_DIST_HIST_INTERSECT 
FLANN_DIST_HELLINGER 
FLANN_DIST_CHI_SQUARE 
FLANN_DIST_CS 
FLANN_DIST_KULLBACK_LEIBLER 
FLANN_DIST_KL 
FLANN_DIST_HAMMING 
EUCLIDEAN 
MANHATTAN 
MINKOWSKI 
MAX_DIST 
HIST_INTERSECT 
HELLINGER 
CS 
KL 
KULLBACK_LEIBLER 
Enumerator
FLANN_LOG_NONE 
FLANN_LOG_FATAL 
FLANN_LOG_ERROR 
FLANN_LOG_WARN 
FLANN_LOG_INFO 

Function Documentation

template<typename T >
T cvflann::abs ( x)
inline
template<>
double cvflann::abs< double > ( double  x)
inline
template<>
float cvflann::abs< float > ( float  x)
inline
template<typename T >
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.

template<typename T >
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

template<typename Distance >
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() 
)
template<typename 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 
)
int cvflann::countCorrectMatches ( int *  neighbors,
int *  groundTruth,
int  n 
)
inline
template<typename Distance >
NNIndex< Distance > * cvflann::create_index_by_type ( const Matrix< typename Distance::ElementType > &  dataset,
const IndexParams &  params,
const Distance &  distance 
)
void cvflann::dummyfunc ( )
template<typename Distance >
Distance::ResultType cvflann::ensureSimpleDistance ( typename Distance::ResultType  dist)
template<typename Distance >
Distance::ResultType cvflann::ensureSquareDistance ( typename Distance::ResultType  dist)
template<typename Distance >
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 ( )
template<typename T >
T cvflann::get_param ( const IndexParams &  params,
cv::String  name,
const T &  default_value 
)
template<typename T >
T cvflann::get_param ( const IndexParams &  params,
cv::String  name 
)
template<typename Distance >
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.

Parameters
[in]pointsPoints to be clustered
centersThe computed cluster centres. Matrix should be preallocated and centers.rows is the number of clusters requested.
paramsClustering parameters (The same as for cvflann::KMeansIndex)
dDistance to be used for clustering (eg: cvflann::L2)
Returns
number of clusters computed (can be different than clusters.rows and is the highest number of the form (branching-1)*K+1 smaller than clusters.rows).
template<typename T >
void cvflann::load_from_file ( cvflann::Matrix< T > &  dataset,
const String &  filename,
const String &  name 
)
IndexHeader cvflann::load_header ( FILE *  stream)
inline
Parameters
stream- Stream to load from
Returns
Index header
template<typename Distance >
NNIndex<Distance>* cvflann::load_saved_index ( const Matrix< typename Distance::ElementType > &  dataset,
const cv::String filename,
Distance  distance 
)
template<typename T >
void cvflann::load_value ( FILE *  stream,
T &  value,
size_t  count = 1 
)
template<typename T >
void cvflann::load_value ( FILE *  stream,
cvflann::Matrix< T > &  value 
)
template<typename T >
void cvflann::load_value ( FILE *  stream,
std::vector< T > &  value 
)
void cvflann::log_verbosity ( int  level)
inline

Sets the log level used for all flann functions

Parameters
levelVerbosity level
std::ostream& cvflann::operator<< ( std::ostream &  out,
const any &  any_val 
)
inline
template<typename T , typename F >
float cvflann::optimizeSimplexDownhill ( T *  points,
int  n,
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

void cvflann::print_params ( const IndexParams &  params,
std::ostream &  stream 
)
inline
void cvflann::print_params ( const IndexParams &  params)
inline
double cvflann::rand_double ( double  high = 1.0,
double  low = 0 
)
inline

Generates a random double value.

Parameters
highUpper limit
lowLower limit
Returns
Random double value
int cvflann::rand_int ( int  high = RAND_MAX,
int  low = 0 
)
inline

Generates a random integer value.

Parameters
highUpper limit
lowLower limit
Returns
Random integer value
template<typename T >
Matrix<T> cvflann::random_sample ( Matrix< T > &  srcMatrix,
long  size,
bool  remove = false 
)
template<typename T >
Matrix<T> cvflann::random_sample ( const Matrix< T > &  srcMatrix,
size_t  size 
)
template<typename Distance >
void cvflann::save_header ( FILE *  stream,
const NNIndex< Distance > &  index 
)

Saves index header to stream

Parameters
stream- Stream to save to
index- The index to save
template<typename T >
void cvflann::save_to_file ( const cvflann::Matrix< T > &  dataset,
const String &  filename,
const String &  name 
)
template<typename T >
void cvflann::save_value ( FILE *  stream,
const T &  value,
size_t  count = 1 
)
template<typename T >
void cvflann::save_value ( FILE *  stream,
const cvflann::Matrix< T > &  value 
)
template<typename T >
void cvflann::save_value ( FILE *  stream,
const std::vector< T > &  value 
)
template<typename Distance >
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 
)
void cvflann::seed_random ( unsigned int  seed)
inline

Seeds the random number generator

Parameters
seedRandom seed
void cvflann::set_distance_type ( flann_distance_t  distance_type,
int  order 
)
template<typename Distance >
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 
)
template<typename Distance >
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 
)
template<typename Distance >
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 
)

Variable Documentation

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.