The real instrument

A model that inverts has a horizon instead of a fold

The polynomial every calibration fits turns around at a finite radius and stops being a map from direction to picture. The division model, chosen because it inverts in closed form, never turns around — it rises for ever toward a horizon at one over the root of its own coefficient, so the whole hemisphere of directions lands inside a finite disc. Fitted to the four fisheye laws over seventy-five degrees it follows every one of them three to five times more closely, and below sixty the polynomial is still the better model.

Worth reading first: Straight lines that are not · Which rule a fisheye obeys, from straightness alone.

A barrel model folds at a radius it sets itself finds the polynomial every calibration fits to a wide lens — the radius times one plus a coefficient times the radius squared — stops increasing at a radius its own first coefficient fixes. At a coefficient of −0.28 that is 47.49 degrees of field, and past it two directions land on one picture radius. The routine that undistorts pictures with it does not refuse there: it hands back wrong directions from 46.75 degrees, by as much as 106.5, and refuses only at 65.5.

A tilted sensor is not a distortion then found that the polynomial’s tangential companions describe a change of camera badly. Both are failures of one family of models, and there is another family in common use which fails differently.

A model chosen for one property

The division model writes the undistorted radius as the distorted one divided by one plus a coefficient times its square. It is used because that inverts in closed form: the inverse is a quadratic, and the admissible root is the one that goes to zero with its argument. No iteration, no convergence test, no failure to converge.

The polynomial has no such inverse. Undistorting a picture with it means solving for the radius numerically, which every calibration library does and which is where the silent failure of the earlier measurement lives.

So the two are usually compared on convenience. The question worth asking is what each one can represent, and the answer separates them more sharply than the convenience does.

One turns around; the other never does

Set both models to the same coefficient and draw them against the radius a pinhole would give.

The polynomial rises, reaches a maximum, and comes back down. At a coefficient of −0.42 the turn is at 0.89 focal lengths, which is 41.7 degrees of field, and past it the curve is two-valued: two directions land on one picture radius and the map is no longer a map from direction to picture.

The division model rises and keeps rising. At the same coefficient it approaches 1.543 focal lengths and never reaches it. That number is one over the square root of the coefficient’s magnitude, and it is a horizon rather than a fold: the whole infinite pinhole plane — which is the whole hemisphere of directions — lands inside a disc of that radius.

Nine tenths of the way out to the horizon is 82.2 degrees of field. So a model adopted because it inverts easily turns out to reach where the other cannot go at all.

Past 42° the polynomial comes back inward; the other model never doesThe same two models read as maps from direction to picture radius. The polynomial rises to 41.7 degrees and then falls, so a direction at seventy degrees lands nearer the middle than one at sixty and the picture folds over itself. The division model rises all the way to the horizon at ninety degrees and arrives at 1.543 focal lengths, which is the edge of a picture that holds the entire hemisphere. Neither curve is a claim about any real lens; they are what each model is capable of describing, and the difference decides which of them can be fitted to a fisheye at all.00.50011.5020406080how far off the axis the direction is, in degreeshow far from the centre of the picture it lands42°the division modelboth at k = -0.42horizon 1.54
Fig. 1 The same two models read as maps from direction to picture radius. One rises to its fold and comes back inward; the other rises all the way to ninety degrees and arrives at a finite edge.

The failure the polynomial has and this one does not

The earlier measurement’s finding is worth restating precisely, because the contrast is exact rather than rhetorical.

The polynomial’s radial map has a maximum. Past it the map is not injective, so undistorting is not a well-posed question — two directions are consistent with one picture radius and nothing in the picture says which. That is a defect of the model, not of the solver, and it is silent because the solver returns one of the two roots without complaint.

The division model’s map is monotone on the whole positive axis for a barrel coefficient. Checked at every hundredth of a focal length out to four hundred — a field no lens has — it never decreases, and its supremum is the horizon. So the inverse is unique everywhere and the closed form is not merely convenient but correct.

What the division model cannot do is represent a picture radius beyond its horizon. That is a constraint rather than a failure: any coefficient fitted to real data has a horizon outside the data, and if it does not, the fit has said something the data did not.

