#include <idcluster.h>
Classes | |
struct | cluster_dist_t |
Public Types | |
enum | query_flags { QUERY_FREQ = 0, QUERY_NORMALIZED_FREQ = 1, QUERY_IDF = 2, QUERY_MIN_FREQ = 4, QUERY_BIN_FREQ = 8, QUERY_IDF_NORMALIZED = 3 } |
typedef std::set< id_cluster * > | cluster_set |
typedef vecmap< id_cluster *, float > | cluster_map |
typedef std::map< unsigned, cluster_map > | id2cluster_map |
Public Member Functions | |
id_cluster_collection (query_flags flags) | |
virtual | ~id_cluster_collection () |
void | reduce (float threshold) |
void | add_cluster (id_cluster *c) |
void | remove_cluster (id_cluster *c) |
void | update_cluster (id_cluster *c, unsigned id, int amount) |
void | merge_clusters (id_cluster *a, id_cluster *b) |
void | cmp_best_clusters () |
unsigned | get_best_cluster (unsigned id) |
id_cluster * | get_best_cluster (id_cluster *c, float *dist) |
void | print () |
bool | save (const char *fn) |
bool | save (FILE *f) |
bool | save (sqlite3 *db, const char *tablename=0) |
bool | load (const char *fn) |
bool | load (sqlite3 *db, const char *tablename=0) |
void | clear () |
float | idf (unsigned id) |
float | idf (id2cluster_map::iterator &id_it) |
void | get_scores (id_cluster *c, cluster_score_map &scores, id_cluster **best_c=0, float *_best_s=0) |
void | set_query_rules (query_flags flags) |
int | get_version () const |
Public Attributes | |
cluster_set | clusters |
id2cluster_map | id2cluster |
id2cluster[i][j].second contains the value of dimension i of the j'th vector with non-0 value at dim i. | |
std::map< unsigned, id_cluster * > | best_cluster |
Protected Member Functions | |
void | build_distance_matrix (float threshold) |
void | add_to_distance_matrix (id_cluster *c, float threshold) |
void | remove_from_distance_matrix (id_cluster *c) |
Protected Attributes | |
std::set< cluster_dist_t > | distance_matrix |
int | version |
Friends | |
class | incremental_query |
Definition at line 68 of file idcluster.h.
typedef vecmap<id_cluster *, float> id_cluster_collection::cluster_map |
Definition at line 73 of file idcluster.h.
typedef std::set<id_cluster *> id_cluster_collection::cluster_set |
Definition at line 71 of file idcluster.h.
typedef std::map<unsigned, cluster_map> id_cluster_collection::id2cluster_map |
Definition at line 75 of file idcluster.h.
QUERY_FREQ | |
QUERY_NORMALIZED_FREQ | |
QUERY_IDF | |
QUERY_MIN_FREQ | |
QUERY_BIN_FREQ | |
QUERY_IDF_NORMALIZED |
Definition at line 77 of file idcluster.h.
id_cluster_collection::id_cluster_collection | ( | id_cluster_collection::query_flags | flags | ) |
Definition at line 38 of file idcluster.cpp.
id_cluster_collection::~id_cluster_collection | ( | ) | [virtual] |
void id_cluster_collection::add_cluster | ( | id_cluster * | c | ) |
Definition at line 149 of file idcluster.cpp.
References clusters, id_cluster::histo, id_cluster::id, id2cluster, and version.
Referenced by visual_database::add_to_index(), load(), load_patch_track(), and pic_randomizer::save_points().
void id_cluster_collection::add_to_distance_matrix | ( | id_cluster * | c, | |
float | threshold | |||
) | [protected] |
Definition at line 625 of file idcluster.cpp.
References id_cluster_collection::cluster_dist_t::d, distance_matrix, and get_scores().
Referenced by build_distance_matrix(), and reduce().
void id_cluster_collection::build_distance_matrix | ( | float | threshold | ) | [protected] |
Definition at line 567 of file idcluster.cpp.
References add_to_distance_matrix(), clusters, and distance_matrix.
Referenced by reduce().
void id_cluster_collection::clear | ( | ) |
Definition at line 669 of file idcluster.cpp.
References best_cluster, clusters, distance_matrix, id2cluster, and version.
void id_cluster_collection::cmp_best_clusters | ( | ) |
Definition at line 440 of file idcluster.cpp.
References best_cluster, and id2cluster.
Referenced by load().
id_cluster * id_cluster_collection::get_best_cluster | ( | id_cluster * | c, | |
float * | dist | |||
) |
unsigned id_cluster_collection::get_best_cluster | ( | unsigned | id | ) |
void id_cluster_collection::get_scores | ( | id_cluster * | c, | |
cluster_score_map & | scores, | |||
id_cluster ** | best_c = 0 , |
|||
float * | _best_s = 0 | |||
) |
Definition at line 98 of file idcluster.cpp.
References id_cluster::histo, id2cluster, idf(), QUERY_IDF, QUERY_NORMALIZED_FREQ, set_query_rules(), and id_cluster::total.
Referenced by add_to_distance_matrix(), get_best_cluster(), and remove_from_distance_matrix().
int id_cluster_collection::get_version | ( | ) | const [inline] |
Definition at line 136 of file idcluster.h.
References version.
Referenced by init_query_with_frame().
float id_cluster_collection::idf | ( | id2cluster_map::iterator & | id_it | ) |
float id_cluster_collection::idf | ( | unsigned | id | ) |
Definition at line 686 of file idcluster.cpp.
References id2cluster.
Referenced by get_correspondences(), visual_object::get_correspondences_std(), get_scores(), incremental_query::modify(), and set_query_rules().
bool id_cluster_collection::load | ( | sqlite3 * | db, | |
const char * | tablename = 0 | |||
) |
Definition at line 337 of file idcluster.cpp.
References id_cluster::add(), add_cluster(), clusters, and cmp_best_clusters().
bool id_cluster_collection::load | ( | const char * | fn | ) |
Definition at line 383 of file idcluster.cpp.
References id_cluster::add(), add_cluster(), cmp_best_clusters(), id_cluster::total, and version.
Referenced by kpt_tracker::load_clusters(), and main().
void id_cluster_collection::merge_clusters | ( | id_cluster * | a, | |
id_cluster * | b | |||
) |
Definition at line 43 of file idcluster.cpp.
References id_cluster::add(), id_cluster::histo, id2cluster, remove_cluster(), and version.
Referenced by reduce().
void id_cluster_collection::print | ( | ) |
void id_cluster_collection::reduce | ( | float | threshold | ) |
Definition at line 468 of file idcluster.cpp.
References id_cluster_collection::cluster_dist_t::a, add_to_distance_matrix(), id_cluster_collection::cluster_dist_t::b, build_distance_matrix(), clusters, id_cluster_collection::cluster_dist_t::d, distance_matrix, merge_clusters(), remove_from_distance_matrix(), and version.
Referenced by main().
void id_cluster_collection::remove_cluster | ( | id_cluster * | c | ) |
Definition at line 521 of file idcluster.cpp.
References clusters, id_cluster::histo, id2cluster, and version.
Referenced by merge_clusters(), and visual_database::remove_object().
void id_cluster_collection::remove_from_distance_matrix | ( | id_cluster * | c | ) | [protected] |
Definition at line 579 of file idcluster.cpp.
References distance_matrix, and get_scores().
Referenced by reduce().
bool id_cluster_collection::save | ( | sqlite3 * | db, | |
const char * | tablename = 0 | |||
) |
bool id_cluster_collection::save | ( | FILE * | f | ) |
bool id_cluster_collection::save | ( | const char * | fn | ) |
Definition at line 254 of file idcluster.cpp.
Referenced by main(), and pic_randomizer::save_points().
void id_cluster_collection::set_query_rules | ( | id_cluster_collection::query_flags | _flags | ) |
Definition at line 68 of file idcluster.cpp.
References clusters, idf(), QUERY_BIN_FREQ, and QUERY_IDF.
Referenced by get_scores(), incremental_query::modify(), and incremental_query::set_all_flags().
void id_cluster_collection::update_cluster | ( | id_cluster * | c, | |
unsigned | id, | |||
int | amount | |||
) |
Definition at line 539 of file idcluster.cpp.
References id_cluster::add(), clusters, id2cluster, QUERY_BIN_FREQ, QUERY_IDF, id_cluster::total, version, and id_cluster::weighted_sum.
Referenced by visual_object::add_keypoint().
friend class incremental_query [friend] |
Definition at line 142 of file idcluster.h.
Referenced by visual_database::create_incremental_query().
std::map<unsigned, id_cluster *> id_cluster_collection::best_cluster |
Definition at line 109 of file idcluster.h.
Referenced by clear(), cmp_best_clusters(), and get_best_cluster().
Definition at line 105 of file idcluster.h.
Referenced by add_cluster(), build_distance_matrix(), clear(), load(), main(), print(), reduce(), remove_cluster(), save(), set_query_rules(), update_cluster(), and ~id_cluster_collection().
std::set<cluster_dist_t> id_cluster_collection::distance_matrix [protected] |
Definition at line 122 of file idcluster.h.
Referenced by add_to_distance_matrix(), build_distance_matrix(), clear(), reduce(), and remove_from_distance_matrix().
id2cluster[i][j].second contains the value of dimension i of the j'th vector with non-0 value at dim i.
Definition at line 108 of file idcluster.h.
Referenced by add_cluster(), clear(), cmp_best_clusters(), get_correspondences(), visual_object::get_correspondences_std(), get_scores(), idf(), merge_clusters(), incremental_query::modify(), print(), remove_cluster(), and update_cluster().
int id_cluster_collection::version [protected] |
Definition at line 134 of file idcluster.h.
Referenced by add_cluster(), visual_object::add_frame(), incremental_query::clear(), clear(), visual_database::connect_to_db(), visual_database::create_object(), get_version(), incremental_query::incremental_query(), load(), merge_clusters(), reduce(), remove_cluster(), incremental_query::set(), and update_cluster().