The real instrument

The response is at the ends and the information is not

A radial map bows a straight edge by an amount that grows as the square of the distance along it, so 93 per cent of an edge's response to the coefficient lies in its outer quarters. Spending the marks there is 16 per cent worse than spreading them evenly, because two clusters say nothing a shifted, tilted line could not say. What identifies the coefficient is a curvature, which needs three places — both ends and the middle, which beats an even spread by 11 per cent.

Worth reading first: Fitting a lens from straightness alone · Straight lines that are not.

The lines that calibrate a lens places whole edges. One straight edge through the middle of a picture says nothing about a lens’s distortion; one a hundred and eighty pixels off the middle determines the coefficient to 9.0 × 10⁻⁴, and the precision rises in proportion to the offset. Crowd three edges on one side and, once the distortion centre is also unknown, the coefficient comes back ten times worse.

The finer question places the marks along one edge rather than the edges in the frame, and the obvious answer to it is wrong.

The response, and where it is

A radial map moves every point along its own radius. Straight lines that are not establishes what that does to an edge: the only line it leaves straight is one through the principal point, and the bend of every other is decided by how far it passes from that place.

Along a single edge the bend is not uniform. The edge’s closest approach to the centre is where the radial displacement is most nearly along the edge itself and so most nearly invisible; toward either end the displacement turns across the edge, and the departure from straightness grows as the square of the distance along it.

Cut one edge into tenths and measure each mark’s own response to the coefficient. The two outer tenths carry 63 per cent of it between them, the two middle tenths carry 1.4, and the outer quarters carry 93.3 per cent of the whole.

A rectangular grid through a lens with k₁ = -0.32The faint grid is what a pinhole would have drawn. The solid one is the same grid through barrel distortion: the centre line is untouched, and the outermost bows by 17.8 px.principal pointk₁ = -0.075, k₂ = 0.110 — barrel distortioncentre line 0e+0 px of sag, outermost 1.3 px
Fig. 1 The map underneath all of it: every point moved along its own radius, and the family of lines a radial map leaves straight.

The advice that follows, and does not work

A calibration from a photograph has a budget: every mark is a place somebody has to find, and on a real edge near the corner of a frame they are hard to place. So the question has a practical form — if only twenty marks can be read along an edge, where should they go — and the response above answers it immediately. Put them where the response is: in the outer quarters, and better still in the outer tenths.

Measured, that is worse. At twenty-one marks and a known distortion centre, an even spread along the whole edge determines the coefficient to 2.04 × 10⁻³ and the outer quarters alone to 2.39 × 10⁻³ — seventeen per cent worse for marks placed exactly where nearly all the response is. The outer tenths, at the nine marks that fit there, are worse again.

93% of an edge's response to the coefficient is in its outer quartersOne straight edge across a distorted frame, cut into tenths, with each tenth's share of the edge's total response to the coefficient. A radial map bows an edge by an amount that grows as the square of the distance along it from its closest approach to the centre, so a mark in the middle barely responds and a mark at either end responds a great deal: the two outer tenths carry 63 per cent between them and the two middle tenths 1.4. This is the response, which is not the same as the information, and reading the two as the same is what the next measurement corrects.0102030400.2000.4000.6000.800where along the edge, as a fraction of the visible lengthshare of the edge's response to the coefficient, in per cent93% outside the middle halfone edge, 82 marks, cut into tenthsmiddle two tenths: 1.4%
Fig. 2 The edge cut into tenths, with each tenth’s share of the whole response to the coefficient. The two outer tenths carry most of it and the two middle tenths almost none.
The ends alone are 17% worse than an even spread; three tight clusters, 25% betterThe same number of marks placed four ways along one edge, with the edge's own position and angle fitted alongside the coefficient and the distortion centre held at the principal point. Reading the response as advice — spend the marks where the bow is — gives the outer quarters, which is 17 per cent worse than spreading them evenly, because two clusters at the ends say almost nothing a shifted, tilted straight line could not have said. What identifies the coefficient is the curvature of the mark sequence, and a curvature needs three separated places. Three tight clusters at the ends and the middle — the classical optimal arrangement for estimating a quadratic — beat the even spread by 25 per cent. Marks in the middle half alone, not drawn, are 7 times worse than the even spread.0.0020.0039122130how many marks are read along the edgehow precisely the coefficient comes backthe outer quarters onlyevenly along the whole edgethree loose clustersthree tight clustersthe distortion centre knownbest: three tight clusters
Fig. 3 The same number of marks placed four ways along one edge, with the edge’s own position and angle fitted alongside the coefficient. The arrangement with the most response is not the arrangement with the most information.

