Skip to main content

Module simulate

Module simulate 

Source
Expand description

Frames → events: a DVS pixel simulator.

Turns a sequence of intensity frames into an EventStream, modelling the pixel closely enough that the result is usable as training data rather than only as a demo. The model follows Hu et al., v2e: From Video Frames to Realistic DVS Events (CVPRW 2021): log-intensity differencing with per-pixel threshold mismatch, a finite photoreceptor bandwidth, shot noise, leak events and a refractory period.

§What is modelled, and why each part matters

  • sRGB linearisation, then a lin-log map. Video is gamma-encoded; taking ln of the stored 8-bit value measures contrast in the wrong space. Below ~20/255 the map is linear rather than logarithmic, because ln of a near-zero value amplifies quantisation noise into events that a real sensor would never emit.
  • Per-pixel threshold mismatch. Real thresholds vary pixel to pixel by a few percent. Fixed thresholds make every pixel on an edge fire in lockstep, which is the most visible way synthetic events look synthetic.
  • Photoreceptor bandwidth. A first-order lowpass whose cutoff falls with intensity, so dark scenes lag — the dominant artefact in low-light DVS recordings.
  • Shot noise and leak events. Background activity that does not come from motion at all. A model trained on noiseless synthetic data has never seen it.
  • Interpolated timestamps. When a pixel crosses its threshold several times between two frames, the crossings are spread across the interval by when they actually occurred, rather than all being stamped with the frame time. Timing is the signal in event data; collapsing it to the frame rate discards the temporal precision that motivates using an event camera.

§What is not modelled

Motion blur and exposure time in the source footage (they arrive already baked in), arbiter and bus-bandwidth saturation, hot and dead pixels (see EventStream::pixel_dropout for those), and threshold dependence on illumination beyond the bandwidth term.

Structs§

SimulateProgress
How far a simulate_video_with_progress run has got.
Simulator
A DVS pixel array, driven one frame at a time.
SimulatorConfig
Pixel-model parameters. Defaults follow v2e’s for a typical DVS.

Enums§

Upsample
How finely the interval between two source frames is subdivided before simulating.

Constants§

MAX_UPSAMPLE
Default ceiling on adaptive upsampling, so a hard cut between two frames cannot ask for thousands of sub-steps and stall the run. Overridable per run via SimulatorConfig::max_upsample — the ceiling is a cost/accuracy trade, not a physical bound.

Functions§

linear_luma
Rec. 601 luma of an sRGB pixel, linearised, in [0, 1].
luma_from_rgb
Converts a decoded RGB frame into the linear luma the simulator consumes.
simulate_video
Simulates a whole video file, calling on_events with each interval’s events as they are produced.
simulate_video_on
simulate_video_with_progress on a chosen device, optionally interpolating first.
simulate_video_with_progress
simulate_video, reporting after every frame.