Surfaces that are not flat

Every fisheye is a different rule

The word "fisheye" names a shape of lens and not a projection. There are several, they disagree with each other by tens of per cent at the frame edge, and each is the right answer to a different question — one is a protractor, one is a counting instrument, one preserves shape. Which one a lens implements is a fact about that lens, and it is rarely printed on the barrel.

A fisheye is usually introduced as a lens so wide that it gives up on straight lines. That description is a statement about what has been lost and says nothing about what has been chosen, and something has definitely been chosen: there is no single fisheye projection, there are several, and they differ from one another by a great deal.

The differences are not subtle. Take a direction 80° off the optical axis and ask each surface where in the picture it lands, in units of the focal length. The equidistant rule puts it at 1.396. The equal-area rule puts it at 1.286. The stereographic rule puts it at 1.678. Those are the same direction, on the same camera, off by up to thirty per cent — and a photograph does not carry a label saying which was used.

Area scale across the picture, for six surfacesThe flat plane's area scale is sec³θ and leaves the frame before 70°. The equal-area fisheye is the flat line at 1, which is what its name asserts and what this measures.02468020406080angle off the optical axis (degrees)area scale, relative to the centreplanecylinderstereographicequidistantequal-areaequirect.measured by differencing on the spherethe plane leaves the frame
Fig. 1 Area scale against angle off the optical axis. Five curves rise; one does not. The equal-area fisheye holds 1.0000 across the whole field, which is what its name asserts and what this measures. The flat plane’s curve is sec³θ and leaves the frame before 70°.

Four rules, one shape of glass

All the fisheye mappings are azimuthal: they turn a direction into a radius and an angle, keep the angle, and decide the radius by a rule that depends only on how far off axis the direction is. Write θ for that angle. The rules are:

  • rectilinear, r = f tan θ — the flat picture plane, which is not a fisheye and is the family’s reference point;
  • stereographic, r = 2f tan(θ/2) — conformal, and the subject of its own essay;
  • equidistant, r = f θ — radius proportional to angle;
  • equal-area, r = 2f sin(θ/2) — equal solid angles occupy equal areas of the picture.

A fifth, orthographic, r = f sin θ, exists and is used in some scientific optics. It is not implemented on this site, and it is named here rather than measured, because measuring it would mean claiming a number this site did not compute.

The four differ only in the function, and everything about their behaviour follows from it. The most useful way to see the difference is to ask how far each can reach.

At 180° across — a full hemisphere, edge to edge — the rectilinear rule has no answer at all, because tan(90°) is infinite. The stereographic rule puts the edge at 2 focal lengths. The equidistant rule puts it at π/2 ≈ 1.571. The equal-area rule puts it at √2 ≈ 1.414.

Past 180° they keep going and the rectilinear one is not there to keep going. Equidistant reaches 240° at 2.094 focal lengths, equal-area at 1.732, stereographic at 3.464. All three can, in principle, record a direction behind the camera; only stereographic has a direction it can never record, which is the exact antipode.

How wide the picture gets as the field of view opensOn a flat plane the picture's half-width is tan(θ/2): it multiplies by 6.6 between 120° and 170° and is unbounded at 180°. On a cylinder it multiplies by 1.42 over the same range and keeps going past 180° without incident.0246850100field of view across the picture (degrees)half-width of the picture, in focal lengthsplanecylinderstereographicequidistantcut off at eight focal lengthsthe plane crosses it at 166°
Fig. 2 Half-width of the picture against field of view, for four of the surfaces. The equidistant line is straight — the picture’s radius is the angle — and the flat plane’s is the one that leaves the frame. The graph is the whole argument about what “wide” means.

The one that is a protractor

The equidistant rule, r = f θ, has a property that reads as a triviality and is the reason the rule exists: distance from the centre of the picture is proportional to angle off axis. Halve the radius and the angle halves exactly — a direction imaged at half the frame radius of the 90° edge is at exactly 45°, to the last digit.

That makes an equidistant fisheye an angle-measuring instrument. Print a set of concentric circles at equal radii and they are a set of equal steps in angle. A picture taken with such a lens can be read with a ruler and turned into directions, which is what a surveyor’s fisheye, a sky-camera and a lens used for daylight-factor calculations all need.

It preserves nothing else, and the numbers show it plainly. Over the same 0° to 80° sweep, the equidistant surface’s area scale runs from 1.000 to 1.418 and its anisotropy from 1.000 to 1.418 as well. Those two are equal because the map stretches the radial direction by exactly 1 and the tangential direction by θ/sin θ, so the whole distortion is one factor, appearing as both a stretch of shape and a growth of area. A circle at the edge of an equidistant fisheye is an ellipse forty per cent longer around the frame than toward its centre.

The one that counts

The equal-area rule, r = 2f sin(θ/2), is the only surface in this whole comparison other than stereographic that has a quantity exactly preserved rather than approximately controlled. Its area scale over the entire drawn field is 1.0000, flat, to the resolution the measurement has.

