Adds program options and also adds generate_database binary
This commit is contained in:
parent
89629a0b30
commit
6ee3eb6cfb
2 changed files with 50 additions and 7 deletions
39
src/generate_database.cpp
Normal file
39
src/generate_database.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include <fingerprints.hpp>
|
||||
#include <read_database.hpp>
|
||||
#include <utilities.hpp>
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename Metric>
|
||||
void generate(const string & database_directory) {
|
||||
auto const db = read_database<Metric>(database_directory);
|
||||
cout << colors::green("Read database: ") << db.size() << endl;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if (argc != 3) {
|
||||
cerr << "usage: main <dir> <type>\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
av_register_all();
|
||||
av_log_set_level(AV_LOG_QUIET);
|
||||
|
||||
string const database_directory = argv[1];
|
||||
string const type = argv[2];
|
||||
|
||||
if (type == "rgb") {
|
||||
generate<fingerprints::rgb>(database_directory);
|
||||
} else if (type == "wvlt_rgb") {
|
||||
generate<fingerprints::wvlt_rgb>(database_directory);
|
||||
} else {
|
||||
cerr << "No known type given\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
18
src/main.cpp
18
src/main.cpp
|
@ -10,7 +10,6 @@
|
|||
#include <boost/filesystem.hpp>
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
@ -74,16 +73,21 @@ static void save_mozaic(Mozaiq const & mozaic, string filename){
|
|||
encode_as_jpg(frame, filename);
|
||||
}
|
||||
|
||||
int main(){
|
||||
int main(int argc, char *argv[]){
|
||||
if(argc != 6){
|
||||
cerr << "usage: main <dir> <photo> <output> <h tiles> <v tiles>\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
av_register_all();
|
||||
av_log_set_level(AV_LOG_QUIET);
|
||||
|
||||
// TODO: use boost::program_options
|
||||
string const database_directory = "basbram";
|
||||
string const filename = "basbram.jpg";
|
||||
string const output = "output/basbram.jpg";
|
||||
int const h_tiles = 4*4;
|
||||
int const v_tiles = 3*4;
|
||||
string const database_directory = argv[1];
|
||||
string const filename = argv[2];
|
||||
string const output = argv[3];
|
||||
int const h_tiles = stoi(argv[4]);
|
||||
int const v_tiles = stoi(argv[5]);
|
||||
|
||||
auto const db = read_database<Metric>(database_directory);
|
||||
cout << colors::green("Read database: ") << db.size() << endl;
|
||||
|
|
Reference in a new issue