Skip to content

Stereo camera-file import/export, display, and length clearing#1710

Open
mattdawkins wants to merge 1 commit into
mainfrom
dev/stereo-camera-file-io
Open

Stereo camera-file import/export, display, and length clearing#1710
mattdawkins wants to merge 1 commit into
mainfrom
dev/stereo-camera-file-io

Conversation

@mattdawkins

@mattdawkins mattdawkins commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

Adds desktop import/export of stereo camera/calibration files through the existing annotation Import/Export buttons, displays the loaded camera file in stereo mode, and optionally clears stale length measurements when a new camera file is loaded. On import, any VIAME-supported calibration is normalized to the KWIVER JSON camera-rig format, and the original file is preserved alongside the media.

Motivation

Stereo length measurements depend on the active calibration. There was previously no in-app way to attach or replace a dataset's camera file, and switching calibrations left behind length values computed against the old one. This wires camera-file management into the normal import/export flow and keeps measurements consistent.

What's included

Import (ImportAnnotations.vue)

  • For subType === 'stereo' datasets, the Import menu gains a camera/calibration-file option (desktop-only; guarded by api.importCalibrationFile) and shows the current calibration file name.
  • Picks a file via openFromDisk('calibration') and hands it to the backend. After a successful import, stale length attributes are cleared when the new setting is enabled.

Normalize + store (calibrationConvert.ts, common.ts)

  • prepareDatasetCalibration copies the original file into the dataset's project directory (always preserved) and, for non-JSON inputs, runs VIAME's configs/convert_cam_format.py (sourcing setup_viame.sh/.bat) to produce KWIVER's JSON camera-rig format. Supports npz, OpenCV .yml, MATLAB .mat, ZED, CamCAL, etc.
  • The dataset references the JSON copy when conversion succeeds, otherwise the original. The path is recorded in multiCam.calibration; getDatasetCalibrationPath / setDatasetCalibration manage it.

Export (Export.vue)

  • For stereo datasets with a stored calibration, adds an export action that writes the camera file to a chosen location (exportCalibrationFile).

Display (ViewerLoader.vue)

  • Passes the dataset's calibration file and sub-type to the viewer so the active camera file is shown in stereo mode.

Length clearing (clearLengthAttributes.ts + settings)

  • clearLengthAttributes removes every per-track and per-detection length attribute across all cameras via the Track API (so reactivity/change-tracking fire; the caller persists).
  • Gated by a new user setting stereoSettings.clearLengthOnCameraFileLoad (default on), exposed in UserSettingsDialog.vue.

Wiring

  • apispec.ts, platform/desktop/backend/ipcService.ts, platform/desktop/frontend/api.ts, and store/dataset.ts — IPC handlers, API types, and the dataset-store calibration path.

Scope / notes

  • Desktop-only: import/convert/export rely on the Electron backend, and conversion needs a configured VIAME install. If VIAME isn't configured, conversion is skipped gracefully and the original file is used as-is.
  • JSON camera files are used directly (no conversion step).
  • Files changed: 12 (+370 / −6), single commit.

Add desktop import/export of stereo camera/calibration files via the annotation Import/Export buttons, display the loaded camera file in stereo mode, and clear 'length' attributes from tracks/detections when a new camera file loads (toggle in user settings). On import/upload, any VIAME-supported calibration is converted to the JSON camera format via convert_cam_format.py and stored with the dataset, keeping the original.
@mattdawkins mattdawkins requested a review from BryonLewis June 22, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant