Immutable event chunks, spatiotemporal indexing, continuous frequency refinement, and frame-anchored PTV

High-Throughput Event Streams in Fluid Velocimetry

Event cameras asynchronously emit ei=(xi,yi,ti,pi)e_i = (x_i, y_i, t_i, p_i) whenever pixel log-intensity crosses a contrast threshold:

log⁡I(xi,yi,ti)−log⁡I(xi,yi,ti−)=piCi,pi∈{−1,+1}\log I(x_i, y_i, t_i) - \log I(x_i, y_i, t_i^-) = p_i C_i, \qquad p_i \in \{-1, +1\}

In high-speed seeded flows, event rates routinely reach 106–10710^6\text{–}10^7 events/s. Copying event arrays across sliding time windows saturates memory bandwidth, while naive FFT binning quantizes velocity estimates in strong shear layers.

Append-Only Immutable Chunks and std::span Views

To decouple sensor ingestion from downstream tracking without lock contention or per-window copies, the capture thread writes into an exclusive buffer and seals it as an immutable std::shared_ptr<const std::vector<Event>> block upon completion. Sliding windows pass lightweight std::span slices:

#include <cstdint>
#include <memory>
#include <span>
#include <vector>

struct Event {
    std::int64_t t_us;
    std::uint16_t x, y;
    std::int8_t polarity;
};

struct EventWindow {
    std::shared_ptr<const std::vector<Event>> chunk;
    std::size_t offset, length;

    std::span<const Event> view() const noexcept {
        return std::span<const Event>(*chunk).subspan(offset, length);
    }
};

Timestamps remain int64_t microseconds and subtract window origin t0t_0 before floating-point conversion to avoid mantissa loss over long recordings. Half-open intervals [ta,tb)[t_a, t_b) locate bounds in O(log⁡N)\mathcal{O}(\log N) via std::lower_bound, while spatial ROI lookups use a lightweight tile-to-index side table without moving event payloads.

Continuous Frequency Refinement Beyond FFT Bins

Under periodic illumination modulation, motion-compensated ROI events form the complex phase response:

Z(f)=∑iwipiexp⁡ ⁣[−j2πf(ti−t0)],P(f)=∣Z(f)∣2Z(f) = \sum_i w_i p_i \exp\!\big[-\mathrm{j} 2\pi f (t_i - t_0)\big], \qquad P(f) = |Z(f)|^2

Evaluating Z(f)Z(f) only on discrete FFT grid centers introduces picket-fence quantization bias. Seeding from a coarse FFT peak and running 2–3 damped Newton steps directly on raw timestamps τi=ti−t0\tau_i = t_i - t_0 recovers continuous sub-bin frequency using analytical derivatives accumulated in a single pass:

Z′(f)=∑i(−j2πτi)wipie−j2πfτi,Z′′(f)=∑i−(2πτi)2wipie−j2πfτiZ'(f) = \sum_i (-\mathrm{j}2\pi \tau_i) w_i p_i e^{-\mathrm{j}2\pi f\tau_i}, \qquad Z''(f) = \sum_i -(2\pi \tau_i)^2 w_i p_i e^{-\mathrm{j}2\pi f\tau_i} P′(f)=2Re⁡(Z′Zˉ),P′′(f)=2Re⁡(Z′′Zˉ)+2∣Z′∣2P'(f) = 2\operatorname{Re}(Z'\bar{Z}), \qquad P''(f) = 2\operatorname{Re}(Z''\bar{Z}) + 2|Z'|^2

Frame–Event Association and Velocity Uncertainty

Synchronized grayscale frames anchor drift-free particle centroids while event streams resolve curved inter-frame trajectories. Gated association combines Mahalanobis innovation distance with wrapped modulation phase consistency:

dij2=(zj−Hs^i)⊤Si−1(zj−Hs^i)+λϕwrap⁡(ϕj−ϕ^i)2d_{ij}^2 = (z_j - H\hat{s}_i)^\top S_i^{-1}(z_j - H\hat{s}_i) + \lambda_\phi \operatorname{wrap}(\phi_j - \hat{\phi}_i)^2

Converting pixel displacement to metric speed u=sΔx/Δtu = s \Delta x / \Delta t exposes the fundamental window-length tradeoff:

σu2≈(ΔxΔtσs)2+(sΔtσΔx)2+(sΔxΔt2σΔt)2\sigma_u^2 \approx \left(\frac{\Delta x}{\Delta t}\sigma_s\right)^2 + \left(\frac{s}{\Delta t}\sigma_{\Delta x}\right)^2 + \left(\frac{s\Delta x}{\Delta t^2}\sigma_{\Delta t}\right)^2

Shrinking Δt\Delta t reduces streamline-curvature bias in high shear, but amplifies centroid noise σΔx\sigma_{\Delta x} by Δt−1\Delta t^{-1} and timing jitter σΔt\sigma_{\Delta t} by Δt−2\Delta t^{-2}—motivating local SNR-adaptive window sizing.