|
vocabtree
0.0.1
|
Provides useful wrappers around many filesystem related functionality, including reading writing certain common data structures as well as common operations (ex. More...
Data Structures | |
| struct | cvmat_header |
Functions | |
| bool | file_exists (const std::string &name) |
| Returns true if file exists at location, else returns false. More... | |
| void | create_file_directory (const std::string &absfilepath) |
| Recursively creates all directories if needed up to the specified file. More... | |
| bool | write_cvmat (const std::string &fname, const cv::Mat &data) |
| Writes a cv::Mat structure to the specified location. More... | |
| bool | load_cvmat (const std::string &fname, cv::Mat &data) |
| Loads a cv::Mat structure from the specified location. More... | |
| bool | write_sparse_vector (const std::string &fname, const std::vector< std::pair< uint32_t, float > > &data) |
| Writes the BoW feature to the specified location. More... | |
| bool | load_sparse_vector (const std::string &fname, std::vector< std::pair< uint32_t, float > > &data) |
| Loads the BoW feature from the specified location. More... | |
| std::vector< std::string > | list_files (const std::string &path, const std::string &ext="", bool recursive=true) |
| Lists all files in the given directory with an optional extension. More... | |
| std::string | basename (const std::string &path, bool include_extension=false) |
| Returns the basename of the input filepath, including or not including the extension. More... | |
| bool | write_text (const std::string &fname, const std::string &text) |
| Writes a text file to the input file location given the input string. More... | |
Provides useful wrappers around many filesystem related functionality, including reading writing certain common data structures as well as common operations (ex.
file_exists).
| std::string filesystem::basename | ( | const std::string & | path, |
| bool | include_extension | ||
| ) |
Returns the basename of the input filepath, including or not including the extension.
Definition at line 100 of file filesystem.cxx.
| void filesystem::create_file_directory | ( | const std::string & | absfilepath | ) |
Recursively creates all directories if needed up to the specified file.
Definition at line 17 of file filesystem.cxx.
Referenced by benchmark_dataset(), compute_bow(), compute_bow_features(), compute_features(), main(), BagOfWords::save(), MatchesPage::write(), and SimpleDataset::write().
| bool filesystem::file_exists | ( | const std::string & | name | ) |
Returns true if file exists at location, else returns false.
Definition at line 12 of file filesystem.cxx.
Referenced by BagOfWords::BagOfWords(), compute_bow(), compute_bow_features(), compute_features(), InvertedIndex::InvertedIndex(), load_cvmat(), load_sparse_vector(), main(), SimpleDataset::read(), VocabTree::search(), InvertedIndex::search(), SimpleDataset::SimpleDataset(), VocabTree::train(), InvertedIndex::train(), BagOfWords::train(), and MatchesPage::write().
| std::vector< std::string > filesystem::list_files | ( | const std::string & | path, |
| const std::string & | ext = "", |
||
| bool | recursive = true |
||
| ) |
Lists all files in the given directory with an optional extension.
The extension must include the dot (ie. ext=".txt"). If recursive is true (default), will recursively enter all directories
Definition at line 71 of file filesystem.cxx.
Referenced by SimpleDataset::construct_dataset().
| bool filesystem::load_cvmat | ( | const std::string & | fname, |
| cv::Mat & | data | ||
| ) |
Loads a cv::Mat structure from the specified location.
Returns true if file exists, false otherwise.
Definition at line 42 of file filesystem.cxx.
References file_exists().
Referenced by bench_oxford(), benchmark_dataset(), compute_bow(), compute_bow_features(), BagOfWords::load(), main(), VocabTree::search(), VocabTree::train(), and BagOfWords::train().
| bool filesystem::load_sparse_vector | ( | const std::string & | fname, |
| std::vector< std::pair< uint32_t, float > > & | data | ||
| ) |
Loads the BoW feature from the specified location.
First dimension of data is cluster index, second dimension is TF score.
Definition at line 61 of file filesystem.cxx.
References file_exists().
Referenced by InvertedIndex::search(), and InvertedIndex::train().
| bool filesystem::write_cvmat | ( | const std::string & | fname, |
| const cv::Mat & | data | ||
| ) |
Writes a cv::Mat structure to the specified location.
Definition at line 30 of file filesystem.cxx.
References filesystem::cvmat_header::elem_size.
Referenced by compute_features(), main(), and BagOfWords::save().
| bool filesystem::write_sparse_vector | ( | const std::string & | fname, |
| const std::vector< std::pair< uint32_t, float > > & | data | ||
| ) |
Writes the BoW feature to the specified location.
First dimension of data is cluster index, second dimension is TF score.
Definition at line 53 of file filesystem.cxx.
Referenced by compute_bow(), compute_bow_features(), and main().
| bool filesystem::write_text | ( | const std::string & | fname, |
| const std::string & | text | ||
| ) |
Writes a text file to the input file location given the input string.
Returns true if success, false otherwise.
Definition at line 106 of file filesystem.cxx.
Referenced by MatchesPage::write().