# UE4-Stereo — acquisition and example scripts Scripts used to generate the [UE4-Stereo](https://huggingface.co/datasets/yanmorona/UE4-Stereo) dataset in Unreal Engine 4.27 with Microsoft AirSim, plus a small example showing how to read a sequence. | File | Purpose | |---|---| | `settings.json` | AirSim configuration: camera resolution, field of view and initial rig placement | | `acquire_stepwise.py` | Acquisition for Scenes 1 and 2 stop at each waypoint, rotate in place, proceed | | `acquire_continuous.py` | Acquisition for Scenes 3 and 4 continuous velocity with rate-limited heading | | `load_sequence.py` | Example loader: reads images, depth, poses and camera parameters | ## Requirements ``` airsim numpy opencv-python matplotlib ``` `settings.json` goes in `Documents/AirSim/` (Windows) or `~/Documents/AirSim/` (Linux) before starting the simulator. The acquisition scripts connect to a simulator that is already running. ## Why two acquisition scripts The two groups of scenes were captured with different motion strategies, which is the source of their different trajectory characteristics. `acquire_stepwise.py` commands the vehicle through successive position and heading targets. It flies to a waypoint, stops, rotates in place towards the next heading, and only then proceeds, so heading changes are concentrated in pure-rotation segments. `acquire_continuous.py` drives the vehicle with continuous velocity commands, interpolating the heading along each segment and limiting it to a maximum yaw rate, so the vehicle never stops. It also runs capture and disk writing in separate threads, which keeps the sampling rate stable at the requested value. The stepwise script writes frames in the capture loop itself, so its achieved rate is lower than the nominal one, roughly 3 Hz with the default settings. ## Usage ```bash # Scene 1, sequence01: centred route, 24 cm baseline, parallel cameras python acquire_stepwise.py --output scene_1/sequence01 \ --route route_a_dir1 --baseline 0.24 # Scene 1, sequence05: 32 cm baseline python acquire_stepwise.py --output scene_1/sequence05 \ --route route_a_dir1 --baseline 0.32 # Scene 1, sequence07: converging cameras, 5 degrees inward each python acquire_stepwise.py --output scene_1/sequence07 \ --route route_a_dir1 --baseline 0.24 --convergence 5 # Scene 3, sequence01: same route, continuous motion at 10 Hz python acquire_continuous.py --output scene_3/sequence01 \ --route route_a_dir1 --baseline 0.24 --rate 10 ``` Reading a sequence back: ```bash python load_sequence.py --sequence scene_1/sequence01 python load_sequence.py --sequence scene_1/sequence05 --baseline 0.32 --show 0 ``` Run any script with `--help` for the full list of options, including `--depth-visual`, which additionally writes 8-bit depth previews. Those previews are not metric and are provided in the published dataset for Scenes 1 and 2 only; the metric `.npy` arrays are available for all sequences. ## Routes Both scripts define the same eight routes, following the pattern `route_{a|b}_dir{1|2}[_offset]`: - `route_a` and `route_b` are the two loop geometries. - `dir1` and `dir2` traverse the same loop in opposite directions. - `_offset` marks the laterally displaced variants. In `route_b` these are also flown 0.5 m higher. The waypoint coordinates of `route_b` differ slightly between the two scripts, reflecting the adjustments made between the two acquisition campaigns; each script carries the values used for its own scenes. Waypoints are `(x, y, z, yaw)` in the AirSim world frame: metres, `z` negative upwards, yaw in degrees. ## Output format Each run produces one sequence directory: ``` sequence01/ left_rgb/000000.png ... 8-bit BGR, 640x480 right_rgb/000000.png ... 8-bit BGR, 640x480 depth_npy/000000.npy ... float32 planar depth in metres depth_visual/000000.png ... optional 8-bit preview, not metric groundtruth.txt timestamp tx ty tz qx qy qz qw associate_rgb.txt left/right pairing associate_rgbd.txt left/depth pairing ``` Left image, right image, depth array and pose of a frame share a single timestamp, so no temporal interpolation is needed to align them. ## Camera model and reference frames The virtual cameras are ideal pinhole cameras with no lens distortion, so their intrinsics are exact by construction rather than estimated by calibration: ``` fx = fy = (W / 2) / tan(hFOV / 2) = 320.0 px for 640x480 at 90 degrees cx, cy = 320.0, 240.0 px ``` Depth is planar measured along the optical axis, not radially so depth and disparity are related by `Z = fx * B / d`. A depth of exactly `0.0` marks an invalid pixel. `groundtruth.txt` follows the TUM RGB-D convention. The recorded pose is that of the vehicle body frame, expressed in the AirSim world frame: right-handed North-East-Down, in metres, with the origin at the spawn point. This differs from the native Unreal Engine world frame, which is left-handed and in centimetres. To obtain the left camera optical frame, compose the recorded pose with the rig extrinsics: a translation of `(1.00, -B/2, 0.10)` m in the body frame followed by a `-23°` pitch rotation. Use `+B/2` for the right camera. With `--convergence C`, the left camera additionally yaws by `+C` and the right by `-C`, toeing them inwards. ## Reproducibility The scenes are static and the acquisition involves no stochastic component or random seed, so trajectories are geometrically repeatable across runs. Frame capture is paced against wall-clock time while the simulator runs in real time, so the exact number of frames recorded along a given route varies slightly with host load. This is why otherwise equivalent sequences differ by a few frames. The published sequences were generated on a laptop with an Intel Core i7-10750H, 32 GB of RAM and an NVIDIA RTX 2070 Max-Q, taking roughly three minutes per sequence. Two notes on `settings.json`. The `Pitch` values it declares for the cameras are overridden at runtime by the acquisition scripts, which set the rig pose through `simSetCameraPose`. The scripts are the authoritative source for the extrinsics. ## Citation ```bibtex @misc{morona2026ue4stereo, author = {Morona, Yan Medeiros and Pinto, Tiago Loureiro Figaro da Costa and Regner, Daniel Juchem}, title = {UE4-Stereo: A Photorealistic Synthetic Stereo Dataset with Ground-Truth Depth and 6-DoF Poses}, year = {2026}, publisher = {Hugging Face}, doi = {10.57967/hf/8959}, url = {https://huggingface.co/datasets/yanmorona/UE4-Stereo} } ```