libvot
0.1.3
A C++11 multithread library for image retrieval
|
namespace tw is mostly related to some utility functions developed by the repository owner, Tianwei Shen. More...
Classes | |
class | IO |
To safely read and write files. More... | |
class | SiftData |
Sift data structure used in libvot. More... | |
class | UnionFind |
Union-find data structure, used in various graph algorithms. More... | |
struct | VlFeatParam |
a parameter struct used in calling vlfeat sift function More... | |
struct | Vlfeature |
a struct containing the data of vlfeat features More... | |
Functions | |
bool | OpencvKeyPoints2libvotSift (std::vector< cv::KeyPoint > &key_points, cv::Mat &descriptors, tw::SiftData &sift_data) |
bool | Vlfeature2LibvotSift (std::vector< Vlfeature > const &vlfeature_vec, unsigned char const *data, int image_width, int image_height, int num_channel, tw::SiftData &sift_data) |
void | VlFeatureDetection (unsigned char const *data, std::vector< Vlfeature > &vlfeature_vec, int image_width, int image_height, VlFeatParam const &vlfeat_param) |
int | RunVlFeature (unsigned char *data, int image_width, int image_height, int num_channel, SiftData &sift_data, VlFeatParam const &vlfeat_param) |
template<typename T > | |
T * | allocate_2d (T ***array, int row, int col) |
template<typename T > | |
void | free_2d (T ***array, T *data) |
template int * | allocate_2d< int > (int ***array, int row, int col) |
template void | free_2d< int > (int ***array, int *data) |
template float * | allocate_2d< float > (float ***array, int row, int col) |
template void | free_2d< float > (float ***array, float *data) |
template double * | allocate_2d< double > (double ***array, int row, int col) |
template void | free_2d< double > (double ***array, double *data) |
template vot::LinkEdge * | allocate_2d< vot::LinkEdge > (vot::LinkEdge ***array, int row, int col) |
template void | free_2d< vot::LinkEdge > (vot::LinkEdge ***array, vot::LinkEdge *data) |
void | GetIntialCenters (size_t n, int k, size_t *initial_idx) |
void | CopyDes2Double (double *dst, DTYPE *src, int length) |
double | DisDes2Double (double *dst, DTYPE *src, int length) |
void | MultiComputeAssignment (size_t num, int dim, int k, DTYPE **des, double *means, int *assignment, double *error_out, size_t *changed_num) |
size_t | ComputeAssignment (size_t num, int dim, int k, DTYPE **p, double *means, int *assignment, double &error_out, int thread_num) |
Compute new assignment for each feature points. More... | |
void | MultiDesAccumulation (size_t num, int dim, int k, DTYPE **p, int *assignment_curr, double *totals, size_t *counts) |
Accumulate the feature descriptors to the total, a subroutine used by multi-threaded version of ComputeMeans. More... | |
void | ComputeMeans (size_t num, int dim, int k, DTYPE **p, int *assignment_curr, double *means_curr, int thread_num) |
Compute new means for each cluster. More... | |
double | ComputeError (size_t num, int dim, int k, DTYPE **p, double *means, int *assignment) |
double | Kmeans (size_t num, int dim, int k, DTYPE **p, double *means, int *assignment, int thread_num) |
namespace tw is mostly related to some utility functions developed by the repository owner, Tianwei Shen.
It includes some utility classes and functions, such as the file I/O class.
T * tw::allocate_2d | ( | T *** | arr, |
int | row, | ||
int | col | ||
) |
allocate a continuous 2d array
template double* tw::allocate_2d< double > | ( | double *** | array, |
int | row, | ||
int | col | ||
) |
template float* tw::allocate_2d< float > | ( | float *** | array, |
int | row, | ||
int | col | ||
) |
template int* tw::allocate_2d< int > | ( | int *** | array, |
int | row, | ||
int | col | ||
) |
template vot::LinkEdge* tw::allocate_2d< vot::LinkEdge > | ( | vot::LinkEdge *** | array, |
int | row, | ||
int | col | ||
) |
size_t tw::ComputeAssignment | ( | size_t | num, |
int | dim, | ||
int | k, | ||
DTYPE ** | p, | ||
double * | means, | ||
int * | assignment, | ||
double & | error_out, | ||
int | thread_num | ||
) |
Compute new assignment for each feature points.
num | - the total number of feature points |
dim | - the dimension of the feature points |
k | - the number of clusters |
p | - the address to the feature points |
means | - the descriptors of the clusters |
assignment | - the input and output assignments |
error | - total error of the new assignment |
thread_num | - thread number |
double tw::ComputeError | ( | size_t | num, |
int | dim, | ||
int | k, | ||
DTYPE ** | p, | ||
double * | means, | ||
int * | assignment | ||
) |
void tw::ComputeMeans | ( | size_t | num, |
int | dim, | ||
int | k, | ||
DTYPE ** | p, | ||
int * | assignment_curr, | ||
double * | means_curr, | ||
int | thread_num | ||
) |
Compute new means for each cluster.
num | - the total number of feature points |
dim | - the dimension of the feature points |
k | - the number of clusters |
assignment_curr | - the current assignments computed by ComputeAssignment |
means_curr | - the means of clusters |
thread_num | - the number of threads |
|
inline |
|
inline |
void tw::free_2d | ( | T *** | array, |
T * | data | ||
) |
free a continuous 2d array, both the raw pointer to the data and the 2d array pointers are needed.
template void tw::free_2d< double > | ( | double *** | array, |
double * | data | ||
) |
template void tw::free_2d< float > | ( | float *** | array, |
float * | data | ||
) |
template void tw::free_2d< int > | ( | int *** | array, |
int * | data | ||
) |
template void tw::free_2d< vot::LinkEdge > | ( | vot::LinkEdge *** | array, |
vot::LinkEdge * | data | ||
) |
void tw::GetIntialCenters | ( | size_t | n, |
int | k, | ||
size_t * | initial_idx | ||
) |
Random sample k indexes for [1...n] without replacement
double tw::Kmeans | ( | size_t | num, |
int | dim, | ||
int | k, | ||
DTYPE ** | p, | ||
double * | means, | ||
int * | assignment, | ||
int | thread_num | ||
) |
void tw::MultiComputeAssignment | ( | size_t | num, |
int | dim, | ||
int | k, | ||
DTYPE ** | des, | ||
double * | means, | ||
int * | assignment, | ||
double * | error_out, | ||
size_t * | changed_num | ||
) |
void tw::MultiDesAccumulation | ( | size_t | num, |
int | dim, | ||
int | k, | ||
DTYPE ** | p, | ||
int * | assignment_curr, | ||
double * | totals, | ||
size_t * | counts | ||
) |
Accumulate the feature descriptors to the total, a subroutine used by multi-threaded version of ComputeMeans.
num | - the total number of feature points |
start_id | - the start index for this thread |
dim | - the dimension of the feature points |
k | - the number of clusters |
p | - the address to the starting feature point |
assignment_curr | - the current assignments computed by ComputeAssignment |
total | - accumulator |
counts | - counter |
bool tw::OpencvKeyPoints2libvotSift | ( | std::vector< cv::KeyPoint > & | key_points, |
cv::Mat & | descriptors, | ||
tw::SiftData & | sift_data | ||
) |
int tw::RunVlFeature | ( | unsigned char * | data, |
int | image_width, | ||
int | image_height, | ||
int | num_channel, | ||
SiftData & | sift_data, | ||
VlFeatParam const & | vlfeat_param | ||
) |
bool tw::Vlfeature2LibvotSift | ( | std::vector< Vlfeature > const & | vlfeature_vec, |
unsigned char const * | data, | ||
int | image_width, | ||
int | image_height, | ||
int | num_channel, | ||
tw::SiftData & | sift_data | ||
) |
void tw::VlFeatureDetection | ( | unsigned char const * | data, |
std::vector< Vlfeature > & | vlfeature_vec, | ||
int | image_width, | ||
int | image_height, | ||
VlFeatParam const & | vlfeat_param | ||
) |