Looking for samples - smartphone DNGs with embedded GainMap

They don’t. I am not asking for something, I am making a suggestion. At least for me this is a difference. If it is not, then sorry, my English is obviously not good enough for this discussion.

I – again – suggest that people could invest a couple of minutes extra to save probably more time later by having way less uploads that have to be rejected. Net this could be less work, it of course depends on the actual number of submissions, number of rejections, and effort that goes into one rejection.

I assume that analyzing a submission may take 15 minutes. Posting a rejection may take 30 seconds. If only every 100th submission is rejected, the extra work stays extra work, but is overall negligible. If every 5th submission is rejected currently, but after some feedback of rejection reasons only every 10th submission is rejected, the saving is real, 15 minutes saved for 30 seconds invested per 5 pictures, and even a reduced effort of 15 seconds per 15 minutes because less rejections have to be documented.

I understand that it hardly makes sense to do such calculations, as life is never as straight and there’s a lot of gut feeling involved as well. However, the vehemency with which you are reacting to my suggestion – not asking for something but maybe desiring something because of the impression that it would make sense – made me feel to have a need for a more practical example.

This is among the responses that I was looking for. Simply saying: “I am the one who does the job and it would be tremendously more effort to put the rejection reason somewhere” is totally OK. As I am not sure if you are the one who does this job still, as said, Roman Lebedev was mentioned before, but as more people might be involved I did not want to ask directly but add this to the running discussion.

In some thread I am after all this fruitless discussion too lazy to look up, there was mentioned that a color target is not required but beneficial. Furthermore, it makes a good subject (it is no person) and it increases likelihood of proper exposure.

I had to revive a camera that I was not using for several years. It took quite some time to install CHDK on it (or find the old SD card where the suitable CHDK version was already installed) and make it ready. It was probably more than an hour. Still, even with a camera that I regularly use, I would expect this task to take more than 5 minutes. But maybe I am doing it too perfectionist.

You (I mean those that do the job) are investing a little bit of work to the benefit of saving a lot of work themselves later, as explained above. As said, judgement is by those that actually do the work, I might be wrong by my assumptions, but I thought this is a proper reason to discuss these things. However, I still do not understand what is so difficult to understand about this.

As I submitted 2 cameras, at least for one there is now a proper raw sample in place. I am still willing to contribute the other missing sample, but as already stated, I need to know what was wrong with my first submission. I don’t care about the time I wasted, I care more about my inability to provide a better sample for the camera that is in the list of missing cameras.

2 Likes

Seems he is busy at the moment. There are a couple of raw samples uploaded that haven’t shown up. For example D3s and R3.

Will this work with DJI Mavic Pro?

CC0
20220512DJI_0027.DNG (23.2 MB)
20220512DJI_0030.DNG (23.3 MB)
20220512DJI_0031.DNG (23.2 MB)

These are valid DNGs and should work with any application that fully supports the DNG spec or uses the Adobe DNG SDK. But they are not supported by the GainMap implementation in either ART or Darktable master.

The typical smartphone DNGs that are supported by those apps have the GainMaps in OpcodeList2, which are applied to each color channel separately before demosaicing, and correct both vignetting and color shading at the same time.

But these DJI DNGs work differently - in OpcodeList3 (to be applied after demosaicing) they have two separate opcodes. There is FixVignetteRadial which fixes the vignetting and has no effect on color, and there is a GainMap which only affects color shading.

2 Likes

Thanks for the explanation! Seems impossible to correct them with Lensfun due to colour shading.

Could someone modify your DNGpreprocess project to target that data and apply it the what you did to std DNG before it was merged into DT??? Or would it be a start from scratch project??

It would be a simple one line change to have the Adobe DNG SDK also perform the OpcodeList3 processing in addition to the OpcodeList2 processing, but that would mean the Adobe DNG SDK also has to demosaic the image in between. I’m not sure how it performs demosaicing but it doesn’t appear to have any sophisticated algorithm like AMaZE or RCD, so there could be some loss of quality.

As for supporting an image like this in Darktable - it probably would be worthwhile to add support for the FixVignetteRadial opcode as it’s also used by some iPhones. Some of the code from the recent change to support GainMaps could also be reused to make other DNG opcodes available to other modules, so the lens correction module could use the FixVignetteRadial data for vignetting correction instead of lensfun.

The GainMap in OpcodeList3 could be trickier - one possibility is to add a separate GainMap implementation either in the demosaic module or in a new module that comes after it. Another possibility is to take that GainMap in OpcodeList3 and transform it into equivalent OpcodeList2 GainMaps that have approximately the same effect but are applied before demosaic. It might not be exactly the same result bit for bit as if it was applied at the correct place, but would probably be close enough.

1 Like

Thanks for taking the time to explain it. I noticed in ART that you can select embedded for lens correction and it seems to apply one. I was going to ask you if it was a similar thing is grabbing from the meta data…

Hi Paolo,

Here are a couple of .dng files taken with my Fairphone 4 - they appear to have Exif entries for Opcode List 2 and Opcode List 3, so hope they might be of use regarding embedded DNG Gainmaps. Kind regards, Paul

IMG_20220409_101408.dng (22.9 MB)
IMG_20220413_170247.dng (22.9 MB)

Thanks! These have the typical smartphone GainMaps in OpcodeList2, which are supported by ART and the current Darktable master. The OpcodeList3 has a WarpRectilinear opcode for distortion correction - Darktable does not support that and I’m not sure what other apps do.

Adobe used AHD, Adaptive Homogeneity-Directed, as demosaicing method last time I checked.
Possibile to check by using this Bayer moire | LibRaw

It might be hard to see but here is your image…note dark corners…
image

Now with gainmap applied…

image

Yes, I can see the second image is definitely lighter.

How do I know if the dngs from my smartphone are using the GainMap in darktable? I checked that exiftool shows that they have gainmaps:

Opcode List 2 : GainMap, GainMap, GainMap, GainMap

In the “raw black/white point module”, if the “embedded GainMap” option appears in the “flat field correction” dropdown, then it is using it. You can switch it back and forth from disabled to see the effect of the GainMap.

Oh, I see the dropdown perfectly on new photos. On already existing ones, I can’t make it show up, even by resetting the history :pensive:

For the existing photos - select them in lighttable, under selected images module go to metadata tab and press “refresh EXIF”. The dropdown should appear after that.

1 Like

Here’s a DNG created by a DJI Mini 3 Pro, also using Opcode List 3 as far as I can tell.
DJI_0014.DNG (23.5 MB)

I wonder if there is a chance to translate the opcode processing into a lensfun profile. A while ago I tried to figure out what a Mini 3’s opcode list means from the dng spec, but was not yet able to solve this puzzle. I did not even understand if it contains lens calibration data, but at least the amount of entries makes it likely.

In particular, this is how the opcode list of your image starts according to exiv2:

Undefined 12564  0 0 0 2 0 0 0 9 1

I have no clue, what the “Undefined” means, for other tags it describes the data type, and the 12564 is likely the count. Next, the first opcode should start but there is no opcode “0”. Any hint welcome!