A barrel polynomial at k₁ = -0.28 folds at 47.49°Picture radius against field angle for the polynomial r(1 + k₁r² + k₂r⁴), with the pinhole's tan θ beside it. The polynomial rises to 0.727 focal lengths at 47.49° and falls after it: past the fold two directions share one picture radius, and a picture radius of 0.713 is reached from 43.91° and from 50.54°. The search for the maximum lands on the closed-form fold to 5e-9. The radial factor itself reaches zero at 62.11°.00.50011.50020406080field angle off the axis (degrees)picture radius, in focal lengthsfolds at 47.49°43.91°50.54°the radial factor reaches zeropinholefolds at 47.49°43.91° and 50.54° share one radius
Fig. 2 The polynomial’s own fold, from the measurement that found it: the radius at which the map turns around, set by the coefficient and by nothing else.

Fitted to a fisheye, over a field

Representing a wide field is the use that separates them, and every fisheye is a different rule supplies the four laws to fit: equidistant, equisolid, stereographic, orthographic.

Both models were fitted to each law by least squares, over fields from forty degrees to eighty, with two coefficients each so the comparison is like for like. The worst error is reported as a fraction of the picture’s own radius at the edge of the field.

Below sixty degrees the polynomial is the better model, by a factor of about two: 3.1 × 10⁻³ against 4.8 × 10⁻³ for the equidistant law at forty-five degrees. That is worth saying first, because it is why the polynomial is the standard choice and why the rest of this is about the edge rather than about the two families.

At seventy-five degrees the division model is better on every law, by factors of three to five: 5.5 × 10⁻² against 2.6 × 10⁻¹ for the equidistant law, 1.2 × 10⁻¹ against 4.9 × 10⁻¹ for the orthographic.

The division model wins past 70°, where the polynomial has folded inside its own fieldEach of the four fisheye laws fitted by both models over a field of the stated width, with the worst error reported as a fraction of the picture's radius. Below sixty degrees the two-coefficient polynomial is the better model and the two are within a factor of three of each other. Past seventy the division model is better on every law, and the polynomial has by then folded inside the field it is being fitted to — first at 70 degrees — which means its curve is no longer a map from direction to picture at all over part of the data it was fitted with. The upper family is the polynomial and the lower the division model.0.0010.010.114050607080how much field the model is fitted over, in degreesworst error, as a fraction of the picture's own radiusthe polynomial, four lawsthe division modelfilled marks: the polynomial has folded inside its databoth models, four laws
Fig. 3 The four fisheye laws fitted by both models over fields from forty degrees to eighty. Below sixty the polynomial wins; past seventy the other does, and by then the polynomial has folded inside the field it was being fitted to.

The residual is not the whole of it

The comparison above is a comparison of residuals and it understates the difference, because at those fields the polynomial is not a model any more.

The polynomial fitted to the equisolid law over seventy-five degrees folds at 61.7 degrees. Fitted to the orthographic law it folds at 58.9. So a fifth of the field it was fitted over is past its own fold, and over that part the curve it draws is not a map from direction to picture radius — it is a curve that happens to pass near the data while running back inward.

A fit does not notice. Least squares asks how far each sample is from the curve, and a sample near a curve that is coming back down is as close as one near a curve that is going up. Nothing in the residual says the model has stopped being invertible, and nothing in a calibration report usually does either.

So the honest statement is two-part: past seventy degrees the division model is better on the residual, and past sixty the polynomial has stopped being a model over part of its own data while its residual carries on looking respectable.

Why the two fail in opposite directions

The shapes of the two failures are worth naming, because they follow from one line each.

The polynomial’s radial map is a cubic in the radius, with a negative leading coefficient for a barrel lens. A cubic with a negative leading term must eventually come down, and the only question is where — which is what the coefficient decides. The fold is not a defect that a third or fourth coefficient repairs; it moves the fold and gives the curve another one further out.

The division model’s map is a ratio whose denominator grows faster than its numerator. It therefore tends to a finite limit rather than turning around, and the limit is where the denominator’s growth exactly cancels the numerator’s. Adding coefficients moves the horizon and does not create a fold, because the ratio stays monotone as long as the denominator stays positive.

That is the whole of it: a polynomial that must eventually decrease, against a ratio that must eventually flatten. Neither is more principled; they are different shapes, and the shape decides which fields each can describe.

