What is the difference between perspective distortion and barrel or pincushion distortion?

I've heard of:

• perspective distortion
• barrel distortion
• pincushion distortion
• mustache distortion

What are these different types of distortion, and how do they relate? What causes them, and can they be corrected in the field, or in software post-production?

What about "fisheye projection" — is that a kind of distortion, too?

I've also heard the terms "lens distortion" and "geometric distortion" — are those yet more kinds of distortions, or broader categories, or what?

• +1 for distilling the recent confusion into a coherent, focussed QA. Commented Dec 21, 2016 at 20:56

Perspective is determined by the position of the camera relative to the scene. When a camera position produces a perspective that makes an object or scene look different than we might expect it to look we call that perspective distortion.

All of the other distortions listed are a result of the way lenses bend light as the light passes through them. They are the result of the geometry with which a lens projects a virtual image of the scene from which the light rays passing through the lens originate.

Perspective Distortion

Perspective distortion is kind of a misnomer. There is really only perspective. It is determined by a viewing position of a scene. In the context of photography perspective is a result of the position of the camera in relation to the scene as well as the positions of the various elements in the scene with respect to one another. What we call perspective distortion is a perspective that gives us a view of a scene or object within that scene that is different from what we would normally expect the scene or object to look like.

If one takes a photo of a three dimensional cube from a position very close to one corner the nearest corner of the cube appears to be stretched towards the camera. If one takes a photo of the same cube from a much greater distance and a much longer focal length so that the cube is the same size in the frame, the same corner of the cube appears to be flattened.

Many people misunderstand that it is the focal length of the lenses that cause the difference. It is not. It is the shooting position used to frame the cube with the two different lenses. If we had a camera and wide angle lens, both with sufficient resolution, and shot the cube with the wide angle lens from the same position as we had filled the frame with the cube using the longer focal length lens and then cropped the resulting photo so the cube is the same size the perspective would also be the same - the cube would appear just as flattened as when we shot it using the longer lens.

If one takes a photo of a rectangular skyscraper from the sidewalk across a narrow street the top of the building will look much narrower than the bottom. (Unless we were to properly use a tilt/shift perspective control lens or a view camera capable of perspective control movements.) When we view the scene with our own eyes our brain compensates for this difference and we perceive that the top of the building is the same width as the bottom. But when we view the photo we took from the same spot we don't give our brain the same full battery of clues (mainly our stereo vision due to having two eyes) and our brain does not perceive the photo in the same way as it perceived the actual scene from the same position.

The same is true when we take a portrait of a face from such a close distance that the nose looks twice as large as the ears. The nose is so much closer to the camera than the ears are that they appear much larger in proportion to the ears than they really are. When we view another person's face from such a distance with our eyes our brain processes the scene and corrects for the differences in distance between the various parts of the face in front of us. But when we view a photo taken from the same distance our brain lacks all of the clues it needs and can't build the same corrected 3D model in our perception of the photo.

Consider what we refer to as telephoto compression:

Let's assume you are 10 feet away from your friend Joe and take his picture in portrait orientation with a 50mm lens. Say there is a building 100 feet behind Joe. The building is 10X the distance from the camera as Joe is, so if Joe is 6 feet tall and the building is 60 feet tall they will appear to be the same height in your photo, because both would occupy about 33º of the 40º angle of view of a 50mm lens along the longer dimension.

Now back up 30 feet and use a 200mm lens. Your total distance from Joe is now 40 feet which is 4X further than the 10 feet you used with the 50mm lens. Since you are using a focal length that is 4X the original 50mm (50mm X 4 = 200mm), he will appear the same height in the second photo as he did in the first. The building, on the other hand, is now 130 feet from the camera. That is only 1.3X as far as it was in the first shot (100ft X 1.3 = 130ft), but you have increased the focal length by 4X. Now the 60 foot tall building will appear to be roughly 3X the height of Joe in the picture (100ft / 130ft = 0.77; 0.77 X 4 = 3.08). At least it would if all 60 feet of it could fit in the picture, but it can't fit at that distance with a 200mm lens.

Another way to look at it is that in the first photo with the 50mm lens, the building was 10X further away than Joe was (100ft / 10ft = 10). In the second photo with the 200mm lens, the building was only 3.25X further away than Joe was (130ft / 40ft = 3.25), even though the distance between Joe and the building was the same. What changed was the ratio of the distance from the camera to Joe and the distance of the camera to the building. That is what defines perspective: The ratio of the distances between the camera and various elements of a scene.

In the end, the only thing that determines perspective is camera position and the relative positions of the various elements of the scene.

