Exporters

Write-only exports of the native kinds into community formats: flat correspondences for external calibrators, TUM, EuRoC, BOP and OpenSim TRC.

VisualGeometryToolkitIO.save_correspondences — Method
save_correspondences([to_frame = F,] path, obs::TargetObservations{F}, targets...; resolve = nothing, length_unit = mm, provenance = (;)) -> path

Export a session's 2D–3D correspondences — pixel observations obs of target points — as one export/correspondences/v2 file, one row per (frame, target) in frame then target order: object_points N×3 in the target's own frame (the target's points on its surface: z = 0 for a planar calibration, the height a HeightField gives otherwise; in length_unit, from the targets' lengths — plain points are an ArgumentError) and image_points N×2, moved into to_frame — the external calibrator's convention, declared in the file's units.pixel: PixelFrame{:opencv} for cv::calibrateCamera (the top-left pixel's centre at (0, 0)), PixelFrame{:julia} for MATLAB's (1, 1); the observations' own frame by default. A type, it leads.

targets is one or more rigs or rig file paths (one per connected component; a target present in several must carry the same points in each; resolve resolves a referenced planar design read from a path); when obs names its targets (obs.targets), the given ones must be exactly those, by content_id — an old rig or target file also by the identities its version named it by (the re-id map), which the observation files written beside it hold. Every (target, index) must resolve, and every frame must name its image and sensor. The export is write-only: no reader reads it.

source
VisualGeometryToolkitIO.save_bop_scene — Method
save_bop_scene(to_frame, dir, tp::TargetPoses{CameraFrame}, cameras; obj_ids = nothing, undistorted = false)
    -> (; scene_gt, scene_camera, obj_ids, images)

A BOP scene (boptoolkit/docs/bopdatasetsformat.md:79-112, written as boptoolkitlib/inout.py `savejsonlays it out, :101-120):scenegt.json— image id →[{camRm2c (3×3 row-major), camtm2c (mm), objid}], the target → camera pose — andscenecamera.json— image id →{camK (row-major), depthscale}, K from the frame's camera in the camera storecameras(by itssensorname), its principal point moved intotoframe(BOP states no pixel origin; OpenCV's,PixelFrame{:opencv}, is the toolkit's renderer's). Image ids are the frame indicest;objidis an integer, so the targets are numbered —objids(target id → Int), or by sorted id from 1. BOP's K is a pinhole: a camera with a lens is refused unlessundistorted = truestates that the poses were measured on images undistorted to the camera's pinhole twin (K kept, lens dropped). Returns the two paths, theobj_ids` used and the image id → image name map, which BOP has no place for.

source
VisualGeometryToolkitIO.save_euroc_trajectory — Method
save_euroc_trajectory(path, tr::Trajectory; stamp = :time) -> path

The EuRoC/ASL ground-truth CSV (state_groundtruth_estimate0/data.csv), as evo reads it (evo/evo/tools/fileinterface.py:224-243: comma-separated, # header, ≥ 8 columns, timestamp in ns, the quaternion w first): the header `#timestamp [ns], pRSRx [m], pRSRy [m], pRSRz [m], qRSw [], qRSx [], qRSy [], qRSz []and one row per pose — the pose offrom(S) into(R), metres. The timestamp is the frame's time sincetime_originin integer nanoseconds (stamp = :index`: the frame index).

source
VisualGeometryToolkitIO.save_trc — Method
save_trc(path, obs::TargetObservations{<:Frame{3}}; data_rate = nothing, stamp = :time) -> (; path, markers)

OpenSim's TRC marker-trajectory text, exactly as opensim-core/OpenSim/Common/TRCFileAdapter.cpp writes and reads it (:236-376; reader :38-233): PathFileType 4 (X/Y/Z) <file>, the eight metadata keys and their values (DataRate, CameraRate, NumFrames, NumMarkers, Units, OrigDataRate, OrigDataStartFrame, OrigNumFrames), Frame# Time <marker>…, X1 Y1 Z1 …, a blank line, then one row per frame — tab-separated, each field followed by a tab. A marker is named <target>_<index>; a marker not observed in a frame is written as three EMPTY fields, which the reader takes as missing (NaN, :188-199). Units are mm. Time is the frame's time since time_origin (stamp = :index: the frame index); data_rate (Hz) defaults to the mean rate over that span — TRC requires one even for irregular capture. Returns the path and the marker column order.

source
VisualGeometryToolkitIO.save_tum_trajectory — Method
save_tum_trajectory(path, tr::Trajectory; stamp = :time) -> path

The TUM RGB-D trajectory format, as evo reads it (evo/evo/tools/fileinterface.py:121-146): one line per pose, space-separated timestamp tx ty tz qx qy qz qw, translation in METRES, the quaternion x,y,z,w, the pose of from in to. The timestamp is the frame's time in seconds since the trajectory's `timeorigin(stamp = :indexwrites the frame index instead). One#` comment line names the frames and the origin (evo skips comments, file_interface.py:77).

source