The inverse hands back wrong directions from 46.75° and refuses only at 65.5°A direction pushed through the polynomial at k₁ = -0.28 and back through the undistortion routine as a calibration uses it, from 0.5° to 89°. Well short of the fold at 47.49° the direction comes back. From 46.75°, just inside the fold where the map has already flattened, it comes back wrong with no warning — by as much as 106.5°, a direction handed back on the other side of the axis — and only from 65.5° does the routine refuse. 21.1% of the directions swept are returned silently wrong.-50050100020406080direction that went into the lens (degrees)direction the inverse hands back (degrees)returned silently wrongreturned right21.1% of the field silently wrongworst by 106.5°
Fig. 4 What the polynomial’s failure looks like from the outside: the band of directions returned silently wrong, before any routine refuses.

Turn the sign round and the two exchange failures

The measurement so far is about a barrel lens, which is what a wide lens is. Pincushion distortion is the other sign, and running both models at a positive coefficient is the sharpest test of whether the difference above is about the two families or about barrel lenses.

It is about the families, and they swap.

A polynomial with a positive coefficient is a cubic with a positive leading term: it rises for ever and never folds. So the failure a barrel model folds at a radius it sets itself measures does not exist for pincushion at all.

The division model with a positive coefficient acquires the failure the polynomial has lost, in the opposite currency. Its inverse contains a square root whose argument goes negative past a finite undistorted radius: at a coefficient of 0.25 that radius is exactly one focal length, which is forty-five degrees of field, and beyond it no picture radius corresponds to any direction. The model does not fold; it runs out of world.

So the honest summary of the pair is not that one model is better behaved. It is that each has one limit, that the limits are in different currencies — a fold in the picture against a ceiling on directions — and that which of the two is limited is decided by the sign of a coefficient rather than by anything about lenses.

With the sign turned round it is the other model that runs out, at 45°The same pair at a pincushion coefficient, where the two exchange their failures. The polynomial now rises without bound and never folds. The division model stops: its inverse has a square root whose argument goes negative past 1.000 focal lengths, so no picture radius corresponds to a direction beyond 45.0 degrees and those directions cannot be represented at all. Which of the two models has a limit is decided by the sign of the coefficient and not by anything about lenses.00.50011.5020123where a pinhole would put the point, in focal lengths from the centrewhere the model puts itwhere the division model stopsboth at k = 0.25no direction past 45°
Fig. 5 The same pair at a pincushion coefficient. The polynomial now rises without bound; the division model stops, and no direction past forty-five degrees can be represented at all.

What each model owes a renderer

A headset renders a picture bent so its lens can straighten it, which is the one case in which distortion is introduced on purpose. The render is distorted on purpose measures that round trip closing to a thousandth of a millionth of a pixel, and the price in delivered pixels at the edge of the field.

The two models cost a renderer quite different amounts there. The division model’s forward direction — the one a renderer needs, from an undistorted direction to a bent picture radius — is the closed-form root, so the whole warp is arithmetic. The polynomial’s forward direction is the easy one and its inverse is the iteration, which is the direction a camera pipeline needs rather than a renderer.

So the choice between them is partly a choice about which direction is going to be run millions of times. That is a good reason to prefer one and it is not a reason to believe one, and the two get confused: a model adopted for the speed of one direction is then trusted about the field it can represent, which is a separate property and the one measured here.

Neither model touches the other thing a lens does. Straight lines that are not establishes that a radial map leaves exactly one family of lines straight — those through the principal point — and that is true of both models at every coefficient, because it follows from the map being radial and from nothing else. A lens destroys the invariant is likewise indifferent: the cross-ratio fails under either model by an amount set by the distortion rather than by its parametrisation.

What this means for a calibration

Three practical readings, and the third is the one that is not obvious.

Below about fifty degrees of half-field, use the polynomial. It is the better model there by a factor of two on every law tried, its fold is well outside the data, and it is what every toolkit expects.

Past about sixty-five, use the division model or a fisheye law directly. The polynomial’s fold is inside the data by then, and a fitted model that is not invertible over part of its own field will produce wrong directions from a picture rather than an error.

And check the fold as part of reading a calibration. The fold’s position follows from the coefficients alone — it needs no data and takes one line — so it can be computed from any calibration report and compared with the field the camera actually has. A report whose fold is inside its own field is telling its reader something, and nothing in a residual says it.

Fitting a lens from straightness alone and the lines that calibrate a lens measure how well the coefficient itself is determined by a picture; this adds the separate question of whether the model that coefficient belongs to can be inverted over the field it was fitted to, and the two are independent. A coefficient determined to nine parts in ten thousand, in a model that folds at sixty degrees, is a precise number in an unusable map.

