libvot  0.1.3
A C++11 multithread library for image retrieval
Public Member Functions | Public Attributes | List of all members
vot::VocabTree Class Reference

The vocabulary tree class. The depth of the root is 0. The depth of the leaf nodes is depth+1. More...

#include <vocab_tree.h>

Public Member Functions

 VocabTree ()
 
 VocabTree (int depth_, int branch_num_, int dim_=128, DistanceType dis_type_=L2)
 
 ~VocabTree ()
 
bool BuildTree (size_t num_keys, int dim, int depth, int bf, DTYPE **p, int thread_num=1)
 build a vocabulary tree from a set of features More...
 
bool WriteTree (const char *filename) const
 save the vocabulary tree in a file More...
 
bool ReadTree (const char *filename)
 read a vocabulary tree from a file More...
 
bool ClearTree ()
 release the memory More...
 
bool Compare (VocabTree &v) const
 compare two vocabulary tree and returns whether they are the same More...
 
double AddImage2Tree (size_t image_index, tw::SiftData &sift, int thread_num)
 add an image into the database (support multi-thread) More...
 
void Show () const
 a test function More...
 
bool SetConstantWeight ()
 set a constant weight to the leaf nodes More...
 
bool ComputeTFIDFWeight (size_t image_num)
 compute TF-IDF weight and pre-apply weight adjusting to inverted lists More...
 
bool NormalizeDatabase (size_t start_id, size_t image_num)
 normalize the inverted list score by the magnitude of image vector More...
 
bool Query (tw::SiftData &sift, float *scores)
 query database and return the scores More...
 
size_t IndexLeaves ()
 index the leaf nodes More...
 

Public Attributes

int branch_num
 the branch number of a node More...
 
int depth
 the depth of the tree More...
 
int dim
 the dimension of the descriptor More...
 
size_t database_image_num
 the number of the database images More...
 
size_t num_nodes
 the number of nodes in the tree More...
 
size_t num_leaves
 the number of leaf nodes in the tree More...
 
DistanceType dis_type
 the distance type More...
 
TreeNode * root
 the root of the tree More...
 

Detailed Description

The vocabulary tree class. The depth of the root is 0. The depth of the leaf nodes is depth+1.

Constructor & Destructor Documentation

vot::VocabTree::VocabTree ( )

VocabTree Class Implementation

vot::VocabTree::VocabTree ( int  depth_,
int  branch_num_,
int  dim_ = 128,
DistanceType  dis_type_ = L2 
)
vot::VocabTree::~VocabTree ( )

Member Function Documentation

double vot::VocabTree::AddImage2Tree ( size_t  image_index,
tw::SiftData &  sift,
int  thread_num 
)

add an image into the database (support multi-thread)

bool vot::VocabTree::BuildTree ( size_t  num_keys,
int  dim,
int  depth,
int  bf,
DTYPE **  p,
int  thread_num = 1 
)

build a vocabulary tree from a set of features

bool vot::VocabTree::ClearTree ( )

release the memory

bool vot::VocabTree::Compare ( VocabTree &  v) const

compare two vocabulary tree and returns whether they are the same

bool vot::VocabTree::ComputeTFIDFWeight ( size_t  image_num)

compute TF-IDF weight and pre-apply weight adjusting to inverted lists

size_t vot::VocabTree::IndexLeaves ( )

index the leaf nodes

bool vot::VocabTree::NormalizeDatabase ( size_t  start_id,
size_t  image_num 
)

normalize the inverted list score by the magnitude of image vector

bool vot::VocabTree::Query ( tw::SiftData &  sift,
float *  scores 
)

query database and return the scores

bool vot::VocabTree::ReadTree ( const char *  filename)

read a vocabulary tree from a file

bool vot::VocabTree::SetConstantWeight ( )

set a constant weight to the leaf nodes

void vot::VocabTree::Show ( ) const

a test function

bool vot::VocabTree::WriteTree ( const char *  filename) const

save the vocabulary tree in a file

Member Data Documentation

int vot::VocabTree::branch_num

the branch number of a node

size_t vot::VocabTree::database_image_num

the number of the database images

int vot::VocabTree::depth

the depth of the tree

int vot::VocabTree::dim

the dimension of the descriptor

DistanceType vot::VocabTree::dis_type

the distance type

size_t vot::VocabTree::num_leaves

the number of leaf nodes in the tree

size_t vot::VocabTree::num_nodes

the number of nodes in the tree

TreeNode* vot::VocabTree::root

the root of the tree


The documentation for this class was generated from the following files: