I don't know how to turn that into lens correction in a useful format.
Adobe has done some work on this and it is in a peculiar state. I'll detail some of what I know about this and will attach a curious patent of theirs. The wording of the below may be a bit strange as I'll pull this from previous correspondence.
I dug and was lucky enough to find a solid definition of all Adobe is doing in a patent of theirs.
"METHODS AND APPARATUS FOR CAMERA CALIBRATION BASED ON MULTI VIEW IMAGE GEOMETRY"
It is not as bad. the lcp file is redundant as each node stands for itself but it amounts to:
- finding the right lcp file to use (based on maker and lens information available as meta data)
- picking the right focal length/aperture combination entry from that file (aperture only if vignetting info is provided)
The details on geometric distortions in the PDF start in column 18 line 57
In the lcp files three parameters are provided for each focal length of the lens like:
stCamera:FocalLength="50"
[...]
stCamera:ScaleFactor="0.958189"
stCamera:RadialDistortParam1="0.187032"
stCamera:RadialDistortParam2="0.165785"
stCamera:RadialDistortParam3="0.40021"
There also is the scale factor presumably to deal with differences in sensor size if such exist. Maybe also to deal with a difference in crop.
Then the details on vignetting in the PDF start in column 21 line 30
The vignetting of course depends on the aperture as well as on the focal length and makes for even more value sets in lcp like:
stCamera:FocalLength="50"
stCamera:FocusDistance="3"
stCamera:ApertureValue="8"
[...]
stCamera:VignetteModelParam1="-2.3844"
stCamera:VignetteModelParam2="4.041297"
stCamera:VignetteModelParam3="-6.086613"
Enough meta data is available to provide what would be needed to dig out the correct *.lcp file to use.
Normally the parameters of pincushion and other distortion are accurately determined as part of the process of designing a lens and so there is no need to estimate them after the fact.
In a perfect world the lens designer would just provide the data. However in a world where camera makers get the idea to cryptographically "secure" their while balancing meta data so that no other software besides their own raw converter can read it or maybe so that they can sell licenses that allow other software vendors with their raw image (Nikon did this) or go one step further and strongly encrypt the entire image (which Sigma did for Foveon images) it is altogether plausible that a software maker, namely Adobe needs to establish lens distortion parameters after the fact.
Actually those cameras that do provide this information readily in the raw data (Olympus / Panasonic / and I belive some Canon compacts that feature RAW natively) are not dealt with by Adobe's lcp files. They don't provide any. Adobe Camera Raw will display "Built in lens profile applied" and that will be all because as you say the maker ought to know best and if they are friendly enough to provide the data as meta data it gets used.
The main thrust of the Patent is in the development of such tables and then using the results, but the way I read the claims, using the results in itself is not covered unless you obtained the numbers according to the patent. In other words, it is a very strange document in many ways.
This will get more interesting if you learn what they did with it - because that obliterated the thrust of the patent.
It became the Adobe lens profile Creator which " is a free utility that enables the easy creation of lens profiles for use in the Photoshop family of products, such as Photoshop CC, the Camera Raw plug-in, and Lightroom. A lens profile describes the types of optical aberrations that exist in a particular lens and prescribes how to correct the lens distortions in an image captured from the same lens."
User Guide PDF:
http://wwwimages.adobe.com/content/dam/Adobe/en/products/photoshop/pdfs/lensprofile_creator_userguide.pdfWin:
http://supportdownloads.adobe.com/detail.jsp?ftpID=5490Mac:
http://supportdownloads.adobe.com/detail.jsp?ftpID=5489So, the results seem not to be covered by the patent, the equations technically can't be restricted if I get it right. Nobody needs to redistribute Adobe's *.lcp files since DNG converter installs them all. So that would leave the creation process and creation tool to Adobe but they give that away freely to all interested. The patent protects nothing but establishes Adobe's leading role in the field and maybe looks nice on the vita of the folks involved with this project. the software was released in 2012 and has not been altered thereafter.
I don't suppose there are other open source implementations?I have not found anything command line. RawTherapee an open source GUI raw processing thing is said to support lcp.
Not that it would help us specifically but if we need to check on what they are doing with the lcp files at some point that is here:
http://rawtherapee.com/blog/screenshotsSource code:
https://github.com/Beep6581/RawTherapee