622{
623 size_t seed = std::hash<std::string_view> {}(Reflect::enum_to_string(op));
624
625 std::visit([&seed](const auto& p) {
626 using T = std::decay_t<decltype(p)>;
627 if constexpr (std::is_same_v<T, std::monostate>) {
628 } else if constexpr (std::is_same_v<T, ThresholdParams>) {
629 hash_combine(seed, std::hash<float> {}(p.value));
630 hash_combine(seed, std::hash<uint8_t> {}(static_cast<uint8_t>(p.channels)));
631 for (const auto& band : p.bands) {
634 }
635 } else if constexpr (std::is_same_v<T, ThresholdAdaptiveParams>) {
636 hash_combine(seed, std::hash<uint32_t> {}(p.block_size));
638 hash_combine(seed, std::hash<uint8_t> {}(
static_cast<uint8_t
>(p.channels)));
639 } else if constexpr (std::is_same_v<T, OtsuParams>) {
640 hash_combine(seed, std::hash<uint8_t> {}(
static_cast<uint8_t
>(p.channels)));
641 } else if constexpr (std::is_same_v<T, NormalizeRangeParams>) {
644 } else if constexpr (std::is_same_v<T, GaussianBlurParams>) {
646 } else if constexpr (std::is_same_v<T, FilterSeparableParams>) {
647 for (float v : p.kernel_x)
649 for (float v : p.kernel_y)
651 } else if constexpr (std::is_same_v<T, CannyParams>) {
653 hash_combine(seed, std::hash<float> {}(p.low_threshold));
654 hash_combine(seed, std::hash<float> {}(p.high_threshold));
655 } else if constexpr (std::is_same_v<T, MorphParams>) {
657 } else if constexpr (std::is_same_v<T, HarrisParams>) {
661 } else if constexpr (std::is_same_v<T, ExtractPeaksParams>) {
663 hash_combine(seed, std::hash<uint32_t> {}(p.nms_radius));
664 hash_combine(seed, std::hash<bool> {}(p.export_keypoints));
666 } else if constexpr (std::is_same_v<T, TrackKeypointsParams>) {
667 hash_combine(seed, std::hash<uint32_t> {}(p.window_radius));
668 hash_combine(seed, std::hash<uint32_t> {}(p.max_iterations));
669 hash_combine(seed, std::hash<float> {}(p.eigen_threshold));
670 hash_combine(seed, std::hash<float> {}(p.error_threshold));
672 hash_combine(seed, std::hash<uint32_t> {}(p.max_points));
673 hash_combine(seed, std::hash<float> {}(p.min_distance));
674 hash_combine(seed, std::hash<float> {}(p.forward_backward_threshold));
675 hash_combine(seed, std::hash<bool> {}(p.export_tracks));
677 } else if constexpr (std::is_same_v<T, FindContoursParams>) {
679 hash_combine(seed, std::hash<uint32_t> {}(p.max_contours));
680 hash_combine(seed, std::hash<uint32_t> {}(p.max_points_per_contour));
682 hash_combine(seed, std::hash<bool> {}(p.export_contours_buffer));
683 } else if constexpr (std::is_same_v<T, ConnectedComponentsParams>) {
684 hash_combine(seed, std::hash<bool> {}(p.export_labels));
687 hash_combine(seed, std::hash<bool> {}(p.export_label_buffer));
688 } else if constexpr (std::is_same_v<T, OpticalFlowDenseParams>) {
689 hash_combine(seed, std::hash<uint32_t> {}(p.window_radius));
690 hash_combine(seed, std::hash<uint32_t> {}(p.iterations));
692 hash_combine(seed, std::hash<float> {}(p.eigen_threshold));
695 hash_combine(seed, std::hash<float> {}(p.visual_range));
696 hash_combine(seed, std::hash<float> {}(p.visual_min_motion));
697 } else if constexpr (std::is_same_v<T, ConfineParams>) {
702 hash_combine(seed, std::hash<bool> {}(p.resize_to_source));
703 }
704 },
705 params);
706
707 return seed;
708}
void hash_combine(size_t &seed, size_t value)
Combine a hash into an existing seed, FNV-style.
void hash_region(size_t &seed, const std::optional< BoundingBox > ®ion)
Combine an optional region into a hash: absence and presence hash differently, presence by its four b...