Through water and glass

A calibration through glass reports a prism

Give a calibration that knows nothing of a 2° wedge in front of the lens the two decentring terms every standard model carries, and it takes three-quarters of the swirl the wedge leaves, moves the principal point further rather than less, and reports a lens decentred by about 0.013 — a lens that does not exist. Give it thin-prism terms instead and it takes more — nine-tenths at twenty-five degrees off the axis, almost all of it nearer — and reports what the glass is: a prism. Either way the residual that announced the glass goes quiet, out to 41° and 46° off the axis instead of 22°.

Worth reading first: What survives a pane of glass · Recovering the camera from the picture it drew.

A wedge moves the centre, not the lens put a two-degree wedge of glass in front of a camera whose lens has no distortion, and calibrated the camera with a model that knows nothing of the glass: rotation, focal length, principal point and one radial coefficient. The calibration did not invent a lens. It reported a coefficient of about 0.002, moved its principal point by 4.5 to 14 pixels, and left a residual that swirled with the wedge’s thick edge — a pattern no radial model takes, visible from twenty-two degrees off the axis.

Standard calibrations carry two more parameters than that model had, for exactly the kind of displacement a radial coefficient cannot describe: the decentring, or tangential, terms of the Brown–Conrady model, which describe a lens whose elements are not quite coaxial. A wedge in front of a lens is, loosely, a very badly decentred element. The earlier essay closed by asking three things of those terms: how much of the swirl they absorb, whether the principal point then moves less, and whether the terms a glass-blind calibration reports are large enough to look like a defective lens.

They absorb most of it. The principal point moves more, not less. And the terms they report describe a lens so decentred that a calibration engineer would send it back — while describing the glass correctly would have needed a different pair of terms, which describe a prism.

Three calibrations of one camera behind glass

The arrangement is the earlier one exactly: a 620-pixel camera with no lens distortion at all behind a two-degree wedge of crown glass, read at twelve directions on two rings, forty and twenty degrees off the axis, with exact readings. Four calibrations are fitted, each blind to the glass: the radial model the earlier essay used; the same with the two Brown–Conrady decentring terms added; the same with two thin-prism terms instead; and with both.

Through a 2° wedge, a calibration with decentring terms leaves 0.54 px across the disc against 1.88 px radial onlyThe camera behind a 2° wedge, its lens free of distortion, read on two rings 40° and 20° off the axis and fitted by a calibration that knows nothing of the glass: rotation, focal length, principal point and a radial coefficient, and decentring terms. The arrows are the difference between where the glass puts each direction and where the calibration puts it, over the whole disc the readings span, magnified 40 times: 0.539 px root-mean-square and 1.15 px at worst, against 1.883 and 3.44 for the radial model alone. The calibration reports a principal point moved 10.49 px, a radial coefficient of 0.00128, and decentring 1.3e-2 and -5.4e-3.with decentring terms · residual × 40 · rms 0.54 px over the discno single viewpoint — the rays miss by a wedge's worth, varying with incidencedecentring 1.3e-2 and -5.4e-3
Fig. 1 A distortion-free camera behind a 2° wedge, read at 40° and 20° off the axis and calibrated with decentring terms but no glass. The residual over the whole disc, ×40: 0.54 px RMS and 1.15 px at worst, against 1.88 and 3.44 for the radial model. It reports its principal point moved 10.49 px and decentring of 1.3e-2 and −5.4e-3.

The field of arrows is the difference between where the glass puts each direction and where the calibration puts it, drawn over the whole disc the readings span and not only at the readings, magnified forty times. With the decentring terms free, the swirl the radial calibration left — 1.88 pixels root-mean-square across the disc, 3.44 at worst — falls to 0.54 and 1.15. The slider swaps the model; the thin-prism terms take it to 0.41.

The decentring terms describe a specific pattern. In normalised coordinates they add 2t1xy+t2(r2+2x2)2t_1xy + t_2(r^2 + 2x^2) to the horizontal coordinate and t1(r2+2y2)+2t2xyt_1(r^2 + 2y^2) + 2t_2xy to the vertical: a displacement that grows as the square of the distance from the centre, in a direction that turns with position. A wedge’s leading effect after the rotation the calibration already absorbs is also a displacement growing roughly as the square of the field angle, with a direction fixed by the wedge’s thick edge. The two are not the same pattern, but they share enough that fitting one absorbs most of the other.