What a straight line can absorb

The reason is the edge itself, and it is worth stating because it is the general form of a mistake that recurs.

The fit does not know where the edge is or which way it runs. Those two numbers are nuisances, fitted alongside the coefficient, and they can absorb a great deal: a constant displacement across the edge is absorbed by moving the line, and a displacement growing linearly along it is absorbed by rotating the line.

What cannot be absorbed is curvature. The distinguishing signature of a radial map on a straight edge is that the marks bow rather than merely shift and tilt, and a bow is a second difference.

Two clusters of marks, one at each end, give a second difference no lever at all. Whatever the two clusters say, a straight line placed somewhere and tilted somehow passes through both — so the response those marks show is very largely the part the nuisances swallow. The marks in the middle are what say the line is not straight between the ends, and that is the entire content of the measurement.

Three places, not two

If a curvature is the quantity, three separated places is the minimum, and a design with three does best.

Marks placed at both ends and in a cluster at the middle determine the coefficient to 1.77 × 10⁻³ at twenty-one marks — thirteen per cent better than the even spread. Tightening the three clusters improves it further, to 1.53 × 10⁻³, which is twenty-five per cent better than the even spread and thirty-six per cent better than the ends alone.

That number has a name elsewhere. Fitting a quadratic through noisy data, the arrangement of observations that determines its coefficients best is three equally weighted clusters at the two ends of the range and its middle. A bow is a quadratic, so the design a lens wants is the one a textbook on experiment design would have written down — arrived at here by measuring rather than by looking it up, which is what makes the agreement worth something.

And the ends are not dispensable. Marks in the middle half alone give 1.34 × 10⁻², nearly seven times worse than the even spread, because a bow measured only where it is small is measured badly. So the recipe has both halves in it: the ends supply the size of the bow and the middle supplies the fact that it is a bow.

One straight edge, and how much it says about k₁ against where it passes — slope -1.04A single horizontal edge in the wide frame, marked every 8 px with half a pixel of error, and the smallest standard deviation any fit of k₁ can have from it, its own position and angle free. Through the centre the edge carries no information at all. At 5 px from the centre the deviation is 3.92e-2; at 180 px it is 9.04e-4. The fitted slope on logarithmic axes is -1.04.-3-2.50-2-1.5011.502how far the edge passes from the centre (px, log scale)predicted standard deviation of k₁ from that edge (log scale)3.92e-2 at 5 px9.04e-4 at 180 pxthrough the centre: no informationslope -1.04
Fig. 4 One edge and the marks along it, from the measurement that placed edges rather than marks — the same picture the designs above are cut out of.

With the centre unknown the gap widens

Everything above holds the distortion centre at the principal point. The lines that calibrate a lens found that freeing it is what turns a crowded design from mildly worse into ten times worse, so it is the case to check.

Freeing it here makes every design worse, keeps most of the ordering, and reverses one place in it. At twenty-one marks the even spread gives 1.92 × 10⁻², the outer quarters 3.00 × 10⁻² — now fifty-six per cent worse rather than seventeen — and the loose three-cluster design 1.79 × 10⁻², still the best. The middle alone collapses to 7.2 × 10⁻¹, thirty-seven times the even spread.

The reversal is the tight three-cluster design, which was the best of all with the centre known and is now 2.30 × 10⁻², worse than the even spread. The reason is that an unknown distortion centre has to be read from how the bow changes with distance from the middle of the picture, and three tight clusters supply almost no variety of distance. So the best design depends on what else is unknown, and a design chosen for one coefficient can be a poor design for four parameters.

The practical form of that is the loose three-cluster design: not quite the best with the centre known, and the best when it is not. Since a calibration from found edges rarely knows the centre, that is the one to use.

Four ways to place three straight edges, with the distortion centre knownThe predicted standard deviation of k₁ from three straight edges placed four ways, with the distortion centre known: three edges crowded on one side, 5.83e-4; two on one side, one on the other, 5.41e-4; three edges near the centre, 2.58e-3; three edges placed by search, 9.23e-4. The bars are drawn on a logarithmic scale. The best of the four here is two on one side, one on the other.three edges crowded on one side5.83e-4two on one side, one on the other5.41e-4three edges near the centre2.58e-3three edges placed by search9.23e-4the distortion centre known · log scalebest: 5.41e-4
Fig. 5 The edge designs the earlier measurement compared, where the same question was asked about whole edges in a frame rather than marks along one.

