An event camera simulator for MATLAB® and Simulink®, implementing the event generation algorithm from ESIM (Rebecq et al., 2018). Converts intensity frame sequences into asynchronous events by detecting threshold crossings in log-intensity space with linear timestamp interpolation, producing output in the standard [x, y, timestamp, polarity] format.
- EventCamera — Core Dynamic Vision Sensor (DVS) simulator with configurable ON/OFF thresholds, refractory period, intensity-dependent bandwidth, readout latency, and threshold mismatch (fixed-pattern noise)
- EventNoiseModel — Temporal stochastic noise injection: background activity, hot pixels, timestamp jitter, and leak-rate drift
- EventVisualizer — Real-time 3-panel display: raw camera, polarity frame (blue ON / red OFF), and exponential-decay time surface
- Simulink blocks — Masked library blocks for all three components, ready to drop into any model
The simulator separates pixel physics into two stages. EventCamera models properties intrinsic to the pixel that determine which events fire — including manufacturing variation like threshold mismatch, which is randomly initialized but fixed for the sensor's lifetime. EventNoiseModel models temporally stochastic processes that add, remove, or perturb events independently at each timestep. This separation lets you branch the clean event stream for algorithm testing while independently evaluating noise robustness.
- MATLAB R2023a or later
- Simulink (optional, only for block library and Sim 3D example)
- Simulink® 3D Animation™ (optional, only for UAV flyover example)
Clone or download this repository, then add the eventcamera folder to your MATLAB path:
addpath('path/to/eventcamera')For Simulink blocks (appears in Library Browser as "Event Camera"):
addpath('path/to/eventcamera/simulink')cam = EventCamera('ContrastThresholdOn', 0.2, 'ContrastThresholdOff', 0.2);
% First frame initializes the reference (returns empty)
events = cam(frame1, t1);
% Subsequent frames produce events
events = cam(frame2, t2);
% events is Nx4: [x, y, timestamp, polarity]
% polarity: +1 (ON) = brightness increase, -1 (OFF) = brightness decrease- Add
eventcamera/andeventcamera/simulink/to your MATLAB path - Open the Simulink Library Browser and find the Event Camera library
- Drag the Event Camera block into your model
- Connect a grayscale/RGB image to the
Frameinput and a timestamp to theTimestampinput - The
Eventsoutput is an Nx4 variable-size signal
eventcamera/ Distributable package
EventCamera.m Core DVS simulator (matlab.System)
EventNoiseModel.m Noise model (matlab.System)
EventVisualizer.m Real-time visualization (matlab.System)
eventCameraSummary.m Post-simulation summary figure
simulink/ Optional Simulink support
eventcameralib.slx Block library
slblocks.m Library Browser registration
examples/
eventCameraDemo.m Standalone MATLAB demo (moving bar)
eventCameraUAVDemo.slx Simulink Sim 3D UAV city flyover
tests/
tEventCamera.m Unit tests
| Parameter | Default | Description |
|---|---|---|
| ON threshold (C+) | 0.2 | Log-intensity increase that triggers an ON event |
| OFF threshold (C-) | 0.2 | Log-intensity decrease that triggers an OFF event |
| Max events per frame | 500000 | Upper bound on events per frame |
| Refractory period (s) | 0 | Per-pixel dead time after firing (0 = disabled) |
| Pixel bandwidth (Hz) | Inf | Intensity-dependent low-pass cutoff on log-intensity (Inf = disabled) |
| Latency (s) | 100e-6 | Fixed pixel readout delay added to event timestamps (0 = disabled) |
| Threshold mismatch (std dev) | 0 | Per-pixel threshold variation (0 = disabled) |
| Parameter | Default | Description |
|---|---|---|
| Background noise (events/s) | 0 | Random spurious events across sensor |
| Timestamp jitter std dev (s) | 0 | Gaussian noise on event timestamps |
| Number of hot pixels | 0 | Fixed pixels that fire constantly |
| Hot pixel rate (events/s/pixel) | 1000 | Firing rate of each hot pixel |
| Leak rate (events/s/pixel) | 0 | Reference drift causing events in static regions |
addpath('eventcamera'); addpath('examples');
eventCameraDemoDemonstrates the full noise pipeline: a Sim 3D camera feeds through a shot noise model (Poisson-sampled photon counts) into the Event Camera, then branches into a clean path and a noisy path (with background activity, hot pixels, and timestamp jitter) for side-by-side comparison.
addpath('eventcamera'); addpath('eventcamera/simulink'); addpath('examples');
simOut = sim('eventCameraUAVDemo');addpath('eventcamera');
results = runtests('tests/tEventCamera.m');The simulator implements the ESIM linear-interpolation approach:
- Each incoming frame is converted to log-intensity space
- An intensity-dependent low-pass filter models photoreceptor bandwidth (bright pixels respond faster, dark pixels lag)
- Per-pixel difference from a stored reference level is computed
- When the difference exceeds the contrast threshold, events fire
- Event timestamps are linearly interpolated between the previous and current frame
- A fixed latency is added to model the comparator-to-readout pipeline delay
- The reference level is updated in a staircase pattern (incremented by
numEvents * threshold)
This produces realistic asynchronous event streams where ON events appear at brightening edges and OFF events at darkening edges.
This project is licensed under the BSD 3-Clause License — see license.txt for details.
Copyright (c) 2026, The MathWorks, Inc.