How the horizon is found, and why it needs no data

One more property separates the two, and it is the one that makes the rule above checkable by a reader who has only a calibration report.

Both limits are properties of the coefficients alone. The polynomial’s fold is where the derivative of its radial map vanishes, which for a one-term model is at one over the root of three times the coefficient’s magnitude; the division model’s horizon is at one over the root of the coefficient’s magnitude. Neither needs a picture, a target, a residual or a camera — just the numbers a calibration prints.

That is unusual. Almost every claim a calibration makes needs the data back to check: whether the fit was good, whether the target filled the frame, whether the principal point was free. This one does not, and it takes two lines of arithmetic to convert a printed coefficient into a field angle past which the model has stopped describing anything.

The measurement above uses that in both directions. The fold angles quoted for the polynomial fitted to each law — 66.2 degrees for stereographic, 58.9 for orthographic — come from the fitted coefficients and not from the residuals, and they are what says the fit had stopped being a model before it stopped fitting. And a division model’s horizon, computed the same way, is what says whether its extrapolation past the fitted field is a hemisphere or something smaller.

What this does not settle

Only the radial part is compared. Both families have tangential companions, and a tilted sensor is not a distortion measures what those do when the departure they are asked to absorb is a change of camera rather than a lens. Nothing here asks whether a division model with tangential terms behaves any better in that case.

The laws are the targets rather than a lens. A real fisheye follows none of the four exactly, and fitting a model to a law measures the model’s shape rather than its performance on glass. What the comparison is entitled to say is which model can follow a wide, smooth, monotone curve to the edge of a hemisphere, which is a statement about the family.

And the two-coefficient comparison is one choice among several. A three-term polynomial fits better than a two-term one and folds somewhere else; a one-term division model is worse than a two-term one and has a simpler horizon. The comparison here holds the count equal, which is the fairest single choice and is not the only defensible one.

Still open: where the horizon should be put deliberately

The horizon is a consequence of the fitted coefficient here, and it need not be. A fit could be constrained to place the horizon at a stated field — ninety degrees, say, or a hundred — and asked for the best coefficients subject to that.

That is worth measuring because the horizon is the one thing the division model claims about directions it was never shown. A fit over seventy-five degrees puts the horizon wherever the residual likes, which for the equidistant law is not at ninety; so the model extrapolates to a hemisphere it has no evidence about, and a renderer using it outside the fitted field gets whatever the extrapolation says. The measurement asks how much residual a constrained fit costs inside the data, against how much better it behaves outside — and whether a model whose horizon is pinned at the physical limit of a hemisphere is measurably worse where it was fitted, or whether the constraint is nearly free and should simply be imposed.

The short version

The polynomial and the division model fail in opposite directions. The polynomial’s radial map turns around at a radius its own coefficient fixes — 41.7 degrees of field at a coefficient of −0.42 — and past it two directions land on one picture radius. The division model’s never turns around: it rises monotonically toward a horizon at one over the root of the coefficient, 1.543 focal lengths at the same setting, so the entire hemisphere of directions lands inside a finite disc and nine tenths of the way out is 82.2 degrees.

Fitted to the four fisheye laws with two coefficients each, the polynomial is the better model below sixty degrees by about a factor of two, and the division model is better past seventy by factors of three to five. At seventy-five degrees the polynomial has folded inside the field it was fitted to — at 58.9 degrees for the orthographic law — and its residual says nothing about it.

The equidistant fisheye against the best two-coefficient polynomial out to 60°The equidistant law, r = fθ, and the Brown–Conrady polynomial with k₁ = -0.2492 and k₂ = 0.0411 fitted to it by least squares from 0° to 60°. Over that field the polynomial is out by at most 2.9% of the picture radius at the edge. It does not fold anywhere in the field drawn. The law's own first coefficient, recovered numerically, is -0.333333.00.50011.502020406080field angle off the axis (degrees)picture radius, in focal lengthsfitted out to 60°worst 2.9% inside the fitno fold
Fig. 6 The four laws the fits above are against, which differ from each other by more than any model differs from any of them.

What links here

Computed from the collection, not written here: the essays that point at this one.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Barrel distortionBrown–ConradyCamera calibrationfield of viewFisheyeinstrument limitInverse projectionInvertibilityModel errorRadial distortion