Skip to content

Add Panasonic RW2 embedded lens distortion correction - #21656

Open
andriiryzhkov wants to merge 1 commit into
darktable-org:masterfrom
andriiryzhkov:lumix_emedded_lens_correction
Open

Add Panasonic RW2 embedded lens distortion correction#21656
andriiryzhkov wants to merge 1 commit into
darktable-org:masterfrom
andriiryzhkov:lumix_emedded_lens_correction

Conversation

@andriiryzhkov

Copy link
Copy Markdown
Collaborator

Panasonic bodies embed the distortion correction their built-in and Lumix-branded lenses need – Lightroom apply it silently. darktable ignores it, so users of the LX100 series, TZ superzooms, and various Lumix S primes fall back to lensfun, which has no profile for many of these lenses (the built-in zooms in particular can't get one since they're camera-specific).

Parses tag Exif.PanasonicRaw.0x0119 (32-byte int16 blob) and plugs into the existing embedded-metadata path alongside Sony / Fuji / Olympus / DNG. Polynomial per Rigo's reverse-engineering (trou/panasonic-rw2): Ru = Rd + scale·(a·Rd³ + b·Rd⁵ + c·Rd⁷). Inverted with two fixed-point iterations in _init_coeffs_md_v2 to produce the src/dst radius spline the pipeline already uses. Validated on DC-L10 + Leica DC VARIO (mild barrel), DC-S5M2 + Samyang 35-150 (moderate barrel), DC-S5M2X + Sigma 100-400 (strong pincushion).

Roundtrip preserved via the whitelist-plus-numeric-copy pattern from #21449 – the tag is copied to Exif.Image.0xf119 (TIFF private range) on export so re-imported TIFF/DNG still offer the "embedded metadata" option.

Not addressed: chromatic aberration (tag 0x011b, format still not publicly reverse-engineered – RawTherapee shipped their attempt disabled), and vignetting (Panasonic bakes it into the raw pixels when ShadingCompensation is on, so there are no coefficients to read).

@andriiryzhkov andriiryzhkov added the scope: image processing correcting pixels label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: image processing correcting pixels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant