|
|
@ -28,10 +28,10 @@ using namespace std; |
|
|
|
namespace fs = boost::filesystem; |
|
|
|
namespace ar = boost::archive; |
|
|
|
|
|
|
|
using Database = image_database<rgb_wavelet_coefficients>; |
|
|
|
using Database = image_database<downscale>; |
|
|
|
using Mozaic = map<pair<int, int>, string>; |
|
|
|
|
|
|
|
Database read_database(string const & database_directory){ |
|
|
|
static Database read_database(string const & database_directory){ |
|
|
|
Database db; |
|
|
|
auto const database_file = database_directory + ".db"; |
|
|
|
|
|
|
@ -60,10 +60,10 @@ Database read_database(string const & database_directory){ |
|
|
|
return db; |
|
|
|
} |
|
|
|
|
|
|
|
Mozaic create_mozaic(Database const & db, string const & filename, int h_tiles, int v_tiles){ |
|
|
|
static Mozaic create_mozaic(Database const & db, string const & filename, int h_tiles, int v_tiles){ |
|
|
|
Mozaic mozaic; |
|
|
|
|
|
|
|
apply_to_tiles("image.jpg", h_tiles, v_tiles, [&](int c, int r, av::frame const & frame){ |
|
|
|
apply_to_tiles(filename, h_tiles, v_tiles, [&](int c, int r, av::frame const & frame){ |
|
|
|
auto const index = db.nearest_image(frame); |
|
|
|
cout << colors::red("tile ") << c << ", " << r << ": " << db.filename(index) << endl; |
|
|
|
mozaic[make_pair(c, r)] = db.filename(index); |
|
|
@ -72,7 +72,7 @@ Mozaic create_mozaic(Database const & db, string const & filename, int h_tiles, |
|
|
|
return mozaic; |
|
|
|
} |
|
|
|
|
|
|
|
void save_mozaic(Mozaic const & mozaic, string filename, int h_tiles, int v_tiles){ |
|
|
|
static void save_mozaic(Mozaic const & mozaic, string filename, int h_tiles, int v_tiles){ |
|
|
|
auto const pix_fmt = AV_PIX_FMT_YUVJ444P; |
|
|
|
auto const codec_id= AV_CODEC_ID_MJPEG; |
|
|
|
|
|
|
|