How much each set of terms takes

The comparison worth making is across reach, since the earlier essay found that a wedge hides near the axis and shows further out.

At 25° off the axis the swirl is 0.57 px radial only, 0.16 with decentring terms and 0.048 with thin-prism termsA glass-blind calibration of a camera behind a 2° wedge, fitted from two rings of readings, and its root-mean-square residual across the whole disc the readings span, for four sets of terms. Radial only: 0.084, 0.276, 0.567, 1.023, 1.883, 3.460, 6.210 px at 10, 18, 25, 32, 40, 48, 55°. With Brown–Conrady decentring terms: 0.038, 0.094, 0.159, 0.263, 0.539, 1.309, 3.144. With thin-prism terms, the model written for a tilted element: 0.009, 0.020, 0.048, 0.133, 0.407, 1.173, 2.966. With both: 0.001, 0.010, 0.042, 0.130, 0.406, 1.177, 2.989. Near the axis a wedge is a thin prism, and the thin-prism terms take nearly all of it; far from the axis it is not, and no set of these terms takes it.0.0010.010.11101020304050how far off the axis the reading reaches, degreesresidual across the disc, px (log)radial onlywith decentring termswith thin-prism termswith botha 2° wedge, exact readings, residual over the discwhich terms take the swirl
Fig. 2 The glass-blind calibration’s RMS residual across the disc, against how far off the axis the reading reaches. Radial only: 0.084 px at 10°, 0.57 at 25°, 1.88 at 40°, 6.2 at 55°. With decentring terms: 0.038, 0.16, 0.54, 3.1. With thin-prism terms: 0.009, 0.048, 0.41, 3.0. With both: 0.001, 0.042, 0.41, 2.99.

The decentring terms take between half and three-quarters of the swirl at every reach: at twenty-five degrees off the axis the residual across the disc falls from 0.57 pixels to 0.16, and at forty from 1.88 to 0.54. The thin-prism terms take more: 0.048 at twenty-five degrees, and near the axis almost everything, 0.009 against 0.084 at ten degrees. Both sets together are the thin-prism result and a little more near the axis, and nothing more further out.

The thin-prism terms are the ones written for this. Weng, Cohen and Herniou added them to the calibration model for a lens with a slightly tilted element — a displacement s1r2s_1r^2 horizontally and s2r2s_2r^2 vertically, the same direction everywhere and growing as the square of the radius. A thin wedge is a thin prism, and near the axis a thin prism’s departure from a rotation is exactly that. It is a different thing from a tilted sensor, which a tilted sensor is not a distortion found is a pinhole camera with a moved principal point and no distortion at all; a tilted plate of glass bends rays, and a tilted sensor only catches them at a slant. What the thin-prism terms cannot take is the wedge’s behaviour further out, where the deflection depends on the incidence angle in a way no square law describes; past about forty degrees the residual under every model is growing as fast as under the radial model alone, and at fifty-five degrees all four leave three pixels.

So the answer to the first question is: the decentring terms take most of the swirl, and a different pair of terms, written for tilted elements, takes more. Neither takes it all, and nothing short of modelling the glass takes it at wide field. The wedge recovered with the camera did model the glass, and the same readings with the wedge in the model leave 6×10−146\times10^{-14} of a pixel.

The swirl before any extra terms

It helps to see the pattern the extra terms are competing for, drawn as the earlier essay drew it.

Through a 2° wedge, a calibration with no glass in it leaves 1.62 px that no lens coefficient takesTwelve directions on two rings, 40° and 20° off the axis, seen through a 2° wedge by a camera whose lens has no distortion, and fitted by a calibration that knows nothing of the glass: the camera's rotation, a radial coefficient, the focal length and the principal point all free. The large dots are the twelve readings; the arrows are the difference between where the glass puts each direction and where the calibration puts it, drawn over the whole disc the readings span and magnified 40 times, at 0.252 of the picture's scale. At the readings it leaves 1.615 px root-mean-square and 3.42 px at worst; across the disc, up to 3.62 px. It has moved its principal point by 7.75 px and reported a radial coefficient of 0.00152. The pattern is not radial — it swirls with the wedge's thick edge — which is why no radial coefficient takes it. The same readings with the wedge in the model leave 6e-14 px.residual × 40 · rms 1.62 px at the readings · principal point moved 7.7 pxno single viewpoint — the rays miss by a wedge's worth, varying with incidencethe glass-blind calibration at 40°
Fig. 3 The radial calibration’s residual, for contrast: the same camera and wedge, rotation, focal length, principal point and one radial coefficient free. The arrows swirl with the wedge’s thick edge — 1.615 px RMS at the readings, the principal point moved 7.75 px, a coefficient of about 0.0015 — a pattern no radial term can take.

