From 60c3efdfc39d359d60f5a86968443cffb8482607 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 13 Oct 2026 00:01:10 +0000 Subject: [PATCH] LR-EDIT-OPTICS-PROFILE: keep the distortion check with the other Python tools Moves it to tools/ with a pinned requirements file, as tools/spectral_camera_table.py does. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015gRtdWF1E9358FfzhzYqCS --- docs/sony-lens-corrections.md | 2 +- tools/requirements-sony-distortion-check.txt | 6 ++++++ {scripts => tools}/sony_distortion_check.py | 8 +++++--- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 tools/requirements-sony-distortion-check.txt rename {scripts => tools}/sony_distortion_check.py (97%) diff --git a/docs/sony-lens-corrections.md b/docs/sony-lens-corrections.md index b2fc5c29..1c0228af 100644 --- a/docs/sony-lens-corrections.md +++ b/docs/sony-lens-corrections.md @@ -101,7 +101,7 @@ ILCE-7M3: a checkerboard filling the frame on a TV (handheld) and on a desktop m uncompressed raws, apertures from wide open to f/8, plus one textured wall. Tables covered strong barrel (16 mm, −690 at the corner), strong pincushion (70 mm, +1161) and the sign change between them. -Method (`scripts/sony_distortion_check.py`): LightCraft renders each ARW at full size with the profile correction +Method (`tools/sony_distortion_check.py`): LightCraft renders each ARW at full size with the profile correction on and off; sub-pixel board corners (Hessian saddle points refined with `cornerSubPix`, kept only where the four quadrants alternate, labelled into rows and columns) are matched with the JPEG's by grid position, with the match fixed by the central corners before any fit, because a board is periodic. A similarity (zoom, rotation, diff --git a/tools/requirements-sony-distortion-check.txt b/tools/requirements-sony-distortion-check.txt new file mode 100644 index 00000000..56ab4f9e --- /dev/null +++ b/tools/requirements-sony-distortion-check.txt @@ -0,0 +1,6 @@ +# Python packages for tools/sony_distortion_check.py (docs/sony-lens-corrections.md). +# python3 -m venv .venv-distortion && .venv-distortion/bin/pip install -r tools/requirements-sony-distortion-check.txt +numpy==2.5.3 +scipy==1.18.1 +opencv-python-headless==5.0.0.93 +Pillow==12.3.0 diff --git a/scripts/sony_distortion_check.py b/tools/sony_distortion_check.py similarity index 97% rename from scripts/sony_distortion_check.py rename to tools/sony_distortion_check.py index 9b740b17..0cdc6f00 100755 --- a/scripts/sony_distortion_check.py +++ b/tools/sony_distortion_check.py @@ -1,7 +1,9 @@ #!/usr/bin/env python3 """Compare LightCraft's Sony embedded distortion correction with the camera's own JPEG. - sony_distortion_check.py --cli target/release/lightcraft-cli --work WORKDIR PHOTO_DIR [PHOTO_DIR…] + python3 -m venv .venv-distortion && .venv-distortion/bin/pip install -r tools/requirements-sony-distortion-check.txt + .venv-distortion/bin/python tools/sony_distortion_check.py --cli target/release/lightcraft-cli \ + --work WORKDIR [--json results.json] PHOTO_DIR [PHOTO_DIR…] Every ARW with a JPG of the same name is rendered by LightCraft twice, embedded correction on and off, and measured against the camera JPEG (shot with Lens Comp. Distortion on Auto): @@ -12,8 +14,8 @@ and off, and measured against the camera JPEG (shot with Lens Comp. Distortion o Checkerboard shots use the board's corners (sub-pixel), other shots SIFT features (agreement only). Offsets are in pixels of the camera JPEG (6000 px wide on the A7 III); the "@2376" -columns rescale them to the 2376 px exports docs/sony-lens-corrections.md reports. -Needs numpy, scipy and opencv-python-headless. +columns rescale them to the 2376 px exports docs/sony-lens-corrections.md reports (method and results +there, under "ILCE-7M3 validation"). """ import argparse