How do cameras apply lens distortion correction to JPEGs, and where do the correction parameters come from?
Asked 10/5/2020
5 views
2 answers
0
I’m working with paired RAW and JPEG files and need to map JPEG pixel coordinates to RAW pixel coordinates. By comparing the files, it looks like the camera applies geometric lens correction somewhere in the RAW-to-JPEG pipeline.
How is this correction typically done inside cameras? Are the distortion parameters calibrated per individual camera or sensor during manufacturing, or are they usually based on lens-model data shared across copies of the same lens? I’m mainly asking about the source of the correction parameters and whether they are tied to the sensor or to the lens.
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
5y ago
2 Answers
17
Distortion is produced by the lens, not the sensor. So the distortion correction you describe is also referred to as lens correction.
There are different distortion models (equations). The parameters depend on the specific distortion models used. Different cameras and software may use different distortion models. Camera manufacturers tend to not reveal the distortion models they use. So even if you are able to extract the parameters, they would likely be of little use.
The correction parameters may be taken from a lens model (more equations) that describes the behavior of specific lenses. Or they may be found empirically, by photographing scenes and making measurements. Usually a representative copy of a lens is used. (This appears to be how Adobe and lensfun databases are built.) Results are good enough, and averaging parameters from multiple lenses does not necessarily produce desirable results.
The distortion models used by Hugin are used to perform lens correction in open-source software (eg, lensfun). Adobe appears to use different models. (See What model does Lightroom use for lens correction?)
To solve your problem (the inverse of lens correction), you should be able to use Hugin to calculate the transformation. Another option is to manually map every coordinate, but that is likely to be time consuming and unnecessary for most photographic purposes.
Originally by user75526. Source · Licensed CC BY-SA 4.0
user75526
5y ago
0
Generated from our catalog & community — verify before relying on it.
This is usually lens correction, not sensor correction. Geometric distortion comes from the lens, and cameras can correct it when generating JPEGs.
The correction is typically based on a lens profile or lens model, using distortion equations and parameters chosen by the manufacturer. Those parameters may be derived from lens design data or empirical testing of representative lens samples, rather than calibrating every individual sensor or lens at the factory. That’s why small residual distortion can remain after correction.
Manufacturers often do not publish the exact distortion model they use, so even if you can extract some correction data, it may not be directly useful outside that system.
In some camera systems, the camera stores downloadable correction data for specific lenses and applies it to JPEGs; RAW software from the same maker may use the same lens data when processing RAW files.
So for mapping JPEG coordinates back to RAW coordinates, you should generally think in terms of reversing a lens-specific correction applied during JPEG processing, not a per-sensor calibration.
Recommended products
UniqueBot
AI5y ago
Your Answer
Related Questions
How is a lens distortion model applied to undistort an image?
Which RAW processors apply embedded Micro Four Thirds lens corrections?
What’s the difference between perspective distortion and barrel, pincushion, and mustache distortion?
Can software corrections make lens distortion, chromatic aberration, and vignetting mostly irrelevant?
What geometric standard do software lens-correction profiles use?