The arrows turn with position: they point one way near the wedge’s thick edge and the other near its thin edge, and round the sides in between. A radial coefficient can only push every point straight out or straight in, and so it takes almost nothing. The decentring terms push points in directions that turn with position, which is why they take so much. The thin-prism terms push every point the same way, harder with distance from the centre — which is the part of the swirl that remains once the rotation has taken the wedge’s uniform deviation, and why near the axis they take nearly all of it.

The difference between a plumb-line calibration and this one is worth noting. The lines that calibrate a lens fits distortion from straight edges alone, and a straight edge is bent by a wedge in a way no radial coefficient describes either; a plumb-line fit through glass would face the same choice of terms, and the same temptation to accept whichever makes the lines straight. A barrel model folds at a radius it sets itself is the reminder that every distortion model is a polynomial with a range, and a polynomial asked to describe something it was not written for describes it well only near where it was fitted.

The residual that announced the glass goes quiet

The earlier essay’s comfort was that the glass announced itself: the residual a calibration leaves at its own readings is the only evidence a calibration has, and a radial calibration through a wedge leaves a swirl there that no reading error explains. More terms take that evidence away.

Marks read to 0.4 px hide the glass from a radial calibration inside 22° of the axis — and inside 41° once decentring terms are allowed, 46° with thin-prism termsThe residual a glass-blind calibration leaves at its own readings — the only residual it can see — against how far off the axis the reading reaches, with the level line at 0.4 px, what a reading's own error leaves. A radial calibration's residual passes that level at about 22°: a reading that reaches further sees the glass announced. With decentring terms the residual stays under it to about 41°, and with thin-prism terms to about 46°. The extra terms do not remove the glass; they hide it, by absorbing its first-order part into a lens that does not exist.0.010.111020304050how far off the axis the reading reaches, degreesresidual at the readings, px (log)a reading's own error, 0.4 pxradial onlywith decentring termswith thin-prism termsa 2° wedge; residual at the calibration's own readingsmore terms, quieter glass
Fig. 4 The residual at the calibration’s own readings against the reading’s reach, with a level line at 0.4 px — a reading’s own error. A radial calibration’s residual passes it at about 22°; with decentring terms at about 41°; with thin-prism terms at about 46°.

A calibration can only see its residual at its own readings. With marks read to 0.4 pixels, a residual smaller than that is indistinguishable from reading error. The radial calibration’s residual passes 0.4 pixels at about twenty-two degrees off the axis: a reading that reaches further sees the glass announced, and one confined inside that reach does not. With the decentring terms free, the residual stays under 0.4 pixels until about forty-one degrees. With thin-prism terms, until about forty-six.

So the extra terms do not remove the glass. They hide it. The glass is still bending every ray exactly as much as it did; what has changed is that the calibration now has a place to put the bending that is not the residual, and the residual was the only place a reader of the calibration could have seen it. A report of a clean fit is a report about the model’s freedom as much as about the camera. A calibration whose readings reach thirty degrees off the axis — most of the frame of a normal lens — reports a clean fit when it carries decentring terms, and a swirling one when it does not. The standard model, with the standard terms, is the one that makes the glass invisible over the widest range. That is the worst outcome of the three the earlier essay anticipated, and it is the one that happens.

What the calibration says about the camera

The third question was whether the terms a glass-blind calibration reports look like a defective lens. They look like a very defective one.

