Closed DesigningLevers0 closed 5 years ago
Hi - good to know that it can run on iOS!
Unfortunately, there's no straightforward fix for your issue. DNG-files implement a distortion-correction OpCode (see page 84) but there's no standardised way of obtaining the parameters.
It typically depends on the lens itself and Lightroom will likely have parameters for all standard lenses stored somewhere. The NEF format itself does not seem to contain much distortion information (or it's not decoded yet).
If you really want to get into it, I'd recommend running a large set of NEFs from your camera (with different settings and lenses) through Adobe's DNG Converter, extracting metadata from the NEFs and DNGs via exiftool and then looking for correlations between input parameters and the DNG WarpRectilinear Opcodes. If you figure that out, implementation in raw2dng should be comparatively straightforward (would need to spin off a NikonProcessor class). Happy to help with the latter item.
However, the reverse-engineering might not be straightforward if Sony's algorithm is anything to go by. Of course, somebody might have already done it - have not researched Nikon much.
I’ve compiled this successfully in Ish running on an iPad Pro! So far it works well and I can convert raw files on device and open in Lightroom afterwards. I am, however, losing the metadata that contains lens information in the file. Files converted with Adobe DNG Converter in MacOS will automatically flatten in Lightroom, whereas files created with this cannot be adjusted to remove barrel distortion.
Considering my camera is a Nikon d5200, can you advise how I can fix this?