For a look at how even a fairly slight difference in perspective affects an image, please see: Why is the background bigger and blurrier in one of these images?

Lens Distortions

Lens distortions are caused by the way a lens projects a virtual image of the light that enters the front of the lens out the back of the lens. The following terms are various types of lens distortions. Lens distortions are sometimes called geometric distortions because they affect the way geometrical shapes are depicted by a lens.

Barrel Distortion is a geometric distortion where straight lines appear to be curved away from the center of the image. This is caused by magnification being greater at the center of the lens than at the edges. Most lenses with barrel distortion are wider angle lenses that squeeze a very wide scene onto a narrower sensor or piece of film. The ultimate in barrel distortion is a fisheye lens, which sacrifices rectilinear projection in favor of a wider field of view gained by spherical projection. A set of straight horizontal and vertical lines subject to barrel distortion:

Pincushion Distortion is a geometric distortion where straight lines appear to be curved towards the center of the image. This is caused by magnification being greater at the edge of the lens than at the center. Pincushion distortion tends to show up on the longer focal length end of zoom lenses. A set of straight horizontal and vertical lines subject to pincushion distortion:

Mustache Distortion is, strictly speaking, a geometric distortion that demonstrates barrel distortion close to the center of the optical axis and gradually transitions to pincushion distortion near the edges. Sometimes other patterns of distortion caused by partially correcting barrel or pincushion distortion are also labeled as mustache distortion. A set of straight horizontal and vertical lines subject to mustache distortion:

Zoom lenses tend to demonstrate more geometric distortion than their single focal length counterparts. A prime lens, which is a lens with only a single focal length, can be tuned to best correct geometric distortion at that one focal length. A zoom lens must compromise to try and control distortion at all focal lengths. If the pincushion distortion is highly corrected for the longer end, the barrel distortion would be more severe at the wide end. If the barrel distortion is highly corrected on the wide end, it would exacerbate the pincushion distortion on the long end. The wider the ratio is between the widest angle and longest ends of a zoom lens' focal lengths, the tougher the tightrope is to properly correct geometric distortions at both ends.

Even with prime lenses it costs more to precisely correct lenses for geometric distortion than it does to correct them "just close enough". It costs more in term of research and development in the design stage of the lens. It costs more in terms of the number of optical elements used, the amount of materials needed to make those elements, and the cost of more exotic materials used to make some of the most effective corrective elements. It costs more to manufacture those increased number of optical elements, sometimes into more exotic irregular shapes, and at higher tolerances.

Some of the most expensive lenses are also some of the most highly corrected lenses for optical distortions. Lenses such as the Zeiss line of Otus lenses, for example. The cheapest zoom lenses tend to be lenses that display the most geometric distortion as well as other optical aberrations.

Correcting Lens Distortions

What causes them, and can they be corrected in the field, or in software post-production?

The cause of geometric lens distortions is the design of the lens and the way it bends the light that passes through it. Many simple lenses demonstrate geometric distortion of one kind or another. How much a lens corrects for that distortion depends on additional corrective elements added to a lens' optical formula.

The best way to correct geometric lens distortion in the field is to use the lens available at the time that demonstrates the least amount of undesirable distortion.

One can correct geometric distortion using in-camera processing of the image (if the camera has that capability) or in post-processing, but it comes with several caveats.

• As the edges are curved to correct for geometric distortion the coverage of the field of view is reduced if the rectangular or square shape of the overall image is preserved. Not everything seen on the edges in the uncorrected image will appear in the corrected image.
• When pixels are remapped resolution may be lost. If the lens is fairly soft and blurry to begin with, this will probably not even be measurable, much less noticeable. But with higher resolution lenses used on higher resolution cameras this can have both a measurable effect and even a noticeable effect at larger display sizes. As Roger Cicala, LensGuruGod1 at lensrentals.com, says in a blog post devoted to the topic,

"You CAN Correct It In Post, but . . .
. . . . there is no free lunch.