Decentring terms move the principal point further, not less — 13.9 px at 25° against 5.2 — and report a lens decentred by 1.1e-2 to 1.4e-2What a glass-blind calibration of a camera behind a 2° wedge reports about the camera, with exact readings. The principal point, moved by 4.5 px, 4.6 px, 5.2 px, 6.1 px, 7.7 px, 10.5 px, 14.4 px radial only at 10, 18, 25, 32, 40, 48, 55°; 11.6 px, 13.7 px, 13.9 px, 13.0 px, 10.5 px, 5.8 px, 1.4 px with decentring terms; 0.5 px, 1.0 px, 2.0 px, 3.5 px, 6.2 px, 10.7 px, 17.1 px with thin-prism terms. The decentring terms themselves come out at a magnitude of 1.1e-2, 1.2e-2, 1.3e-2, 1.4e-2, 1.4e-2, 1.3e-2, 1.3e-2, and the thin-prism terms at 1.5e-2, 1.5e-2, 1.5e-2, 1.5e-2, 1.5e-2, 1.4e-2, 1.4e-2 — nearly constant with reach, because they are describing one fixed thing, the glass, as a property of a lens. The lens in the model has no distortion at all.0510151020304050how far off the axis the reading reaches, degreeshow far the calibration moves the principal point (px)radial onlywith decentring termswith thin-prism termsa 2° wedge, exact readingsthe blame, reassigned
Fig. 5 What each glass-blind calibration reports. The principal point moved by 4.5 to 14.4 px radial only; 11.6 to 13.9 px with decentring terms out to 32°, falling to 1.4 px at 55°; 0.5 to 17.1 px with thin-prism terms. The decentring terms come out at a magnitude of 1.1e-2 to 1.4e-2, the thin-prism terms at 1.4e-2 to 1.5e-2, nearly constant with reach.

The decentring terms come out at a combined magnitude of 0.011 to 0.014, nearly the same at every reach, because they are describing one fixed thing — the glass — as a property of the lens. Calibrations of assembled lenses commonly report decentring terms of a thousandth or less; a value ten times that is the signature of an element badly off its axis, and the camera here has a lens with no distortion at all. The calibration has not found a defect; it has invented one, and attributed the glass to it.

The principal point, which the earlier essay found was the radial calibration’s scapegoat, does not move less. With decentring terms it moves further — 11.6 to 13.9 pixels out to thirty-two degrees, against 4.5 to 6.1 for the radial calibration — because the decentring pattern and a shift of the centre are partly the same motion, and the fit trades between them. Only at the widest reach, where the decentring terms have more of the field to fit, does the principal point settle nearer its true place. The thin-prism terms do better near the axis, where they leave the principal point within half a pixel of the truth at ten degrees, and worse far out, where they move it seventeen pixels at fifty-five.

The thin-prism terms report a combined magnitude of about 0.015, constant with reach. That is at least a true description. A thin prism is what a two-degree wedge in front of a lens is, to first order, and a calibration that reports a thin prism has reported the glass — as part of the lens, where it is not, but as the right kind of thing.

The prism the glass is

The thin-prism calibration’s residual field shows what is left when the right kind of term is used.

Through a 2° wedge, a calibration with thin-prism terms leaves 0.41 px across the disc against 1.88 px radial onlyThe camera behind a 2° wedge, its lens free of distortion, read on two rings 40° and 20° off the axis and fitted by a calibration that knows nothing of the glass: rotation, focal length, principal point and a radial coefficient, and thin-prism terms. The arrows are the difference between where the glass puts each direction and where the calibration puts it, over the whole disc the readings span, magnified 40 times: 0.407 px root-mean-square and 0.74 px at worst, against 1.883 and 3.44 for the radial model alone. The calibration reports a principal point moved 6.24 px, a radial coefficient of 0.00052, and thin prism -6.1e-3 and 1.3e-2.with thin-prism terms · residual × 40 · rms 0.41 px over the discno single viewpoint — the rays miss by a wedge's worth, varying with incidencethin prism -6.1e-3 and 1.3e-2
Fig. 6 The same camera and wedge calibrated with thin-prism terms instead of decentring: 0.41 px RMS across the disc at 40°, the principal point moved 6.24 px, and thin-prism terms of about 1.5e-2 — the glass reported as a prism in the lens.

At forty degrees off the axis the thin-prism calibration still leaves 0.41 pixels across the disc, and the field is no longer the earlier swirl. Near the axis every arrow points the same way — a uniform offset of about 0.3 pixels, which the fit has traded between the principal point and the rotation — and between the two rings of readings the arrows turn with position again, reaching 0.72 pixels at thirty degrees off the axis, where no reading constrains them. The readings themselves sit where the residual is smallest, which is what a fit does and why the residual at the readings understates the residual everywhere else. Its reported thin-prism terms, about 0.015, are the wedge’s deflection written in the lens’s coordinates.

