Skip to content

LR-PROF-CAMERACOLOR: refine partial looks with measured colour - #732

Open
QuirkyTurtle94 wants to merge 1 commit into
storytold:mainfrom
QuirkyTurtle94:camera-colour-fallback
Open

QuirkyTurtle94 wants to merge 1 commit into
storytold:mainfrom
QuirkyTurtle94:camera-colour-fallback

Conversation

@QuirkyTurtle94

Copy link
Copy Markdown
Contributor

An accepted partial camera look can contain an identity colour matrix, so it bypasses the measured spectral fallback even when the scene could not constrain colour. On my A7R IVA lion frame this leaves muted colour despite a useful tone fit. This change lets that narrow case try the camera's existing measured calibration, with freshly fitted tone and chroma.

Related to #535 and #515; this does not close either umbrella issue. Research and wildlife comparisons: #535 (comment)

Behaviour

  • Full JPEG fits, profile fits and partial fits with a learned matrix retain their exact result.
  • Only an accepted identity-matrix partial with no hue/saturation table consults the existing spectral table. No camera data or private profile is added.
  • Express the measured transform in the existing proxy's working space, preserving as-shot balance and baseline exposure. Refit tone/chroma rather than inserting a new matrix beneath the old tone.
  • Require the normal full-fit gates, lower held-out gamma-encoded squared error and no increase in linear squared error. Keep the existing partial on failure; clipped samples remain excluded.
  • Bump LOOK_VERSION 2→3 and RENDER_CACHE_VERSION 42→43. Per docs/process-versions.md, camera-colour source changes do not introduce a develop process version.

Evidence and limits

64 private ILCE-7RM4A RAWs, reset edits, CPU, empty local-profile directory, 1600px exports: all 63 full-fit renders are byte-identical to baseline; only the known partial-fit lion frame changes. Baseline is upstream b70ae174 plus #695's optical aspect guard (9682caae); all private files here are native 3:2. The change is based directly on upstream b70ae174.

For that frame, against Sony Imaging Edge Edit 4.1.00.03062 with DRO off, after similarity registration and a central 84% crop:

Measure Before After
Mean CIE76 2.62 2.20
Mean chroma ratio, LC/Sony 0.416 0.726
Mean ΔL*, LC−Sony −0.35 −0.29

Against the embedded JPEG, mean CIE76 instead moves 1.72→1.83. Held-out proxy squared error improves (linear 3.311585→3.284941; encoded 3.675275→3.624903), but that does not promise improvement under every perceptual metric. Sony Edit and the camera JPEG are different reference renders. This is one affected scene, not validation of every spectral model, calibrated colour accuracy, or Lightroom parity. The existing DRO policy is unchanged.

Validation

  • cargo xtask ci: all 8 steps passed (fmt, clippy, heif, workspace tests, parity, layers, assets, wasm), Rust 1.97.1 on Apple M1/macOS with the complete local corpus. Run with localhost permissions required by the control-server tests.
  • 103 public RAW corpus files rendered at 800px with baseline and candidate: all 103 exports are byte-identical; all commands succeed. These include Sony, Nikon, Canon, Fujifilm, Panasonic, Pentax and Olympus files, but no public sample exercises the newly accepted path.
  • 64 private A7R IVA comparisons as above.
  • Procedural regression tests cover a dull scene gaining the known colour model, rejecting a worse model, absent calibration, unchanged learned/full fits, white preservation, malformed WB and file-supplied matrix precedence.
  • Headless LightCraft app snapshot of the affected frame: settled render, no notices, empty render queue; visually inspected.

Coordination: checked current open camera-colour PRs. #699 changes the tone-fit scene-range gate, #645 handles local contrast during Highlights/Shadows edits, and #514 explicitly leaves fitted camera tones alone. This targets the partial-look/spectral-calibration interaction only. No RAWs, family images or private metadata are included in the branch.

Implemented and investigated with Codex.

Try existing spectral calibration only after an accepted partial look cannot learn a colour matrix. Refit tone and chroma, retaining the old partial unless held-out error improves. Preserve full fits and refresh render and smart-preview caches.

Co-Authored-By: Codex <noreply@openai.com>
@AlexChambers

Copy link
Copy Markdown
Contributor

A coordination note, as this overlaps with two of mine on the same code:

Copy link
Copy Markdown
Member

Thanks for refining the partial looks. This needs a rebase. #938 (black-and-white camera JPEG tone curve) and #854 are landing now and rework the same fit_look / starting-colour code in crates/engine/src/camera_preview.rs, taking LOOK_VERSION to 4. #807 and #758 touch it as well. Please rebase on main once those are in, with LOOK_VERSION / RENDER_CACHE_VERSION one past main's. If you haven't already, come and join us on Discord: https://discord.gg/artcraft


Generated by Claude Code

@QuirkyTurtle94

Copy link
Copy Markdown
Contributor Author

Thanks for the coordination and rebase guidance. I have checked current main 0dd6593d and the pending changes. #938 and #854 are still open/unmerged at this check, so I have not pushed a premature rebase before the integration base you requested is available.

The integration points to preserve are:

The eventual LOOK_VERSION and RENDER_CACHE_VERSION will each be one above the actual integrated main values, rather than hard-coded from today's comment. I will keep #732's acceptance guards and preservation of successful learned/full fits, and rerun the required checks and reference comparisons after resolving the final diff. No updated validation is claimed until that is done.

I have also updated #763 to mark #792/#975's Reset fix as landed and distinguish the old 64-file measurements from future runs with the restored import defaults.

Updated with Codex.

clydecbrown added a commit to clydecbrown/lightcraft that referenced this pull request Oct 31, 2026
…ack on the sorted catalogs

The two new format strings join PR storytold#729's sorted catalogs (cargo xtask i18n --sort).

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

@wanikhawar wanikhawar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicts with main, please rebase. The change itself reads correctly.

@wanikhawar

Copy link
Copy Markdown
Contributor

Please rebase onto main's fit_look and LOOK_VERSION (this overlaps #699, #938 and #854) and re-check on more than one photo. The evidence is one private frame, and your own measurement shows the CIE76 error against the embedded JPEG getting worse (1.72 to 1.83).

This branch has not been deployed

No deployments
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.

4 participants