Darktable possibly gets DNG embedded lens correction

I tried your sample (only scene-referred default, but legacy white balance ”as shot”, plus lens correction, and the DJI Mavic Pro seems to be supported in general:

 rawprepare temperature highlights demosaic lens exposure colorin sigmoid colorout finalscale gamma (11)
   926.8526 [dt_imageio_export] [export] imgid 5, 3992x2992 --> 3992x2992 (scale 1.000000). upscale=no, hq=no

Here are some observations:

  • The result size is slightly different: 4000x3000 (original) vs/ 3992x2992 (darktable).
  • The white balance seems much more uniform in the original jpg, while in the darktable version the center seems slightly purple-tinted while the surrounding seems green-shifted.

Here’s the result jpeg:

Unfortunately, the DJI mini 3 pro is not yet supported as this would require opcode 9 (GainMap) in opcode list 3. @hannoschwalm, do you see a chance to support opcode 9 in opcode list 3 as well, as it is already supported in opcode list 2? I understand that this is not a simple copy&paste, as it is before/after demosaic, but hopefully it becomes at least a little bit easier …

Please, please, only raw&jpeg pairs.

The drone image is a first example why discussing the lens correction is so difficult. The dng file just has no information about lens warping so no point in analysing.

About gain map in op list 3. Simply no from my side …

That Drone image size is suspiciously like the DNG created by open camera and they are a bit strange…

Sure, the fitting raw+jpeg pair is two posts above. I maybe misunderstood your 2nd option

as a call for testing, which I did with @Peter’s raw+jpeg pair and my own (which do not work as explained). If this was not meant, then sorry for the noise.

I compiled dt with your PR, and tested it with images from my OnePlus 10 mobile phone. I have self added the corrections in lensfun for geometry. When I open an image from the phone, the drop down is grayed out, and only lensfun correction is available.
image
Is there an issue with the DNG file, or I failed in building the version?

Here is a pair of DNG and JPG from the wide angel lens, where the distortion is the largest.
IMG20221022161314.dng (24.3 MB)

Sorry, i didn’t recognize the image shown is the out-of-camera jpeg :slight_smile: No noise :slight_smile:

The dng file misses lens & vignette correction.

Right. That’s due to the default crop exif data found in the raw so i think the dt values are correct. Also - there is no warp correction included in the dng

Ricoh GR:
GR033017.DNG (13.4 MB)
GR033017.JPEG (6.0 MB)

Ricoh GR III:
R0009937.DNG (29.5 MB)
R0009937.JPG (13.6 MB)

Pixel 4a:
PXL_20220910_144908296.dng (9.0 MB)
PXL_20220910_144908296.jpg (3.5 MB)

Pixel 6:
PXL_20220911_063903400.dng (10.1 MB)
IMG_20220911_063903400.jpg (3.2 MB)

Pentax Q7:
IMGP5574.dng (19.5 MB)
IMGP5574.jpg (2.0 MB)

Is this the same code that tries to process embedded lens corrections for other ‘normal’ raw types ? Or is the DNG code a special case ?

It’s basically the same code. We also assume here, that camera makers know how to correct the lens :slight_smile:

Thanks Bastian, some files have embedded warp corrections (G6) some have dummy parameters, some have none.

But: no file failing the algo :slight_smile:

1 Like

Here is a DNG and JPEG pair from my Panasonic FZ330 (also know as an FZ300) for you to try.
P1530258_20220227.dng (14.1 MB)

Oops, thats a panasonic raw but not a DNG file :slight_smile:

Sorry. I’ve edited the post and swapped the RW2 for the DNG.

Just noticed that the PR has been merged :slight_smile:

Rebuilt from master, hoping that I could finally use darktable for DNGs generated by Kalpanika / X3F Wrapper from Sigma DP2 Merrill raws. Unfortunately they also need the gain map …
[dng_opcode] OpcodeList3 has unsupported mandatory opcode 9

So I need to stay with Adobe for my Merrills, but thanks anyway …

@chris @Peter the purple center in the drone photo is typical for DJI drones. I have a Mavic Air, which is supposed to have an embedded lens correction profile in its DNGs, as well as a colour correction profile (LR and PS use these). For lensfun/DT/RT I made and shared a lens profile, but I still need to correct for the purple center by hand, which is nearly impossible if the photos are used for panoramas. For that reason I convert DNGs for panoramas to 16-bit TIF files in LR or PS. DT being able to deal with an embedded colour profile (and lens profile, would be even better) would be more than welcome.

3 Likes

I enabled the lens correction in 4.2.1 and noticed that there’s a slight difference compared to the JPG out of the camera on my Leica TL2 using Summilux-TL 35 ASPH (there’s also a significant difference in purple fringing, but people already mentioned that in other threads)…

So here’s the camera JPG for this DNG:

And here’s the camera JPG for this DNG:

The current 4.2.1 darktable version does not include the lens corrections based on embedded data (those provided by leica). Darktable “master” (will be 4.4) has that included. But thanks for sharing …

There have been a number of posts recently from you on this forum. I am not sure what “fringing” means here for you.

The “purple” flat areas is not fringing for me, that’s just highlights and a totally different issue.

If we talk about the “coloring artefacts” while pixelpeeping at the power lines. Yes - and that’s what the lens CFA correction is about. I have looked at quite a number of raw images from Leica TL2 and CL and how those embedded corrections work, i would say really good.

But - both the demosaicing module and all later reconstructions rely heavily on best possible highlights reconstruction. You should always concentrate on that first. I reavaluated the above image here again, for me a close-to-perfect lens.

2 Likes