Removing Lens Distortion Making Perspective Corrections and Reducing Vignetting

Even after correcting the perspective in the previous exercise, distortions and warping still remain. This is due to the fact that the image was put together as a panorama picture using several individual photos taken with a wide-angle lens. In addition, the image has a left and a right vanishing point.

To correct these defects, GIMP offers the Lens Distortion and Curve Bend filters. These filters provide not only perspective corrections, but also to a certain extent corrective measures for barrel- and pincushion-shaped lens distortions. If you wish, you could give your image the effect of a photo taken with a fisheye lens (an extreme wide-angle lens). You can also reduce or even eliminate vignetting. Basically, vignetting is the reduction of an image's brightness or saturation at the periphery in comparison to the image center. This effect often occurs when wide-angle lenses are used.

You can find the Lens Distortion and Curve Bend filters in the Filters > Distorts menu.

If you want to tag along again, open the image convergingverticals.png in the SampleImages folder on the DVD. We'll begin by using the filter. By handling the filter correctly you can omit practically all distortions in one step.

When you select the Lens Distortion filter (Filters > Distorts> Lens Distortion), a window opens with six slide controls to choose from.

It is hard to tell the difference between Main and Edge. Both distort the image convexly (outward, similar to a fisheye lens) by increasing the value and concavely (inwards) by reducing the value. Whereas Main affects the whole image equally, Edge only bends the edges, leaving the center of the image unchanged. Depending on the direction you select, you can straighten a cambered image. Essentially, these are the settings that correct barrel- and pillow-shaped distortions. For our image, the setting Main is recommended to do the correction.

Figure 3.16

The Lens Distortion preview window depicting the suggested settings.

Figure 3.16

The Lens Distortion preview window depicting the suggested settings.

3.5 TOUCHUP WORK 5 —USING PERSPECTIvE CORRECTION TO REMOvE CONvERGING vERTICALS VO

The Zoom slider changes the scale of the image content. This can be useful, for example, to reduce the image in size when creating a convex (fisheye) effect.

The Brighten slide control is useful to manage the vignetting effect by enhancing the dark edges of images.

X shift turns and distorts an image around the vertical axis, depending on the setting in Main and Edge. Y shift does the same on the horizontal axis, thereby propping up the image. Essentially, this is the setting for correcting a perspective distortion.

Figure 3.16 shows the correct values for fixing convergingverticals.png.

Figure 3.17

The Curve Bend window

Figure 3.17

The Curve Bend window

After you have straightened the image, continue by applying the correction methods applied in section 3.5.3. Unfortunately, even though the image has been set straight, the correction process lacked a grid in the preview to straighten the building completely.

The image has been straightened as much as possible. Yet it is still bulging upward. Now you can apply the Curve Bend filter (Filters > Distorts > Curve Bend). Leave the default settings and check the Automatic Preview so you can control your editing.

Figure 3.18

The original image in comparison

Figure 3.18

The original image in comparison

Figure 3.19

The result of editing to reduce the lens distortion of the building

Figure 3.19

The result of editing to reduce the lens distortion of the building

Figure 3.20

Fisheye distortion of the building

Figure 3.20

Fisheye distortion of the building

You don't have to rotate the image, so leave the Options value for Rotate at 0. The bulging section in the picture is located more at the top, so you can leave Upper selected under Curve for Border. At first you'll see a horizontal line in the Modify Curves graph. Drag the line from the middle section downward (as depicted in figure 3.17). Check the result in the preview window. When you are satisfied, confirm the results by clicking the OK button.

Verify your image along the grid lines. I used the Perspective tool to raise the drainpipe at the top-right corner of the building. In addition, I used the Scale tool to stretch the vertical lines a little.

The result for all the hard work is a straightened and almost right-angled illustration of our Art Nouveau building.

Figure 3.18 shows the image before editing, and figure 3.19 shows it after. Figure 3.20 is an attempt to imitate a photo taken with a fisheye lens. Distortions like this are necessary if the image content should be mirrored on a concave surface. I applied the filter several times in a row to reach this effect, applying Edge at maximum level.

The technique described may not work when rectifying distortions that occur when photographing very high buildings. You would have to severely lengthen the building to prevent it from looking disproportionate after the correction. Doing this would cause perspective flaws in the window embrasures to stand out.

+1 0

Responses

  • Finley
    How to remove lens distortion and vignetting with gimp?
    9 days ago

Post a comment