That is a strange kind of success. The calibration’s report is true of the image and false of the camera. Any use of the calibration that keeps the glass where it was — a camera in a fixed housing, looking through the same port for its whole life — is served perfectly well by a lens model that contains the glass. Any use that moves the glass, or reasons about the lens alone, is served by a calibration that is wrong in a way its residual will never show.

Why the blame moves as it does

The earlier essay found a principle worth restating: a calibration assigns a disturbance to whichever of its parameters describes the disturbance’s pattern best, and it has no way to know that the disturbance is outside the camera. A rotation takes the wedge’s uniform deviation; a principal-point shift takes some of its field-dependent part; a radial coefficient takes almost none of it, because the wedge’s pattern is not radial.

Adding parameters adds candidates for the blame. The decentring terms share part of their pattern with a principal-point shift, so adding them does not relieve the principal point — it gives the fit two partly interchangeable ways to describe the same displacement, and the solution moves along the direction they share. The thin-prism terms share less with the principal point near the axis, where their pattern is nearly the wedge’s own, and so they take the wedge’s part directly and leave the centre alone.

This is the same finding a pane gives a product before it gives two numbers made for a flat pane of glass, in a different quantity: what a picture determines is a combination of parameters, and a model with more parameters than the picture determines distributes the combination among them by the accident of their shapes. What survives a pane of glass is the reassuring limit — a pane with parallel faces moves no direction at all, so a calibration through it is the camera’s own — and a wedge is where that reassurance ends.

What a calibration through glass should do

The practical conclusions are three, and they pull against each other.

A calibration through glass should not carry decentring terms unless it has reason to. They take the glass’s swirl, invent a defective lens, and move the principal point further; the clean residual they leave is the least trustworthy outcome of all, because it removes the only warning. A calibration that is going to be used behind a display case, a housing port or a windscreen is better done with the radial model alone and a reach wide enough for the residual to speak.

If it carries extra terms, thin-prism terms are the honest ones. They describe what a tilted plate of glass does, they take nearly all of a thin wedge’s effect near the axis, and the magnitude they report is a direct statement that something prism-like is in the path.

And if the glass can be modelled, it should be. A wedge of glass turns the camera behind it found that a camera recovered through a wedge is turned three times too far with nothing left over to say so; the wedge admitted into the model recovers both the camera and the glass. Any calibration model that absorbs the wedge into the lens is a model that will be wrong the moment the glass is moved and the lens is not.

What was assumed

The lens has no distortion. Every term a calibration reports here is the glass’s. A real lens with its own radial and decentring distortion adds its terms to the glass’s, and a calibration through glass then reports the sum; the glass’s share is identifiable only by moving the glass.

The readings are exact. With reading error, every model’s residual has a floor, and the reaches at which the glass is announced move out further; the figure on quiet residuals uses the reading error only as a threshold, not as noise in the fit.

Two rings of six readings. A calibration from a dense chessboard fills the frame and constrains every model much more, which leaves each set of terms less freedom to trade with the principal point — and more readings far off the axis, where no model takes the wedge.

Still open: whether moving the glass separates it from the lens

The first assumption names the one test that can tell the glass’s terms from a real lens’s: move the glass. A calibration done twice, with the wedge turned between the two by a known angle about the camera’s axis, sees the lens’s terms stay where they are and the glass’s terms turn with it.

The measurement that settles what that is worth calibrates a camera whose lens has a stated radial and decentring distortion, behind a two-degree wedge, twice — the second time with the wedge turned by a stated angle — with the same glass-blind model and 0.4-pixel reading error, and asks whether the difference between the two calibrations recovers the glass’s terms and the lens’s separately, and how small a turn is enough. If a turn of a few tens of degrees separates them to the precision a calibration needs, a camera behind a window can be calibrated without modelling the window at all, by rotating it; if it needs a half turn, the window has to be modelled or removed.

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.

Brown–ConradyCamera calibrationIdentifiabilityModel errorPrincipal pointRadial distortionRefractive indexResidual