Making mosaic images with ffmpeg
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

#include <image_io.hpp>
#include <wavelet.hpp>
#include <image_database.hpp>
#include <fingerprint.hpp>
#include <boost/filesystem.hpp>
extern "C" {
#include <libavformat/avformat.h>
}
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
namespace fs = boost::filesystem;
int main(){
av_register_all();
string database_directory = "database";
string filename = "needle.jpg";
image_database<rgb_wavelet_coefficients> db;
fs::path directory(database_directory);
fs::directory_iterator eod;
for(fs::directory_iterator it(directory); it != eod; ++it){
auto && path = it->path();
auto ext = path.extension();
if(ext != ".png" && ext != ".jpg") continue;
cout << colors::green("adding: ") << path.string() << endl;
db.add(path.string());
}
while(true){
cout << "****************" << endl;
cout << colors::green("database: ") << db.size() << endl;
cout << colors::green("press enter to search match for: ") << filename << endl;
cin.ignore();
auto index = db.nearest_image(open_as_rgb(filename));
cout << colors::green("match: ") << db.filename(index) << endl;
}
}