LensDistortion (NukeX only) applies or removes lens distortion. To estimate the lens distortion on the input, you have three options. Each one of these will calculate the distortion present and set the values on the LensDistortion tab.
• Image Analysis - use this option to estimate the distortion automatically without the help of grids or lines. Image analysis tracks features through the sequence and finds the distortion model that best describes the way the same 3D structure is projected onto different parts of the image.
• Grid Analysis - use this option to estimate the distortion from a checkerboard or thin line grid, for greater accuracy.
• Line Analysis - use this option to estimate the distortion from lines you draw along features in the input that are known to be straight.
You must perform the analysis in NukeX, but you can also use the results in Nuke.
Connection Type |
Connection Name |
Function |
Input |
Source |
The image sequence to apply lens distortion to or remove lens distortion from. |
Mask |
An optional image to use as a mask. By default, the lens distortion analysis is limited to the non-black areas of the mask. You may not want to analyze all regions of your Source image, for example, if there are moving objects in the image. |
Control (UI) |
Knob (Scripting) |
Default Value |
Function |
LensDistortion Tab (After you’ve estimated your lens distortion, you can view the values on this tab. You can also change these to apply distortion to the input directly.) |
|||
Output Type |
outputType |
Image |
Choose your output type depending on whether you want to distort the input image directly or just preserve the distortion information to use it on another image: • Image - Choose to distort or undistort the input image. • Displacement - Choose to leave the input image alone and store the pixel displacements corresponding to the calculated distortion in the UV channels, so they can be used by the STMap node. Choosing the Displacement option enables you to analyze the distortion on one image or grid and use the STMap node to apply that distortion to another image. |
Lens Type |
lensType |
Spherical |
Select your lens type. You can choose between Spherical and Anamorphic lenses. |
Radial Distortion 1 |
distortion1 |
0 |
The first radial distortion term. This is proportional to r^2, where r is the distance from the distortion center. You can define this manually, or use image analysis, grid analysis, or line analysis to fill it out automatically. |
Radial Distortion 2 |
distortion2 |
0 |
The second radial distortion term, proportional to r^4. You can define this manually, or use image analysis, grid analysis, or line analysis to fill it out automatically. |
Distortion Center x, y |
distortionCenter |
0, 0 |
The values for the center of the radial distortion. |
Anamorphic Squeeze |
anamorphicSqueeze |
1 |
The anamorphic squeeze value. If you select an anamorphic lens, the distortion in x will be scaled by this amount. This control is only available if you have set Lens Type to Anamorphic. |
Asymmetric Distortion x, y |
asymmetricDistortion |
0, 0 |
Enter values to define asymmetric distortion to correct for slight misalignments between multiple elements in the lens. This control is only available if you have set Lens Type to Anamorphic. |
Analyze from Current Lens |
startFromCurrentLens |
disabled |
When enabled, the Image Analysis and Grid Analysis modes skip their initial estimation steps and instead use the current parameter values as an initial guess from which to estimate the distortion. If you already have a rough idea of the distortion present, this can speed up the estimation, particularly for the Image Analysis mode. |
Undistort |
invertDistortion |
disabled |
When enabled, LensDistortion applies the inverse of the current distortion. |
Reset |
reset |
N/A |
Resets the controls for zero distortion. |
filter |
filter |
Cubic |
Select the filtering algorithm to use when remapping pixels from their original positions to new positions. This allows you to avoid problems with image quality, particularly in high contrast areas of the frame (where highly aliased, or jaggy, edges may appear if pixels are not filtered and retain their original values). • Impulse - remapped pixels carry their original values. • Cubic - remapped pixels receive some smoothing. • Keys - remapped pixels receive some smoothing, plus minor sharpening (as shown by the negative -y portions of the curve). • Simon - remapped pixels receive some smoothing, plus medium sharpening (as shown by the negative -y portions of the curve). • Rifman - remapped pixels receive some smoothing, plus significant sharpening (as shown by the negative -y portions of the curve). • Mitchell - remapped pixels receive some smoothing, plus blurring to hide pixelation. • Parzen - remapped pixels receive the greatest smoothing of all filters. • Notch - remapped pixels receive flat smoothing (which tends to hide moire patterns). • Lanczos4, Lanczos6, and Sinc4 - remapped pixels receive sharpening which can be useful for scaling down. Lanczos4 provides the least sharpening and Sinc4 the most. |
Distortion Scaling |
distortionScaling |
Scale to Input Format |
Select either: • Scale to Input Format - to scale to your input format. • Choose Format - to choose another format. You might want to select this, for example, if you have previously undistorted an image and changed the format to match the undistorted image size, and then want to reapply the distortion later. |
Scale to Format |
outputFormat |
root.format |
If you have set Distortion Scaling to Choose Format, you can use this menu to select a format that you want to use to scale your image. |
Card Parameters |
|||
scale x, y, z |
cardScale |
1, 1, 1 |
Equivalent value for the scale control on the Card node, needed to reproduce the horizontal scale. This allows you to use the calculated lens distortion values to distort an image projected onto a card in 3D. |
a (r^3) |
a |
0 |
Equivalent value for the a (r^3) control on LensDistortion tab of the Card node. Defines a cubic term that affects the radial distortion of the texture applied to the card, and the edges of the card. This allows you to use the calculated lens distortion values to distort an image projected onto a card in 3D, for example, to simulate camera lens distortion effects, such as barrel distortion. Positive values make the card rounder, negative make the corners sharper. |
b (r^2) |
b |
0 |
Equivalent value for the b (r^2) control on LensDistortion tab of the Card node. Defines a square term that affects the radial distortion of the texture applied to the card, and the edges of the card. This allows you to use the calculated lens distortion values to distort an image projected onto a card in 3D, for example, to simulate camera lens distortion effects, such as barrel distortion. Positive values make the card rounder, negative make the corners sharper. |
c (r^1) |
c |
0 |
Equivalent value for the c (r^1) control on LensDistortion tab of the Card node. Defines a linear term that affects the radial distortion of the texture applied to the card, and the edges of the card. This allows you to use the calculated lens distortion values to distort an image projected onto a card in 3D, for example, to simulate camera lens distortion effects, such as barrel distortion. Positive values make the card rounder, negative make the corners sharper. |
Image Analysis Tab |
|||
Analysis Range |
analysisRange |
Source Clip Range |
Sets the range of frames in the sequence to analyze: • Source Clip Range - the entire sequence including all frames. • Specified Range - a particular frame range selection from the sequence. Enter the start and stop frame in the Analysis Start and Stop fields. |
Analysis Start |
analysisStart |
0 |
The first frame to analyze. This control is only available if you have set Analysis Range to SpecifiedRange. |
Analysis Stop |
analysisStop |
100 |
The last frame to analyze. This control is only available if you have set Analysis Range to SpecifiedRange. |
Camera Motion |
cameraMotion |
Free Camera |
Sets what type of camera movement to expect: • Free Camera - expect a freely moving camera that is rotating and translating. • Rotation Only - expect a still camera that is rotating only. |
Mask Channel |
maskWith |
None |
If you don’t want to analyze all regions of your image, for example if there are moving objects in the image, you can provide a matte in the Mask or Source input and use this control to select the matte channel: • None - no matte is used and the entire Source image is analyzed. • Source Alpha - the alpha of the Source input is used. • Source Inverted Alpha - the inverted alpha of the Source input is used. • Mask Luminance - the luminance of the image connected to the Mask input is used. • Mask Inverted Luminance - the inverted luminance of the image connected to the Mask input is used. • Mask Alpha - the alpha of the image connected to the Mask input is used. • Mask Inverted Alpha - the inverted alpha of the image connected to the Mask input is used. |
Analyze Image |
analyzeImage |
N/A |
Track features through the input sequence and estimate the lens distortion present. When the analysis is complete, this will set the controls on the LensDistortion tab in order to undistort the sequence. |
Feature Overlay |
showFeatures |
None |
After analyzing, you can choose: • None - to not display an overlay in the Viewer. • Features - to display the features that were detected on the current frame in a Viewer overlay. • FeaturesandTracks - to display the features and tracks that were detected on the current frame in a Viewer overlay. |
Grid Analysis Tab |
|||
Grid Type |
gridType |
Checkerboard |
Choose the type of grid you want to use, Checkerboard or ThinLine grid. |
Analyze Grid |
analyzeGrid |
N/A |
Calculate the lens distortion present. When the analysis is complete, this will set the controls on the LensDistortion tab in order to undistort the sequence. |
Align Grid |
alignGrid |
disabled |
Check to correct for perspective distortion caused by the grid not being shot square-on to the camera. In other words, you can align the grid lines with the image edges. |
Grid Overlay |
showGrid |
None |
After analysis, you can choose to display the Original or UndistortedGrid lines over the image. |
Line Analysis Tab |
|||
Drawing Mode On |
drawingModeOn |
disabled |
Check this to begin drawing lines along features in the input that should be straight. Draw a line by left-clicking along the feature at intervals and finish a line by clicking the right mouse button. You need at least three left-clicks to make one line, and at least three lines to initiate the distortion. |
Distortion Terms |
nCoefficients |
2 |
Choose the number of distortion terms to estimate. With only a few lines, sometimes better results can be achieved by estimating only the first radial distortion term. |
Estimate Center |
estimateCenter |
disabled |
Choose whether you want to estimate the distortion center. If the lines are not evenly distributed around the image, the center estimate is unlikely to be very good and you may get better results to approximate it by using the image center instead (the default). |
Analyze Lines |
analyzeLines |
N/A |
Click to estimate the lens distortion from the current lines. When the analysis is complete, this will set the controls on the LensDistortion tab in order to undistort the sequence. |
Delete Last Line |
deleteLastLine |
N/A |
Delete the last line drawn. Repeat to delete the previous line, and so on. |
Delete Last Point |
deleteLastPoint |
N/A |
Delete the last point drawn. Repeat to delete previous points that are not yet part of a completed line. |
Hide Lines |
hideLines |
disabled |
Hide the line overlay. |
Clear All |
clearAll |
N/A |
Delete all lines and points. |