Return a reference to the precomputed 1D Gaussian kernel for sigma.
Computes and caches on first call for a given sigma. The kernel is normalised to unit sum and has length 2*ceil(3*sigma)+1.
Definition at line 57 of file VisionExecutor.cpp.
58{
59 const auto key = std::bit_cast<uint32_t>(
sigma);
62 return it->second;
63
64 const auto radius =
static_cast<int32_t
>(std::ceil(3.0F *
sigma));
65 const int32_t size = 2 *
radius + 1;
66 const float inv_2s2 = 1.0F / (2.0F *
sigma *
sigma);
67
68 std::vector<float>
k(
static_cast<size_t>(size));
71 const float v = std::exp(-static_cast<float>(i * i) * inv_2s2);
72 k[
static_cast<size_t>(i +
radius)] = v;
74 }
75
76 auto kmap = Eigen::Map<Eigen::ArrayXf>(
k.data(),
static_cast<Eigen::Index
>(
k.size()));
78
80}
std::unordered_map< uint32_t, std::vector< float > > m_kernel_cache
std::vector< double > sum(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Sum per window.
References k, m_kernel_cache, radius, and sigma.
Referenced by run().