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.3 KiB

#pragma once
#include <av.hpp>
#include <fingerprint_traits.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/utility.hpp>
#include <utility>
#include <array>
#include <iosfwd>
#include <vector>
namespace boost {
namespace serialization {
template<class Archive, class T, size_t N>
void serialize(Archive & ar, std::array<T,N> & a, const unsigned int /*version*/) {
ar & make_array(a.data(), a.size());
}
} // namespace serialization
} // namespace boost
struct rgb_wavelet_coefficients {
// a double for (x, y) location represented in a single int
using coefficient = std::pair<int, double>;
using pre_fingerprint = std::array<std::vector<double>, 3>;
std::array<coefficient, 20> reds;
std::array<coefficient, 20> greens;
std::array<coefficient, 20> blues;
static pre_fingerprint pre_calculate(av::frame const & frame);
static rgb_wavelet_coefficients calculate(av::frame const & frame);
double distance_to(pre_fingerprint const & fingerprint) const;
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int /*version*/){
ar & reds;
ar & greens;
ar & blues;
}
};
std::ostream& operator<<(std::ostream& out, rgb_wavelet_coefficients const & x);