Files
lightcraft/crates/merge/tests
fe632e05f9 Keep a stitched panorama at the photos' own resolution (#3806)
* Keep a stitched panorama at the photos' own resolution

The merged panorama of three 4032x3024 photos came out at 4924x2461, i.e. the same pixel count as a single source photo, so every frame was downsampled into the canvas. The megapixel and edge caps cannot cause this: the output scale in `stitch` is capped at 1.0, so the canvas is always at most the surface bounds; those bounds are simply too small because the recovered focal length (and therefore the projected extent) is too small for wide-angle frames.

Pin the focal length to the one `register` derives (EXIF 35 mm equivalent, else the homography estimate) instead of letting bundle adjustment drift it freely when only a few frames constrain it, and make `stitch` size the canvas from the frames' own pixel density so no frame is resampled below its resolution. The new test stitches three wide-angle frames with a known focal and asserts the recovered focal and the output size stay at the photos' resolution.

Test: a_wide_angle_trio_keeps_the_photos_resolution failed before the change and passes after.

* Address review for pull request 3806

* Panorama: the lens sets the native scale, not average density

The previous scale upsampled the frames centres, where a rectilinear frame
already has f pixels per radian. What can go wrong is the fitted focal coming
out below the lens, so EXIF focal length now raises the cap on the output
scale, and nothing is upsampled past it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: eliets2 <287273517+eliets2@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 23:01:24 +01:00
..