#include <visual_database.h>
Public Member Functions | |
visual_database (id_cluster_collection::query_flags flags) | |
virtual | ~visual_database () |
bool | open (const char *fn) |
Reads or create a sqlite3 database file for visual objects. | |
bool | connect_to_db (sqlite3 *sql3db) |
Connects to an already opened sqlite3 database. | |
visual_object * | create_object (const char *comment=0, int flags=0) |
Creates a new visual_object. | |
void | add_to_index (visual_object *o) |
bool | remove_object (visual_object *o) |
img_id | add_image (IplImage *im) |
Stores an image in the database. | |
IplImage * | get_image (img_id im_id) |
Fetches an image from the database. | |
visual_object * | query_frame (pyr_frame *frame, float *score=0) |
incremental_query * | create_incremental_query () |
void | start_update () |
void | finish_update () |
sqlite3 * | get_sqlite3_db () |
Protected Types | |
typedef std::map< img_id, IplImage * > | image_cache_map |
typedef std::map< const char *, sqlite3_stmt * > | stmt_cache_map |
Protected Member Functions | |
sqlite3_stmt * | get_cached_stmt (const char *query, bool verbose=true) |
bool | exec_sql (const char *query) |
Protected Attributes | |
sqlite3 * | db |
image_cache_map | image_cache |
stmt_cache_map | stmt_cache |
Friends | |
class | visual_object |
The database must
Definition at line 139 of file visual_database.h.
typedef std::map<img_id, IplImage *> visual_database::image_cache_map [protected] |
Definition at line 190 of file visual_database.h.
typedef std::map<const char *, sqlite3_stmt *> visual_database::stmt_cache_map [protected] |
Definition at line 193 of file visual_database.h.
visual_database::visual_database | ( | id_cluster_collection::query_flags | flags | ) |
Definition at line 176 of file visual_database.cpp.
visual_database::~visual_database | ( | ) | [virtual] |
img_id visual_database::add_image | ( | IplImage * | im | ) |
Stores an image in the database.
Definition at line 305 of file visual_database.cpp.
References db, get_cached_stmt(), and image_cache.
Referenced by visual_object::add_frame().
void visual_database::add_to_index | ( | visual_object * | o | ) | [inline] |
Definition at line 163 of file visual_database.h.
References id_cluster_collection::add_cluster().
Referenced by connect_to_db().
bool visual_database::connect_to_db | ( | sqlite3 * | sql3db | ) |
Connects to an already opened sqlite3 database.
this method can be called instead of open().
Definition at line 203 of file visual_database.cpp.
References patch_tagger::descriptor::_rotated, visual_object::add(), add_to_index(), visual_object::annotations, db, pyr_keypoint::descriptor, get_cached_stmt(), db_keypoint::image, patch_tagger::descriptor::orientation, visual_object::prepare(), visual_object::representative_image, pyr_keypoint::scale, point2d::u, point2d::v, id_cluster_collection::version, and visual_object.
Referenced by open().
incremental_query* visual_database::create_incremental_query | ( | ) | [inline] |
Definition at line 178 of file visual_database.h.
References id_cluster_collection::incremental_query.
Referenced by vobj_tracker::find_candidates(), and VSView::timerEvent().
visual_object * visual_database::create_object | ( | const char * | comment = 0 , |
|
int | flags = 0 | |||
) |
Creates a new visual_object.
The object is in the database, but not in the index. No query will find it until add_to_index() is called.
Definition at line 375 of file visual_database.cpp.
References db, get_cached_stmt(), id_cluster_collection::version, and visual_object.
bool visual_database::exec_sql | ( | const char * | query | ) | [protected] |
Definition at line 466 of file visual_database.cpp.
References db, and get_cached_stmt().
Referenced by visual_object::add_frame(), finish_update(), remove_object(), and start_update().
void visual_database::finish_update | ( | ) | [inline] |
Definition at line 181 of file visual_database.h.
References exec_sql().
Referenced by vobj_tracker::incremental_learning().
sqlite3_stmt * visual_database::get_cached_stmt | ( | const char * | query, | |
bool | verbose = true | |||
) | [protected] |
Definition at line 439 of file visual_database.cpp.
References db, and stmt_cache.
Referenced by visual_object::add_annotation(), add_image(), visual_object::add_keypoint(), connect_to_db(), create_object(), exec_sql(), get_image(), and remove_object().
IplImage * visual_database::get_image | ( | img_id | im_id | ) |
Fetches an image from the database.
It also caches the image, so that subsequent fetching of the same image is very fast.
Definition at line 333 of file visual_database.cpp.
References db, get_cached_stmt(), and image_cache.
sqlite3* visual_database::get_sqlite3_db | ( | ) | [inline] |
bool visual_database::open | ( | const char * | fn | ) |
Reads or create a sqlite3 database file for visual objects.
Calling this method is required. If the file does not exists, it is created. If the file exists, the method indexes every entry in it. After a successfull call to open(), query_frame or create_incremental_query() are ready to be called.
Definition at line 191 of file visual_database.cpp.
References connect_to_db().
visual_object* visual_database::query_frame | ( | pyr_frame * | frame, | |
float * | score = 0 | |||
) |
bool visual_database::remove_object | ( | visual_object * | o | ) |
Definition at line 392 of file visual_database.cpp.
References id_cluster::clear(), db, exec_sql(), get_cached_stmt(), visual_object::obj_id, id_cluster_collection::remove_cluster(), and visual_object::representative_image.
Referenced by vobj_tracker::remove_visible_objects_from_db().
void visual_database::start_update | ( | ) | [inline] |
Definition at line 180 of file visual_database.h.
References exec_sql().
Referenced by vobj_tracker::incremental_learning().
friend class visual_object [friend] |
Definition at line 196 of file visual_database.h.
Referenced by connect_to_db(), and create_object().
sqlite3* visual_database::db [protected] |
Definition at line 185 of file visual_database.h.
Referenced by visual_object::add_annotation(), add_image(), visual_object::add_keypoint(), connect_to_db(), create_object(), exec_sql(), get_cached_stmt(), get_image(), get_sqlite3_db(), remove_object(), and ~visual_database().
image_cache_map visual_database::image_cache [protected] |
Definition at line 191 of file visual_database.h.
Referenced by add_image(), get_image(), and ~visual_database().
stmt_cache_map visual_database::stmt_cache [protected] |
Definition at line 194 of file visual_database.h.
Referenced by get_cached_stmt(), and ~visual_database().