Repository navigation
LR-IMP-CAMERA-COVERAGE: measured image area for Nikon bodies without CropArea - #1053
Conversation
8674892 to
6178021
Compare
|
@robmdunn thanks for this. The survey and the raw-frame tool are really useful, and I'd like to see it land. Some notes after testing it against current main:
@radialmonster the remaining pending bodies only need sample files, and your PigeonFiles drop has some of them: pakjesboot12's D3200 (lossy type 2, 12-bit, 6080 × 4012), olavsu1's D750 and D5000, and possibly lemonnik's D3100. Could you run cargo xtask raw-frame on them, or pass them to robmdunn if the owners agree? Only the measured numbers get committed, never the files. D3200, D3100 and D5000 each need 2 more clean files; D200 and the Nikon 1 V2 need 1.
|
6178021 to
3ccb56f
Compare
…CropArea Nikon bodies from before ~2016 record no CropArea, so the decoder kept their whole sensor data, less trailing dark columns. Where that data holds masked lines above black or optical black, they were developed as a coloured or dark bar on that edge: the D7000 and D5100's 36 columns at ~600 (storytold#976), the D800's 14 (storytold#914, the top in portrait), the D600 / D610's 8 (storytold#1236), the D3200's 46, and others. MEASURED_BODIES (crates/raw/src/vendor/nef.rs) now gives 44 more model / data size / depth groups the frame of their camera JPEG inside the data, next to the D4, D7100 and D90 entries already there: D7000, D5100, D800, D800E, Df, the D4's 12-bit mode, D3, D3S, D700, D300, D300S, D600, D610, D810, D4S, D5600, Coolpix A, D3000, D40X, D60, D80, D2Xs, D200, D3200 and Nikon 1 V1; and, on best-guess frames short of the evidence rule, each with a comment naming its evidence, the D3100 (3 of 4 clean files agree), D5000 (4 of 5, and the D90's sensor), D40 (2 of 2), D50 and D70 (one file each, agreeing) and D70s (next to them, between pixels). Every best-guess frame keeps the masked lines out by several pixels. An entry matches model, data size and depth exactly. Bodies whose data holds only picture beyond the camera frame get no entry and render as before. `cargo xtask raw-frame FILE...` (crates/engine/examples/raw_frame.rs) measures a body: it aligns each raw's embedded camera JPEG with the sensor data (half-size luminance, gradient correlation, sub-pixel peak; weak, ambiguous or between-pixel peaks are flagged), counts the edge lines that hold no picture and reports what the decoder's crop keeps beyond the camera frame. A masked line is flat and its two CFA phases agree within the noise or within 0.4% of white, so filler with a small fixed offset between them (D90, D5000) counts. It prints entries only with evidence: at least 3 clean files agreeing exactly, of the model (12- and 14-bit pooled) or, with at least one of its own, with sibling models of the same readout (data and JPEG size) that agree on the same frame. On the D7500, which records its CropArea, it finds that area exactly; it declines the Z f, whose JPEG is distortion-corrected. It works for any make whose raw embeds a full-size camera JPEG: on Sony, Canon CR2 / CR3, Pentax and Samsung files it finds the decoder's own crop (relative to the active area). Every Nikon raw on raw.pixls.us without CropArea was surveyed this way (its 138 CC0 samples, plus 124 other publicly posted sample files; only the measurements are committed). Bodies whose data holds only picture beyond the frame need no entry (D750, D5300, D5500, D3300, D2X, D2Hs, D3X, D5200, Coolpix P6000, Nikon 1 AW1 / J3 / V2 / V3, the D800's crop modes); raw-parity.md lists them, and no longer claims every NEF coding but HE decodes. measured_bodies_are_consistent checks every entry lies inside its data and is listed once; measured_older_dx_bodies_image_area covers the D200, D3200, Nikon 1 V1 and best-guess entries. Fixes storytold#976 Fixes storytold#914 Fixes storytold#1236 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3ccb56f to
2b3b6e7
Compare
|
I ran every Nikon file on raw.pixls.us (244 files, 92 bodies) through main and compared each render with the camera's own JPEG, and this PR covers almost everything I found. A few it doesn't:
Also, on the D600 the noise columns past the image were being read as a saturation plateau, so |
|
Thank you @robmdunn! This landed on main in integration batch 36 (#1843). We took your rebased head, so the survey data stays out of the repo, and it replaces #1770 as its author suggested. If you haven't already, please join our Discord: https://discord.gg/artcraft. We'd love to have you there. |
# Conflicts: # crates/raw/src/vendor/nef.rs # docs/gaps.md # docs/parity-checklist.md # docs/raw-parity.md # docs/whats-new.md
…orytold#1770 both added them, with the same crops) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #976
Fixes #914
Fixes #1236
Problem
Nikon bodies from before about 2016 record no
CropAreain the maker note, so the decoder keeps their whole sensor data, less trailing dark columns. Where that data holds masked lines above black or optical black, they are developed as a coloured or dark bar on that edge (the top edge in portrait):None of these files records the picture's area anywhere. A pixel-statistics heuristic was tried first and failed on real images: deep shadow at the edge looks just like masked lines. The fix is therefore measured per body, as the D4 entry already was.
Fix
MEASURED_BODIES(crates/raw/src/vendor/nef.rs) gains 44 model / data size / depth groups, next to the D4, D7100 and D90 entries already onmain. Each gets the frame of its own camera JPEG inside the sensor data:D7000, D5100, D800, D800E, Df, D4 (12-bit added), D3, D3S, D700, D300, D300S, D600, D610, D810, D4S, D5600, Coolpix A, D3000, D40X, D60, D80, D2Xs, D200, D3200, Nikon 1 V1.
Best guesses, short of the evidence rule below, each with a comment naming its evidence:
Every best-guess frame keeps the masked lines out by at least 11 px.
An entry matches model, data size and bit depth exactly. Every other body decodes as before.
Bodies whose data holds only picture beyond the camera frame get no entry, so their output is unchanged: D750, D5300, D5500, D3300, D2X, D2Hs, D3X, D5200, Coolpix P6000, Nikon 1 AW1 / J3 / V2 / V3, and the D800's DX / 1.2x / 5:4 modes.
raw-parity.mdlists them.Affected bodies' renders shrink to the camera's own framing, by 8–64 px per dimension (e.g. D800 7424 × 4924 → 7360 × 4912). Crops and masks are stored in normalised coordinates, so existing edits shift by at most a few pixels.
Measuring a body:
cargo xtask raw-framecrates/engine/examples/raw_frame.rs, run throughcargo xtask raw-frame [--json] FILE…:MeasuredBodylines only when at least 3 clean files agree exactly, eitherCropArea, the tool finds that area exactly. It declines the Z f, whose JPEG is distortion-corrected. On Sony, Canon CR2 / CR3, Pentax and Samsung files it finds each decoder's own crop.The survey covered every Nikon raw on raw.pixls.us without
CropArea: its 138 CC0 samples, plus 124 other publicly posted sample files for the bodies raw.pixls.us had too few of. Only the measurements are committed, never the files.Changes since the review
Following @cookingwithsimon's notes:
main(keeps the D4, D7100 and D90 entries).Fixes #1236.Overlap with #1770: it adds identical D600 / D610 entries, and a D5000 entry at the D90's (10, 10) where this PR's files say (11, 10). It also measures white inside the image area for measured bodies, which this PR doesn't. Whichever lands second needs to reconcile.
Testing
measured_d7000_and_d5100_image_areameasured_older_dx_bodies_image_area(D200, D3200, Nikon 1 V1 and the best guesses; fails without the entries)measured_d4_image_area_and_white_levelmeasured_bodies_are_consistentcargo xtask ci: all 8 steps pass on this branch.🤖 Generated with Claude Code