The absorbed part, written down

The whole result follows from one decomposition, and writing it out says why three places rather than two and why the middle is not optional.

Measure position along the edge as ss, running from 1-1 at one end to +1+1 at the other. The radial map’s displacement across the edge is, to leading order, proportional to k1k_{1} times a quadratic in ss — that is the bow. The edge’s own unknowns contribute a constant (moving the line across itself) and a term linear in ss (rotating it).

So the measurement is a regression of the observed across-edge displacements on three basis functions, 11, ss and s2s^{2}, and only the third carries the coefficient. What determines k1k_{1} is therefore not how large the displacements are but how much of the quadratic survives after the constant and the linear part are projected out — and a quadratic is orthogonal to those two only if the marks are spread in ss.

That is why two clusters fail. Marks at s±1s \approx \pm 1 only see the quadratic at one value of s2s^{2}, where it is indistinguishable from a constant; the fit obligingly explains it as a moved line. Adding marks at s0s \approx 0 gives the quadratic a second value, the constant cannot follow, and the coefficient appears.

It also explains why tighter clusters are better once the centre is known: for estimating a quadratic from three positions, the positions that separate it furthest are the extremes and the middle, and blurring each cluster spends marks at values of s2s^{2} that are nearly duplicates. And it explains the reversal when the centre is free: the centre is read from how the bow’s size varies with distance from the picture’s middle, which a design confined to three values of ss cannot report.

Where this leaves the coefficient’s other uses

A coefficient determined better is worth something only where the coefficient is used, and it is used for two quite different things.

The first is undistorting a picture, where the precision translates directly into pixels of residual bend. The second is the model’s own limit: a barrel model folds at a radius it sets itself shows the fold’s position follows from the coefficient alone, so an uncertainty in the coefficient is an uncertainty in where the model stops being invertible.

That second use makes the precision matter at a place nobody looks. At k1=0.28k_{1} = -0.28 the fold is at 47.49 degrees of field; a coefficient uncertain by 2 × 10⁻³ puts the fold uncertain by about a fifth of a degree, which is small. A coefficient uncertain by 2 × 10⁻² — what a crowded design gives once the centre is free — moves the fold by two degrees, and a reader comparing a fold at forty-seven degrees against a camera’s own forty-five-degree half-field is making a decision the uncertainty can flip.

A model that inverts has a horizon instead of a fold is the other model’s version of the same dependence, with a horizon in place of a fold and the same arithmetic from the same one number.

Why the response looked like the answer

The mistake has a name in this collection and it is worth attaching, because the same shape has turned up under several disguises.

A quantity’s response to a parameter is how much it moves when the parameter moves. Its information about that parameter is how much of that movement survives everything else that is unknown. The two are the same only when nothing else is unknown, and something else is nearly always unknown.

Here the something else is the edge’s own position and angle, which are not incidental: they are unknown precisely because the method’s whole point is that no calibration target is needed and the edges are whatever happened to be in the scene. Fitting a lens from straightness alone is that method — no target, no known scene, no camera — and the nuisances are the price of it.

So the correct reading of the first figure is not “put the marks here”. It is “the ends are where the signal is largest”, which is a fact about the map, and the placement question needs the second measurement to answer.

The same question, one level up

The measurement here is about marks along one edge and the lines that calibrate a lens is about edges in a frame, and the two answers have the same shape once both are stated.

That one found that distance from the centre is not enough: three edges crowded on one side of the frame determine the coefficient ten times worse than a spread once the distortion centre is free, because a bow on one side looks like a moved centre. This one finds that distance along an edge is not enough either: marks crowded at its ends determine the coefficient worse than a spread, because a bow seen at one distance along looks like a moved line.

Both are the same sentence with different nuisances in it. The coefficient is identified by a variation — of bend with position in the frame, or of displacement with position along an edge — and any design that supplies the variation at too few values hands it to whatever else is free. Fitting a lens from straightness alone is the method both are about, and the reason it has so many nuisances is exactly the reason it needs no target.

What this changes about reading an edge

Three practical statements, and the first is the one worth carrying.

Do not skip the middle of an edge. A reader tracing an edge in a photograph naturally attends to the ends, where the bow is visible, and may not bother with the straight-looking middle. Those marks are carrying the fact that the bow is a bow.