That is a specific and unusual promise: the fraction of the picture that something occupies is the fraction of the sky it occupies. Count the black pixels in a photograph of a forest canopy taken with an equal-area fisheye and the answer is the fraction of the hemisphere covered by leaf. Count them in a photograph taken with an equidistant fisheye and the answer is wrong by up to forty per cent, weighted toward whatever happened to be near the edge.

Canopy photography, sky-view factor in urban climate, and light-pollution surveys all want this, and all of them are measurements where the person doing the counting is not the person who chose the lens. That is the gap the numbers here are for: a hemispherical photograph looks like a hemispherical photograph whichever rule made it, and the difference only shows up in the answer.

The price is shape. Equal-area’s anisotropy at 80° off axis is 1.70 and its worst angle error is 29° — the worst of any surface here except the flat plane. Objects near the rim of an equal-area fisheye are visibly squashed radially, and the squashing is exactly what makes the area come out right.

Five great circles, imaged on the equal-area fisheyeThe same conic fit reports 1.5e+0 — not a circle, and not a line either.fitted conic: 1.547 from being a circleequal-area fisheyethe samples, fitted
Fig. 3 Five straight world lines cast onto the equal-area fisheye, with the general conic fitted to each. The fit reports neither a circle nor a line — an equal-area image of a straight line is a curve with no simple name, which is the ordinary case and stereographic’s circles are the exception.
Straight, or conformal — the corner that is emptySix picture surfaces plotted by how much they bend a straight line (across) against how far they are from preserving shape (up). The plane sits on the left edge and the top; stereographic on the bottom and the right. Nothing sits in the bottom-left corner, and by Beltrami's theorem nothing can.straight AND conformal — empty10⁻⁷10⁻⁶10⁻⁵10⁻⁴10⁻³10⁻²10⁻¹10⁰10⁻⁷10⁻⁶10⁻⁵10⁻⁴10⁻³10⁻²10⁻¹10⁰10¹10²bend of a straight line, as a fraction of its own chorddeparture from conformal (degrees, or % of anisotropy)planecylinderstereographicequidistantequal-areaequirect.sampled over a 115° fanlower left would be a surface with no cost
Fig. 4 Where the three fisheye rules sit against the plane and the cylinder. Each is a point on the same two axes; none is near the empty corner, and each is nearest the axis it was designed to hold.

What “equal area” has to be checked against

A surface named after a property is making a claim, and a claim that has never been tested is a name. The equal-area result above is the strongest single number in this whole field — an exactly flat line where five other curves rise — and it is worth setting out what stands behind it, because a flat line is also what a broken measurement produces.

The area scale is not derived. It is differenced: at each direction, two perpendicular tangent vectors on the sphere are pushed through the map, and the area of the parallelogram they span in the picture is divided by the area they spanned on the sphere. That is a general procedure that knows nothing about which surface it has been handed.

A general procedure can still be systematically wrong. Differencing at too large a step measures curvature instead of slope; at too small a step it measures rounding. So the procedure is checked against the one case in the family with a short closed form: the flat plane’s area scale is sec³θ, and at 42° off axis the differenced value and sec³(42°) agree to eleven digits. That agreement is what licenses the other five numbers, and if it ever drifts every figure in this field is reporting the step size.

Then there is the other half. A measurement that reports 1.0000 for the equal-area surface would be worthless if it reported 1.0000 for everything, and it does not: over the same sweep it reports 191 for the flat plane, 2.90 for stereographic, 2.71 for the cylinder, 1.42 for equidistant and 1.39 for equirectangular. The instrument discriminates by more than two orders of magnitude, and the one surface it reports as flat is the one whose name says it should be.

Where the rules come from

The four functions are not arbitrary, and the family they belong to is worth naming because it explains why exactly these and not others.

Each rule is a choice of how to spend the picture’s radius on the field’s angle, and the four are the four natural answers. Keep the tangent and straight lines survive — that is the plane, and it is what a projection through a centre onto a flat surface does with no further decisions. Keep the angle itself and the picture becomes a protractor. Keep the area and the picture becomes a counter. Keep the shape and the picture becomes conformal, which fixes the rule to the half-angle tangent and nothing else.

Three of the four are the same three properties the whole field turns on — straightness, area, shape — and the fourth, equidistance, is not a preserved property of the world at all but a preserved property of the instrument. That asymmetry is real and slightly odd: equidistant is the only surface in this comparison chosen for the convenience of whoever reads the picture rather than for anything the picture is faithful to.

For a lens designer the rule is a target rather than a consequence. A sequence of refracting surfaces maps angle to image height by a function determined by the whole prescription, and the designer trades that function against everything else a lens has to do. The result is that real fisheyes are near one of these rules and exactly on none of them, and that a lens’s actual mapping is something to be measured rather than assumed — which is the same conclusion this site reaches about every other picture-making device it examines.

Which rule is in the lens

The awkward practical fact is that lens manufacturers are inconsistent about this, and often silent.

Most photographic fisheyes are marketed as “equisolid”, which is the equal-area rule under its optical name, and most of them are close to it and not exactly on it. Some are nearer equidistant. Lenses sold for scientific use usually state the mapping and sometimes ship a calibration. A lens sold for photography usually states a focal length and a field of view, which between them do not determine the mapping at all.