• Any in-camera correction applied to the image when shooting RAW will be reflected in the preview jpeg generated and appended to the raw file, but whether the correction will be applied in post-processing depends upon which raw convertor one uses. In general, third party raw converters such as Lightroom will ignore the instructions regarding correction included in the "maker notes" section of the EXIF information while most camera makers' in house software will apply the in-camera settings when opening a raw file. Also, the correction one can apply using a third party raw converter such as Lightroom will be done using lens profiles provided by that third party application rather than the lens profile, normally provided by the camera manufacturers, used in-camera to generate the jpeg preview or in post using the camera makers' own software. On the other hand, most manufacturers only provide correction profiles for their own lenses (for either in-camera or post-production correction) while third party raw converters will sometimes have profiles available for third party lenses.
• One important thing for people to understand is that distortion of any kind does NOT lead to blurring. Defocus, coma, astigmatism, etc. are blurring effects. Distortion simply "moves" lines to where you don't want them. Commented Dec 22, 2016 at 13:56
• @CarlWitthoft When the lens "moves" lines you are correct. But when they are "Moved" in postprocessing the difference in the shape of the curved shape of corrections and the square shape of the pixel grid does lead to a loss in resolution as is well documented by the included link to Roger cicala's blog. See also photo.stackexchange.com/a/69812/15871 Commented Dec 22, 2016 at 22:38
• True 'nuff -- I just don't count post-processing as an image degrader in the same way I view all geometric and quantum optics effects. Commented Dec 23, 2016 at 17:57

I've heard of:

perspective distortion

barrel distortion

pincushion distortion

mustache distortion

Perspective distortion describes how an image (or view, or, more accurately, your perspective) changes as you move closer or further away from your subject (ie. change your perspective).

The easiest way to think of this is this - imagine if you are just 10cm from somebody's face. From this distance (ie. from this perspective) you can't view their whole face at once - you have to turn your own head left, right, up, down, to view their whole face. Now think about the angle at which you are viewing their face when you turn your head left. The nose juts out, maybe blocking the view of their cheek.

Now back up to 5 metres away. You can see their whole face in one glance. You can see their nose and their entire cheek. The nose does not block the cheek no matter if you look at the left, right, or centre of their face.

This change in the appearance of the image (their face) is not due zooming in or out. If you stood at 5 metres away and used a zoom to enlarge their face to fill your frame - the perspective will not have changed. But if you walk up to the face, just 10cm away again, your perspective has changed and the face's appearance has changed.

There is a great image showing this distortion -

Although this image lists the focal lengths used, do not be fooled into thinking it was the focal length (or zoom) that caused the distortion. What's happened is that at the shorter focal lengths, the photographer has stepped in closer to the subject so as to fill the frame with the subject's face - it is this change in perspective that is causing the distortion.

A better example of the effect of focal length, or zoom, is in the sequence below -

Note here that because the camera position hasn't changed, the perspective hasn't changed between shots and so the barn is not distorted from one shot to another.

Sorry I can't comprehensively describe or explain the other 3 distortions you've listed.

Perspective distortion keeps straight lines straight. Parallels don't stay parallel (except when parallel to the horizon), however. Quadrilaterals are transformed into quadrilaterals. Perspective distortion can be described by a perspective transform equivalent, projecting a 3D scene through a point onto a plane.

Barrel and pincushion distortion don't keep straight lines straight. They bend them outward or inward, respectively, from the image center. They are a consequence of lens geometry. Mustache distortion happens when such distortion gets weaker again on the outside. It may be the effect of corrective measures for barrel or pincushion distortion not being equally effective at every point.

All of those various lens distortions rearrange the pixels in image (independent of scene content). Straight lines become curved lines for example. This is distortion of reproduction, since the subject lines are straight, and the curved lines do not exist.

Perspective arranges the scene content, of scene objects relative to each other. Near things (like maybe noses in a portrait) appear larger, simply because we stand up too close to view them. Or if we stand close, then different apparent horizontal separation of distant things relative to the near things... This is not distortion except in our minds notions. All cases are of course exactly how things actually appear when the camera stands in that spot

• How can various lens distortions rearrange "the pixels in an image" when the light traveling through the lenses that distort that light is not made up of pixels? Commented Dec 21, 2016 at 20:36
• Pissy mood today Michael? It's not that hard. :) The photons in the lens image are projected onto the sensor, to be captured and reproduced by the pixels. Lens distortion reroutes the photons into the wrong pixels. Then not the correct arrangement of data in the pixels, called distortion. Commented Dec 21, 2016 at 20:46
• That is the craziest definition of lens distortion I have ever heard. Lens distortion is caused by the way a lens refracts light rays, not how a lens arranges pixels. If one looks through the lens there are no pixels involved. If one captures an image on film there are no pixels involved. It has nothing to do with pixels directly, and only indirectly if one is doing digital photography and then rearranging the information from specific pixels to correct for distortion that happened to Light rays, not to pixels. Commented Dec 21, 2016 at 21:05
• this makes sense - people think with pixels nowadays, everything we do in photography is displayed on screens. skipping lens and refraction is a good idea if we are only interested in effects. Commented Dec 21, 2016 at 23:18
• But the question is not about effects and correcting distortion, it is about the distortion itself: what causes it and what does it look like. Commented Dec 21, 2016 at 23:24