Twenty-one marks in three clusters are worth about thirty spread evenly, on the numbers above, which is a real saving when marks are expensive to place.

And the outermost tenths are not worth chasing on their own. The nine marks that fit inside the outer tenths give 5.5 × 10⁻³ against an even spread’s 2.6 × 10⁻³ at the same count, so the hardest marks to place — at the very corners of the frame — are the least useful per mark once the edge’s own freedom is accounted for. They earn their keep only in company with marks from the middle.

What this does not settle

One edge, one orientation, one offset. The edge measured is a horizontal one a hundred and fifty pixels below the centre. The share of response in the outer quarters depends on how far the edge passes from the centre and on how much of it the frame shows, and the best design may depend on those too. The direction of the result — three places beating two — follows from the curvature argument and should not, but it is not measured across the family.

Only one coefficient, and only a radial one. A lens destroys the invariant measures what a lens does to the one quantity a projection is supposed to preserve, and a tilted sensor is not a distortion measures a departure from a pinhole that the radial model does not contain at all. Neither is affected by where the marks sit along an edge, since both are about what the model can represent rather than about how well its coefficient is determined.

The noise is independent and uniform. Half a pixel at every mark, uncorrelated. A real edge traced by a detector has errors correlated along its length, and correlation along the edge is exactly what a nuisance absorbs, so the effect measured here would be larger rather than smaller.

The edge is assumed to be straight. That is the whole premise of the method and it is an assumption about the world rather than about the picture: a gutter that sags, a wall that bows, a shelf that has settled. A slightly curved edge is absorbed by exactly the quadratic term the coefficient is read from, which is the failure mode the three-cluster design is most exposed to, and nothing here measures how much real curvature is tolerable. The render is distorted on purpose is the one case where the bend is known in advance and the question does not arise.

And only k1k_{1} is free. With a second radial coefficient in the model the two are strongly correlated — fitting a lens from straightness alone measures that correlation at −0.997 — and the mark placement that best separates two coefficients need not be the one that best determines one. That is a different design question with the same shape.

Still open: which marks separate the two coefficients

The design above determines one coefficient. A model with two has a harder problem, and the earlier correlation of −0.997 says how much harder: the two coefficients are nearly the same parameter over the field a single edge occupies.

Separating them needs marks at radii that differ enough for and r⁴ to look different, which is a statement about distance from the picture’s centre rather than about distance along an edge. So the two design questions point in different directions: the one measured here wants three places along an edge, and the other wants edges at several distances from the middle.

The measurement that settles it computes, for a fixed total number of marks, the precision of each coefficient and the correlation between them across designs that trade the two — marks spread along few edges, against fewer marks along many edges at different offsets — and asks whether a design good for one coefficient is ever good for both, or whether the budget has to be split deliberately. It would also say what the earlier measurement’s −0.997 becomes under a design chosen to break it, which is the number a reader would actually want before deciding whether a second coefficient is worth fitting at all.

The short version

A radial map’s effect on a straight edge grows as the square of the distance along it, so 93.3 per cent of an edge’s response to the coefficient sits in its outer quarters and 1.4 per cent in its middle fifth.

That is not where the marks should go. At twenty marks the outer quarters alone determine the coefficient sixteen per cent worse than an even spread, because two clusters at the ends are consistent with a straight line shifted and tilted, and the fit is free to shift and tilt the line. Marks at both ends and in the middle are eleven per cent better than an even spread, and the middle alone is seven times worse — so the ends give the size of the bow and the middle gives the fact that there is one. With the distortion centre free as well the ordering is the same and the gap widens to sixty-one per cent.

The valley two distortion coefficients sit ink₁ and k₂ are recovered exactly from clean data and are correlated at -0.997. Walking away from the fit along the stiff direction costs 25.1 px of straightness; the same walk along the soft direction costs 1.28 px. The ratio of the two curvatures is 813.01020-0.200-0.10000.1000.200distance from the fitted coefficients, along each directionstraightness residual (px)stiff directionsoft directioncondition number 813k₁ and k₂ correlate at -0.9969
Fig. 6 The other half of the same subject: the direction in which a plumb-line fit is soft, which decides how well the coefficient is determined once a second one is admitted.

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.

Camera calibrationConditioningCorrelationDemonstrationerror propagationleast squaresplumb-line calibrationPrincipal pointRadial distortionResidual