That the two numbers do not determine the mapping is worth dwelling on, because it is the same shape of gap this site keeps finding. A focal length and a field of view fix the picture’s edge. They say nothing about where anything between the centre and the edge goes, and the four rules above all agree at the centre and disagree everywhere else. A specification that pins the endpoints and leaves the interior free is not a specification of a projection.

Determining the rule from a photograph is possible and is exactly the single-view metrology problem in a different costume: photograph a scene with known angles — a grid on a wall, or a set of stars — and fit the radius against the angle. The fit distinguishes r = f θ from r = 2f sin(θ/2) easily, because at 80° they differ by 7% of the frame radius, which is dozens of pixels.

One room at 220° across, cast onto six picture surfacesEach panel holds the same angular width of the same scene. The flat plane keeps every straight line straight and cannot hold this field of view at all; the five curved surfaces bend the ground lines by 3.5% to 6.0% of their own length.no picture at 195°the plane is unbounded at 180°plane — bend 0.0%cylinder — bend 6.0%stereographic — bend 3.5%equidistant — bend 4.5%equal-area — bend 5.1%equirect. — bend 5.7%195° across in every panelsame scene, same angle, six surfaces
Fig. 5 The same room at 220° across, wider than any flat picture can be. The three fisheye panels agree near the centre of each frame and disagree increasingly toward the rim, which is where all the difference between them lives.

Past the hemisphere

The three fisheye rules all continue past 180°, and what that means is worth being concrete about because it is the point at which the word “picture” starts to strain.

A hemispherical picture records every direction in front of the camera. A 220° picture records those plus a ring of directions behind it, imaged in the outer band of the frame. Nothing in the geometry objects; a direction is a direction, and the map has a value for it. What breaks is an assumption every reader brings, which is that a picture is a window — that the marks correspond to a patch of the world laid out in front, in the way a flat picture’s do.

Past 180° the correspondence stops being a window and starts being a chart. The outer band of a 220° fisheye contains the photographer’s own feet, the tripod, and whatever is over the shoulder, arranged in a ring by azimuth. There is no viewing position, on any surface, from which that band looks like the scene, because the scene is not in one direction from the eye any more.

This is where the site’s premise reaches its own edge. A perspective picture is correct from one point because a projection through a centre is invertible: the marks determine the rays, and standing at the centre puts the reader’s eye where the rays were. That remains true for a hyper-hemispherical fisheye — the rays are still determined — but the reader has no way to stand at the centre and receive them, since they arrive from every direction at once and a reader has one face.

The consistent thing to say, and the thing the surfaces themselves say, is that a picture wider than a hemisphere is a record of a light field rather than a view of a scene. It can be measured, re-projected, and cut into views. It cannot be looked at correctly, and no surface fixes that, because the problem is not in the surface.

Seven identical spheres across a 84° frameThe outer sphere images 27% wider than the central one. That is what a correct rectilinear projection does, and it vanishes if the picture is viewed from 9 cm.70 px89 px70° across27% wider at the edge
Fig. 6 The argument this section extends, made on the flat plane. Seven identical spheres across a wide frame image at different widths, and the stretch is exactly what a correct rectilinear projection must do.

Not a distortion, again

An earlier essay on this site argued that a wide rectilinear photograph is not distorted: the stretch at its edges is exactly what a correct projection through a centre must do, and it disappears when the picture is viewed from the point it was made for. The same argument applies here, with one part removed and one part added.

Removed: there is no single viewing point that repairs a fisheye picture printed flat, because the surface is not a plane. The rectilinear case has the clean answer — stand at the focal length scaled to the print — and the fisheye case does not.

Added: a fisheye is not a failed attempt at a rectilinear picture, and treating it as one is where the word “distortion” does its damage. Software offering to “correct fisheye distortion” is offering to re-project onto a plane, which is a real and often useful operation and is not a correction of anything. It trades the fisheye’s even scale for the plane’s straight lines, at a cost that grows as sec³θ, and past about 120° the trade has nothing left to give: the corners of the corrected image are a handful of original pixels smeared across a large area of the result.

The honest description of every operation in this field is the same. A projection is chosen, it preserves one thing, and it destroys the others by an amount that can be computed. Re-projecting swaps which thing is preserved. Nothing is ever repaired.

What to choose, and the question it depends on

The whole field reduces to a single question and it is not a question about pictures.

If the picture is going to be measured for angles, use equidistant, because the ruler reads degrees. If it is going to be counted for area, use equal-area, because the pixel fractions are solid-angle fractions. If it is going to be looked at, use stereographic, because shapes stay shapes. If it is going to be measured for lengths on a plane, use a flat picture and keep the field of view down, because the rectification machinery needs straight lines and a homography, and neither exists on a curved surface without an extra un-projection first.

And if the answer is “it is going to be stored and decided later”, use equirectangular, which preserves nothing and addresses everything, and accept that a re-projection from it inherits whatever the original lens lost.

The one wrong answer is to choose without knowing there was a choice. That is what “fisheye” as a single word encourages, and it is why this essay is a list of four functions rather than a description of a look.