Lens/Geometry: Difference between revisions

From RawPedia
Jump to navigation Jump to search
(→‎Profiled Lens Correction: Added link to lensfun-update-data manual)
(Updated Lensfun links - moved from sourceforge to github)
Line 38: Line 38:


=== Lensfun ===
=== Lensfun ===
Lensfun is an open-source project. A database of lens parameters is maintained by the developers. You can find more information in the [http://lensfun.sourceforge.net/faq/ Lensfun FAQ].
Lensfun is an open-source project. A database of lens parameters is maintained by the developers. You can find more information in the [https://lensfun.github.io/faq/ Lensfun FAQ].


The options "Auto-matched correction parameters" and "Manual correction parameters" both use the Lensfun system. Both the "Camera" and "Lens" comboboxes will contain long lists of cameras and lenses (if they do not, your RawTherapee build is buggy - please [[How_to_write_useful_bug_reports|report that]]). A profile matching your camera and lens will be auto-detected if your photo contains metadata which matches an entry in the Lensfun database.
The options "Auto-matched correction parameters" and "Manual correction parameters" both use the Lensfun system. Both the "Camera" and "Lens" comboboxes will contain long lists of cameras and lenses (if they do not, your RawTherapee build is buggy - please [[How_to_write_useful_bug_reports|report that]]). A profile matching your camera and lens will be auto-detected if your photo contains metadata which matches an entry in the Lensfun database.
Line 46: Line 46:
* A profile for your camera/lens combination does exist, but it uses names and parameters which differ enough to confuse the matching algorithm, for example "Pentax" vs "Ricoh Pentax", or "F4.0" vs "f/4".
* A profile for your camera/lens combination does exist, but it uses names and parameters which differ enough to confuse the matching algorithm, for example "Pentax" vs "Ricoh Pentax", or "F4.0" vs "f/4".


In both cases you could try to find and run the executable [http://lensfun.sourceforge.net/manual/v0.3.2/lensfun-update-data.html <code>lensfun-update-data</code>] to download the latest version of the Lensfun database. If that does not help, you could copy and paste the relevant section from the Lensfun database (which could be taken from one of the files in <code>/usr/share/lensfun/</code>) into a new file <code>$HOME/.local/share/lensfun/myLensfun</code> and modify the relevant parameter to match the metadata from your photos. You can find the camera and lens name and parameters contained in your photos by viewing the Exif quick info panel in RawTherapee, [[Keyboard_Shortcuts|shortcut key]] "i" in the Editor tab. If parameters for your camera and lens simply don't exist, view the [http://lensfun.sourceforge.net/calibration/ Lensfun documentation] to find out how to measure them and contribute them for everyone's benefit.
In both cases you could try to find and run the executable [https://lensfun.github.io/manual/v0.3.2/lensfun-update-data.html <code>lensfun-update-data</code>] to download the latest version of the Lensfun database. If that does not help, you could copy and paste the relevant section from the Lensfun database (which could be taken from one of the files in <code>/usr/share/lensfun/</code>) into a new file <code>$HOME/.local/share/lensfun/myLensfun</code> and modify the relevant parameter to match the metadata from your photos. You can find the camera and lens name and parameters contained in your photos by viewing the Exif quick info panel in RawTherapee, [[Keyboard_Shortcuts|shortcut key]] "i" in the Editor tab. If parameters for your camera and lens simply don't exist, view the [https://lensfun.github.io/calibration/ Lensfun documentation] to find out how to measure them and contribute them for everyone's benefit.


Note that while editing the Lensfun database in <code>/usr/share/lensfun/</code> directly may be possible, this is not recommended because you could lose your changes during an update.
Note that while editing the Lensfun database in <code>/usr/share/lensfun/</code> directly may be possible, this is not recommended because you could lose your changes during an update.

Revision as of 21:25, 16 June 2019

To keep the preview fast, RawTherapee uses the preview image of the current zoom level when applying these transformations. Because of this, the preview image can become soft. Lets assume you are editing a Nikon D700 image: 4256×2832px (that's 12.1 megapixels), and the preview image's size is 600x400px. Rotating it 5° will not be the same as rotating the full 12.1Mp image and then scaling it down to 600x400px. The former will be softer than the latter, though rotating the former will take less time than rotating the latter, which is why RawTherapee does that. But don't worry, when saving the image RawTherapee uses the full resolution image, so it will be sharp. If you zoom the preview in, then RawTherapee will use this higher resolution preview image when calculating the transformation, so to see what the saved file will look like, just zoom in to 100% Magnifier-1to1.png.

Lens Hood

Do not confuse vignetting with a blurry lens hood being visible in the corners of your image. Some cameras, typically small ones - compacts, bridge-type and even mirrorless - will capture parts of the lens hood or lens mechanism in the corners of the frame. Typically the same cameras have lenses which suffer from strong distortion. The way these cameras deal with these two problems is by correcting the distortion, as a result of which the corners of the image get "pushed out" beyond the frame, thereby hiding the corners darkened by the lens or lens hood. When you view a JPEG image from these cameras the distortion has already been corrected in-camera, so owners are often unaware that the problem existed in the first place and are surprised to find that the raw image shows these dark corners.

It is not possible to fix the dark corner issue by using vignetting correction - there is no information about the scene in those corners, the scene is occluded by the lens mechanism/lens hood. Do as the camera does: correct the distortion, and the dark corners disappear

Auto-Fill

Barrel distortion correction leaves black empty space in image periphery.
"Auto-fill" enlarges the image to fill in the empty space.

This option will upscale or downscale the photo to the extent that the whole image fits within the image boundaries with no black borders visible.

When correcting images that suffer from barrel distortion, "Auto-fill" will perform downscaling to fit as much of the re-projected image as possible into the image boundaries, so that you don't unnecessarily lose any parts of the image. Conversely if the image suffers from pincushion distortion, "Auto-Fill" will upscale the corrected image to fill the frame without black borders around the periphery.


Auto-Crop

"Auto-Crop" applied after distortion correction.
"Auto-Crop" applied after image rotation.

"Crop-auto.png Auto-Crop" is available when "Auto-fill" is disabled. When activated, it will not cause image interpolation, but instead will crop away the empty space left by the distortion correction or image rotation.


Rotate

Example of image rotation.

Rotate the image between -45° and +45°. Use the "Rotate-straighten.png Select Straight Line" button to set either a vertical or a horizontal image alignment. Use the mouse to draw this line - click and hold mouse to start, move to draw a new vertical or horizontal axis and release to engage image rotation.


Perspective

Example of horizontal perspective correction.
Example of vertical perspective correction.
Horizontal
When your picture was taken while you were slightly off-center of the object, you can correct this (within certain limits) with the horizontal slider.
Vertical
Very useful to correct 'falling lines', e.g. when photographing architecture. Higher values for both sliders produce heavy distortion, so use with care. Or don't care at all and have fun!


Profiled Lens Correction

As of RawTherapee 5.3, lens distortion, vignetting and chromatic aberration can be corrected using one of two systems: Lensfun or Adobe LCP. Both rely on a profile which contains the parameters for correcting lens distortion, vignetting and chromatic aberration.

Lensfun

Lensfun is an open-source project. A database of lens parameters is maintained by the developers. You can find more information in the Lensfun FAQ.

The options "Auto-matched correction parameters" and "Manual correction parameters" both use the Lensfun system. Both the "Camera" and "Lens" comboboxes will contain long lists of cameras and lenses (if they do not, your RawTherapee build is buggy - please report that). A profile matching your camera and lens will be auto-detected if your photo contains metadata which matches an entry in the Lensfun database.

Common causes of failure to auto-detect a profile include:

  • A profile for your camera/lens combination does not exist in your version of the Lensfun database.
  • A profile for your camera/lens combination does exist, but it uses names and parameters which differ enough to confuse the matching algorithm, for example "Pentax" vs "Ricoh Pentax", or "F4.0" vs "f/4".

In both cases you could try to find and run the executable lensfun-update-data to download the latest version of the Lensfun database. If that does not help, you could copy and paste the relevant section from the Lensfun database (which could be taken from one of the files in /usr/share/lensfun/) into a new file $HOME/.local/share/lensfun/myLensfun and modify the relevant parameter to match the metadata from your photos. You can find the camera and lens name and parameters contained in your photos by viewing the Exif quick info panel in RawTherapee, shortcut key "i" in the Editor tab. If parameters for your camera and lens simply don't exist, view the Lensfun documentation to find out how to measure them and contribute them for everyone's benefit.

Note that while editing the Lensfun database in /usr/share/lensfun/ directly may be possible, this is not recommended because you could lose your changes during an update.

LCP

Adobe provides and offers tools to create and share what are called Lens Correction Profiles. These are text files which describe the distortion, vignetting and chromatic aberrations (CA) of a lens, so that simply loading this file in LCP-capable software such as RawTherapee will correct these issues. Select an Adobe LCP file (read the guide on how to get LCP profiles) to automatically correct geometric distortion, vignetting and lateral chromatic aberrations.

The Lens Correction Profile tool's distortion correction feature can be used together with the manual Distortion Correction tool, and the vignetting correction feature can be used together with the manual Vignetting Correction tool. This lets you use the manual controls in addition to the LCP profile for artistic reasons or if the LCP fails to sufficiently correct a parameter (which happens on some extreme distortion occasions, like with some heavily distorting compact cameras). Be careful that you don't overdo the distortion and vignetting correction by forgetting to turn the manual tools off if you use the LCP equivalents. The vignetting correction feature however is linked to the Flat Field tool, so that when you select a flat-field image then the LCP's vignetting correction will have no effect.

The following restrictions apply:

  • Distortion, vignetting and chromatic aberration correction are all supported in raw files, but only distortion correction is supported in non-raw files.
  • While distortion correction is visible in the full image preview, chromatic aberration and distortion correction are not reflected in the detail crop windows, only in the fully processed result image. Auto-filling is also not supported.
  • Chromatic aberration correction is only supported if the Exif information contains the focus distance (e.g. in DNGs from Nikon files).
  • Auto-Fill is disabled when an LCP with distortion correction is enabled, otherwise the preview may become distorted - see bug 1791.
  • To keep the preview fast and responsive, the main preview image is used to show the effects of the LCP. As this image is small (exactly the size you see), fixing the distortions will make it appear a little blurry. This has no effect on your saved image, which will be sharp, and so will the zoomed-to-100% preview. Only the zoomed-out preview that will look soft. See feature request 2186.

As with any other tool, you can apply an LCP to multiple images either by including it in the processing profile (see Creating processing profiles for general use), or by selecting multiple images where the same lens was used (you can use the Metadata Filter in the File Browser tab to make this easier) and applying the LCP from the File Browser tab.


Distortion Correction

This button has been renamed to "Automatic" in RawTherapee 5.

Corrects lens distortion. A negative number corrects barrel distortion, a positive value will correct pincushion distortion. You can place a grid over the image by activating Crop (without cropping) and using "Guide Type > Grid". This may serve as a guide to correct lens distortion.

The "Automatic" button only works if your camera corrected the distortion of the JPEG image embedded in the raw file (most cameras embed a JPEG image in every raw file, and some cameras correct the distortion of that image too). What this feature does is it looks at the JPEG image and, if it was corrected, tries to fix distortion in the raw image by making it match the JPEG image. There are two limitations:

  • If the JPEG image was not distortion-corrected by your camera, this button will have no effect.
  • If the JPEG image is insufficiently corrected or over-corrected, so will the results be, but as the computed correction will be shown on the Amount slider, you can further refine it manually.


Chromatic Aberration Correction

400% zoom showing correction of CA.
CA easily visible even at 100% corrected.

This "Chromatic Aberration Correction" tool in the Transform tab works on the image after demosaicing. The Chromatic Aberration tool in the Raw tab works on the image before demosaicing.

Chromatic aberration can be corrected by using the "Red" and "Blue" sliders. Normally you won't see any chromatic aberration in the fit-to-screen preview, therefore it is highly recommended to open a detail window Window-add.png or to zoom the main preview in to 100% Magnifier-1to1.png or more when you attempt this kind of correction. As in other software tools, this algorithm eliminates moderate chromatic aberration quite well. Do not expect miracles with images having extremely high chromatic aberration - garbage in, garbage out.


Vignetting Correction

Vignetting means light fall-off around the periphery of an image as compared to the center. One of the differences between a cheap lens and an expensive one is that the former is likely to produce stronger vignetting than the latter. The "Vignetting Correction" tool is meant to correct vignetting caused by the lens. This tool is not intended for artistic vignetting; use the Vignetting Filter tool for that.

Amount
Setting the "Amount" slider to a positive value brightens the four edges of the images to correct the classical vignetting. Setting it to a negative value darkens them.
Radius
Influences how much of the image beginning from the edges will be brightened or darkened. Lower values: area of darkening is bigger; higher values: area of darkening is smaller.
Strength
Amplifies the settings of the "Amount" and "Radius" sliders. Set "Amount" to -100, "Radius" to 50 and move "Strength" from 1 to 100 to see how this works.