This tool corrects lens distortion and sensor misalignment. The distortion is both of the classical polynomial type and for fish eye lenses.
The tool can use camera/lens description files (*.lcf) generated by the Proxel Lens Analyzer tool.
The plugin is started from the "File→Automate→Lens Corrector" menu.
All parameters use the same coordinate system. We assume that the original image is taken with the camera in the normal position, i.e. landscape mode and not upside-down. We use half the width as unit distance and the center of the image as origin.
The distortion for lenses are normally modelled as a
polynomial, i.e:
rimage =
rorig1 +
k1 * rorig3 +
k2 * rorig5.
Positive k1 and k2 correct pincushion distortion.
Negative values correct barrel distortion.
NOTE – that large negative values do not generally correspond to any real lens distortion. It will eventually curve down again and create inverted images and other strange effects.
Fish eye lenses are described by this formula:
rimage = fish_r * 2.0 / PI * atan((rorig / fish_r) * (PI / 2.0)).
The fish_r parameter is the radius at the sensor for a 180 degree fish eye image.
Note that when parts outside the 180 degree circle are found on the sensor, the corrected image is really infinitely large. This is not possible – more about this in section "Limit on Image" below.
If the sensor is not perfectly centered to the lens, the image might need to be translated before applying corrections.
NOTE – to be able to detect translation, the distortion needs to be large, e.g. a fish eye lens, or the translation needs to be large, e.g. a shift lens. On the other hand – translation that cannot be detected does not affect the image visibly, so it does not matter. Therefore – for normal lenses, translation is best kept to 0.
Normally the corrected image does not fit to the original canvas. The tool has two methods for correcting this – canvas expansion and scaling.
It is advisable to use one of the two automatic modes for canvas size, i.e. "outer" and "inner". You will probably use the "inner" mode – and this is the default mode.
The "inner" mode finds the largest canvas rectangle that contains no parts outside the image. The "outer" mode finds the smallest rectangle that contains the entire original image.
NOTE – For extreme values on parameters the "inner" and "outer" definitions might get rather complicated. The entire original image might not be possible to draw on the output. Some parts of the image might even be inverted. Inverted parts are defined as being outside the image.
NOTE – the computed expansions are shown in the four custom fields after doing a preview. Expansions might be negative. Expansions might also be strange, i.e. left=10000, right=-9000. This means that the canvas is moved in the coordinate system. This can only be the case for extreme parameters.
NOTE – you can also see the actual size of the resulting image.
It is also possible to set the canvas size manually. Either you can set it to no expansion or you can set the expansion to custom values.
NOTE – that the custom values are zapped each time you use any other setting and do a preview.
Doing canvas size changes are generally dangerous – as the canvas can get very large. To protect against this there is a limit on the canvas size. The size fields will turn red when you have exceeded the maximum allowed limit.
See also "Scale Image" below.
You can also set the scaling of the image. This feature is mainly used when the canvas expansion above results in a too large image.
NOTE – To ensure optimal quality of the image, it is advisable to keep the image scaling parameter to 1.0. The center of the image will thus not be scaled and and no information will be lost there.
When reading an image Photoshop also reads a copy of the meta information (a.k.a. as EXIF info). This tool extracts what camera has been used and also what focal length has been used, if possible. The focal length is used when loading parameters from the project file.
NOTE – currently no lens information for cameras with interchangeable lenses is extracted. This is due to the fact that no standardization of that information exists. In many cases you can extract that info with the Proxel EXIF Tool though (http://www.proxel.se/exif.html).
If no valid focal length could be found, you can set the focal length manually.
NOTE – for fixed focal length lenses you don't need to set the focal length. This value is only used to interpolate the parameters for the focal length you have used.
You can set the project file name, i.e. the file that describes the camera (plus lens if you have a camera with interchangeable lenses).
NOTE – this does not actually load the file.
If the lens is fixed focal length the parameters are loaded directly from the project file.
If the lens is a zoom lens, you need a focal length (either from EXIF or manually) to interpolate the parameters from the measured parameters in the project file.
You can choose between several interpolation methods. In practice you can use bicubic for most work - it is fast and good. If you have higher demands you can use sinc8x8 or sinc16x16. They are slower though. The mode sinc32x32 is very slow and you have to make tests to determine if you find any improvements over sinc16x16.
The preview window can either show the original or the corrected image. In the "corrected" mode, the preview is automatically updated whenever you change any settings.
The tool assumes that you have analyzed the image in landscape mode. So – if the image is in portrait mode – the camera is assumed to have been rotated counterclockwise 90 degrees.
A button containing a camera icon shows the assumption that the plugin has made. You can flip the orientation by pushing the button.
NOTE – it is only necessary to flip the orientation if the parameters for translation (xc and yc) are non zero.
The project files are simple text files. They are made by the Proxel Lens Analyzer tool. This tool uses straight lines and advanced detection and optimization to detect lens distortion. This tool is a part of the same package as the Lens Corrector Photoshop plugin.
The demo of the Proxel Lens Corrector Photoshop plugin is fully functional, except watermarking of the result. You need to register the product to remove this watermarking. A registration key can be bought from Proxel Software HB. Please visit http://www.proxel.se/ for further information.
To register the product you need to run Photoshop with administrator rights, load an image, start the tool, enter the registration dialog and insert the key. If the OK button and the key text field in the registration dialog are active (non grayed) you have administrator rights.