Skip to content

LR-PROF-CAMERACOLOR: a profiled model's partial look takes the profile's colour - #3972

Draft
MartenAngner wants to merge 8 commits into
storytold:mainfrom
MartenAngner:camera-profile-partial-look
Draft

MartenAngner wants to merge 8 commits into
storytold:mainfrom
MartenAngner:camera-profile-partial-look

Conversation

@MartenAngner

Copy link
Copy Markdown

Part of #1207. Stacked on #3587: this PR's own commit is the last one, LR-PROF-CAMERACOLOR: a profiled model's partial look takes the profile's colour.

Stage photos from a camera with a camera profile opened grey and washed out when the camera-JPEG match failed: the profile was dropped together with the full look. With this PR the partial look takes the profile's colour, matrix and hue/saturation table. On a Sony ZV-E10 stage photo, against the camera JPEG: ΔE00 14.2 → 8.9, colourfulness 0.32 → 1.02. Photos whose full match already works are unchanged.

Problem

A Sony ZV-E10 evening event (purple and blue stage light, LED screens) with a camera profile from lightcraft-cli calibrate (62 photos of the same evening, through LIGHTCRAFT_CAMERA_PROFILES). The bar and mingling photos opened close to the camera's JPEG. The stage photos opened grey and flat, the screens and a blue dress nearly colourless.

Cause: fit_preview gives the camera profile's colour to the full search only. On these scenes the full search fails its gates (LIGHTCRAFT_PROFILE=1: held-out RMS 0.2178 → 0.2183, chroma error 302 → 290), and fit_partial then fits the generic colour (identity or the damped own matrix). #3587 gives the partial look the model's measured spectral colour, but only when there is no camera profile, so a profiled model still falls back to the generic colour: the photos the profile was made for are the ones that lose it.

Change

Not in this PR: a profile for bodies that have none (the user makes one with calibrate); whether a profile should also be tried before a failed partial look in black-and-white photos (unchanged: that path already uses the profile's colour).

How it was checked

  • cargo xtask ci: not the full gate yet. Ran here (Windows, MSVC, rustc 1.99.1): cargo clippy -p lightcraft-engine --all-targets -- -D warnings clean, rustfmt --check on the changed files, and cargo test -p lightcraft-engine --lib: 1631 passed, 1 failed, tests::library::a_thumbnail_cache_from_before_is_tidied_in_the_background_when_the_library_opens (timing: the activity row was already gone under the full parallel run; it passes 3 of 3 run alone, and touches no camera colour code).
  • A test that fails without this change: fit_preview_gives_a_profiled_models_partial_look_the_profiles_colour (the lens-corrected synthetic scene whose full look fails, with a given profile: the partial look takes the profile's matrix in the proxy space and its table; without a profile it keeps the generic colour). With the one-line change in fit_preview_with reverted, it fails at the matrix assertion.
  • Rendered with lightcraft-cli render (release build of this branch, and the same branch with the change reverted) and compared with the camera JPEG.

Against the embedded camera JPEG (mean CIEDE2000 / colourfulness ratio), Sony ZV-E10, profile from calibrate over 62 photos of the same evening (private photos of an event, not committed):

Photo full look before (#3587) this PR
DSC05738 stage, LED screen fails 14.15 / 0.32 8.94 / 1.02
DSC05722 room in purple light fails 4.98 / 0.72 4.63 / 0.85
DSC05778 speaker in a spotlight fails 5.33 / 0.53 5.42 / 0.66
DSC05682, DSC05700, DSC05743 passes 3.95, 5.84, 8.22 identical

DSC05778 gains colour but its ΔE is 0.09 higher.

Screenshots

Not attached: the photos show identifiable people at a private event. Happy to share the comparison privately with a maintainer.

Merging

Checklist

🤖 Generated with Claude Code

jeremyh and others added 8 commits November 2, 2026 15:48
A raw without colour matrices whose full JPEG fit fails gets a partial look:
tone and chroma curves over the generic camera ≈ sRGB colour. A partial look
counts as a fit, so the measured spectral matrices of a covered model were
never reached, and these are the scenes (saturated, narrow-band light, many
clipped proxy pixels) where the generic colour is furthest from the camera's.

When the model has spectral matrices and no camera profile, the partial look
now takes their colour (in the sensor proxy's space, white kept white) with
its tone and chroma curves fitted on top. On a Canon EOS R50 night shot of an
LED-lit wall (EOS R10 matrices), against the camera JPEG: mean CIEDE2000
7.1 -> 4.9, colourfulness 0.75 -> 0.93, median hue error 9.9° -> 1.3°.
Of 444 local corpus raws one changes (an X-E4 near-grey frame, 1.3 -> 1.6).

LOOK_VERSION 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Docs only: gaps.md header and revision history, the LR-PROF-CAMERACOLOR row,
and the What's New entry, which moves under Unreleased.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Docs only: the gaps.md header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e generic partial look

When a model had measured matrices, the partial fit tried only that colour.
If it missed the gates the photo lost the generic partial look it had before
and fell through to the spectral branch's default tone curve. Retry with the
generic colour; a measured fit that passes is unchanged.

Also test that fit_preview hands the measured colour to the fit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A measured partial look can miss its gates and fall back to the generic one,
models with a camera profile skip it, and a photo with no fitted look has no
JPEG-matched tone. Accepted partial looks can also change (the X-E4 frame in
docs/camera-preview-colour.md), so "unchanged" holds for full matches only.
…ofiles

fit_preview looks up the model's camera profile, which a local
<config>/camera-profiles/Canon_EOS_R50.json replaces, so the test failed
on a machine with one. fit_preview_with takes the profile; the test passes none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e's colour

When the full camera-JPEG fit fails, a model with a camera profile now gives its partial
look the profile's matrix and hue/saturation table, as storytold#3587 does with the spectral
matrices for models without a profile. Before, the profile was dropped together with the
full look, so stage and LED photos of profiled models opened in the generic colour.

Sony ZV-E10 stage photo vs the camera JPEG: ΔE00 14.15 -> 8.94, colourfulness 0.32 -> 1.02.
LOOK_VERSION 15.

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

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@wanikhawar

Copy link
Copy Markdown
Contributor

This is stacked on #3587, which is still open and conflicts with main. Please wait for it to land or fold the two together, then rebase onto main. camera_preview/* has changed a lot, and LOOK_VERSION is now 29, so the 14→15 bump needs redoing on top of whatever is current.

Please also remove the "Generated with Claude Code" footer from the PR body and the Co-Authored-By: Claude commit trailers.

One question for the rebase: with the profile's matrix on the partial look, with_pooled_tone now extends the tone curve along the profile's pooled curve. Is that intended? If so, say so in the PR and add an assertion for it.

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.

3 participants