# Keystone effect

The keystone effect is the apparent distortion of an image caused by projecting it onto an angled surface. It is the distortion of the image dimensions, such as making a square look like a trapezoid, the shape of an architectural keystone, hence the name of the feature. In the typical case of a projector sitting on a table, and looking upwards to the screen, the image is larger at the top than on the bottom. Some areas of the screen may not be focused correctly as the projector lens is focused at the average distance only.
In photography, the term is used to describe the apparent leaning of buildings towards the vertical centerline of the photo when shooting upwards, a common effect in architectural photography. Likewise, when taking photos looking down, e.g., from a skyscraper, buildings appear to get broader towards the top. The effect is usually corrected by either using special lenses in tilt–shift photography or in post-processing using modern image editing software.

## Theory

The distortion suffered by the image depends on the angle of the projector to the screen, and the beam angle.
The distortion (on a two-dimensional model, and for small focus angles) is best approximated by:
    ${\frac {\cos \left(\varepsilon -{\frac {\alpha }{2}}\right)}{\cos \left(\varepsilon +{\frac {\alpha }{2}}\right)}}$
where $\epsilon$ is the angle between the screen axis and the central ray from the projector, and $\alpha$ is the width of the focus.
From the formula, it is clear that there will be no distortion when $\epsilon$ is zero, or perpendicular to the screen.

## In stereo imaging

In stereoscopy, two lenses are used to view the same subject image, each from a slightly different perspective, allowing a three-dimensional view of the subject. If the two images are not exactly parallel, this causes a keystone effect. This is particularly noticeable when the lenses are close to the subject, as with a stereo microscope, but is also a common problem with many 3D stereo camera lenses.

## Solving the problem

The problem arises for screen projectors that don't have the depth of focus necessary to keep all lines (from top to bottom) focused at the same time. Common solutions to this problem are:
* moving the projector more to the center of the screen,
* tilting the screen in a small angle,
* the use of special software on the projector
* and computer controlling the projector.

## Correction

Keystone correction, colloquially also called keystoning, is a function that allows multimedia projectors that are not placed perpendicular to the horizontal centerline of the screen (too high or too low) to skew the output image, thereby making it rectangular.
It is often necessary for a projector to be placed in a position outside the line perpendicular to the screen and going through the screen's center, for example, when the projector is mounted to a ceiling or placed on a table top that is lower or higher than the projection screen. Most ceiling-mounted projectors have to be mounted upside down to accommodate for the throw of the image from the lens, with the image rotated right-side-up with software. Keystone correction is a feature included with many projectors that provides the ability to intentionally "distort" the output image to recreate the original rectangular image provided by the video or computer source, thus eliminating the skewed output that would otherwise result due to angled projection.
The ability to correct horizontal keystone distortion is generally only available on larger or professional level projectors. In most consumer units, this is easily corrected by moving the projector left or right as necessary, or less often by lens shifting, with similar principles as tilt–shift photography.

### Functionality

In modern projectors keystone correction technology is performed digitally (rather than optically) via the internal (LCD) panels or (DLP) mirrors of the projector, depending on the technology used. Thus, when applying keystone correction to an image, the number of individual pixels used is reduced, lowering the resolution and thus degrading the quality of the image projected. Home theater enthusiasts would argue that keystoning should not be used because of the impact it has on image quality. However, it is a useful technology in cases where the projector cannot be mounted directly in front of the screen, or on projectors utilizing lens shift technology where the projector must be mounted outside the frame of the screen.