diff options
author | Chris Xiong <chirs241097@gmail.com> | 2022-09-07 13:05:17 -0400 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2022-09-07 13:05:17 -0400 |
commit | 1932abcb2ae2c0406c48e8b12d348631a83f2655 (patch) | |
tree | 137e92eba63383857bb3757b01ba526726d6c502 /tests | |
parent | 6c77ce2361d713fc13a4d21f8dec87084de45c9e (diff) | |
download | deduper-1932abcb2ae2c0406c48e8b12d348631a83f2655.tar.xz |
Add classes for subslicing (extracted from testdrive.cpp).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/signature_test.cpp | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/tests/signature_test.cpp b/tests/signature_test.cpp index 32a763c..df22b0f 100644 --- a/tests/signature_test.cpp +++ b/tests/signature_test.cpp @@ -1,18 +1,51 @@ #include <cstdio> #include <vector> +#include "subslice_signature.hpp" #include "signature.hpp" -//#include <opencv2/highgui.hpp> + +signature_config cfg_full = +{ + 9, //slices + 3, //blur_window + 2, //min_window + true, //crop + true, //comp + 0.5, //pr + 1./128, //noise_threshold + 0.05, //contrast_threshold + 0.25 //max_cropping +}; + +signature_config cfg_subslice = +{ + 4, //slices + 16, //blur_window + 2, //min_window + false, //crop + true, //comp + 0.5, //pr + 1./64, //noise_threshold + 0.05, //contrast_threshold + 0.25 //max_cropping +}; + int main(int argc, char **argv) { - std::vector<signature> a; + std::vector<subsliced_signature> a; for (int i = 1; i < argc; ++i) - a.push_back(std::move(signature::from_file(argv[i], signature::default_cfg()))); + a.push_back(std::move(subsliced_signature::from_file(argv[i], 3, 3, cfg_full, cfg_subslice))); + for (auto& ss : a) + { + for (auto& s : ss.subslices) + printf("%lu ", signature_hash{}(s)); + puts(""); + } if (a.size() < 2) return 0; for (size_t i = 0; i < a.size(); ++i) for (size_t j = i + 1; j < a.size(); ++j) { printf("%lu <-> %lu:", i, j); - double d = a[i].distance(a[j]); + double d = a[i].full.distance(a[j].full); printf("%f\n", d); } //while (cv::waitKey(0) != 'q'); |