The real instrument

A lens's curve is known where its coefficients are not

Two radial coefficients correlated at −0.993 sound like a calibration that failed. Read as the displacement they make, the same fit knows the curve to a quarter of a pixel at the edge of the picture, ten times better than independent coefficients would. The ellipse of their errors lies almost along the line that leaves the curve unchanged, and the poses that sharpened the first coefficient most are not the ones that sharpen the curve.

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

A closer pose sharpens one coefficient and not the pair pooled photographs of a ring target, tilted four ways and taken at several distances, and asked whether any arrangement of poses separates a lens’s two radial coefficients. None did. Their correlation stayed between −0.97 and −0.99 through every pool, a target further off added nothing, and a target brought closer sharpened the first coefficient by about half and pushed the pair closer together. The essay ended by turning the question round. Practice does not want the two coefficients. It wants the curve they make, the distance the lens moves a point at each radius, and a pair of coefficients that cannot be told apart might still make a curve that is very well known.

That was a guess about what a correlation near minus one means. It can be measured. The same fits that gave each coefficient’s scatter give the full covariance of the pair, and the displacement at any radius is a fixed linear combination of the two, so its scatter follows exactly. The question is how good the curve is, where in the picture it is best and worst known, and whether the distinctions between pools that mattered for the first coefficient matter for the curve at all.

The curve is a combination of the two

The lens model moves a point at radius rr from the distortion centre, with ρ=r/f\rho = r/f its radius in units of the focal length, outward by

δ(r)=r (k1ρ2+k2ρ4).\delta(r) = r\,(k_1\rho^2 + k_2\rho^4).

For the lens in these essays, k1=−0.28k_1 = -0.28 and k2=0k_2 = 0 on a camera with a focal length of 426 px, so the displacement is inward, a barrel. A fitted pair of coefficients is wrong by some errors e1e_1 and e2e_2, and the fitted curve is then wrong at each radius by r(ρ2e1+ρ4e2)r(\rho^2 e_1 + \rho^4 e_2). Its variance is a weighted sum of the two coefficients’ variances and their covariance,

σδ2=r2(ρ4C11+2ρ6C12+ρ8C22),\sigma_\delta^2 = r^2\left(\rho^4 C_{11} + 2\rho^6 C_{12} + \rho^8 C_{22}\right),

and the middle term is negative when the coefficients are anticorrelated. With a correlation of −0.993 it nearly cancels the other two. Where the two errors are tied so that e2≈−e1/ρ02e_2 \approx -e_1/\rho_0^2, they cancel exactly at the radius ρ0\rho_0, a node, and nearly cancel everywhere near it.

A quarter of a pixel at the edge

One photograph of the target square on to the lens, its marks read to half a pixel, gives the coefficients a correlation of −0.993 and the first a scatter of 4.77 thousandths. That is the worst calibration in the earlier comparison, and the one whose coefficients look most hopeless.

A square-on target knows the curve ten times better than its coefficients suggestOne photograph of a ring target square on, read to half a pixel: the scatter of the displacement the fitted lens makes at each radius (solid), against the scatter the two coefficients would give if their errors were independent (dashed), and against what the first coefficient's scatter alone puts there (dotted). At 300 px from the centre, just inside the 310 px the lens can reach, where it has moved a point inward by 95.3 px, the curve is known to 0.24 px; independent errors in the two coefficients would say 2.40 px, and k₁'s own scatter of 4.77 thousandths would say 1.62 px. At 200 px they are 0.179 and 0.263 px. The marks reach 288 px (shaded). The radius is the drawn one, where a reader would measure it.0.010.030.10.313100200300radius in the picture (px)scatter of the displacement (px)the curveindependentk₁ aloneone pose, square on, 0.5 px300 px: 0.24 px
Fig. 1 One photograph of the ring target square on, read to half a pixel: the scatter of the fitted lens’s displacement against the radius in the picture (solid), the scatter if the two coefficients’ errors were independent (dashed), and what the first coefficient’s scatter alone puts there (dotted). The vertical axis is logarithmic; the shaded band is where the marks are.

At 300 px from the centre, just inside the 310 px the lens can reach at all, it has moved a point inward by 95 px, and the fitted curve says where to within 0.24 px. If the two coefficients’ errors were independent, their scatters alone would put 2.40 px there, and the first coefficient’s scatter by itself, read as though it were the whole story, would put 1.62 px. The curve is known ten times better than its coefficients would suggest, and nearly seven times better than the number most calibration reports quote.

The figure’s other feature is that the scatter does not simply grow outward. It rises from nothing at the centre, where the lens moves nothing, to 0.27 px at about 250 px, and then falls, to 0.17 px at 295 px, before rising sharply at the last few pixels. The dip is the node, and the sharp rise beyond it is the fold a barrel model folds at a radius it sets itself found: near 310 px a small change in the drawn radius is a large change in the undistorted one, and the curve’s scatter is read at the undistorted radius.

The ellipse lies along the curve

The node has a picture. The two coefficients’ errors, drawn as an ellipse, and the set of errors that leave the curve unchanged at one radius, drawn as a line, show it directly.

The coefficients' error ellipse, and the errors that leave the curve still at 200 pxThe error ellipse of the two radial coefficients from one square-on photograph, at two standard deviations, in thousandths: it is 9.5 across in k₁ and 12.0 in k₂, and nearly a line, the correlation being -0.993. The straight line holds every pair of errors that leaves the displacement at 200 px unchanged; the ellipse's width across that line is the curve's scatter there, 0.179 px. The line lies along the ellipse at 295 px in the picture, the node, where the two errors cancel.error in k₂ (thousandths)error in k₁radius 200 pxcurve to 0.179 pxnode at 295 pxone pose, square ontwo standard deviations
Fig. 2 The error ellipse of the two radial coefficients from one square-on photograph, at two standard deviations, in thousandths, with the line of errors that leave the displacement unchanged at the stated radius (dashed). The slider moves the radius from 100 px to 300 px.

The ellipse is 9.5 thousandths across in k1k_1 and 12 in k2k_2, which is what the coefficients’ scatters say, and almost no width at all in the direction across its length. The dashed line holds every pair of errors that leaves the displacement at the chosen radius exactly where the true lens has it. Where that line lies along the ellipse, the fit’s errors are almost all errors that do not change the curve there, and the curve is known almost perfectly; where it crosses the ellipse, the errors move the curve, and the ellipse’s width across the line is the curve’s scatter.

Dragging the slider turns the line. At 100 px it crosses the ellipse steeply, but the ellipse is small in that direction and the displacement there is tiny anyway, so the curve’s scatter is 0.026 px. At 200 px it crosses at a shallower angle, 0.18 px. At 295 px it lies along the ellipse’s own axis, and the curve’s scatter there is just the residual the correlation leaves, 0.17 px. The ellipse is not a failure to measure two numbers. It is an accurate measurement of one number, the curve near the node, together with an honest statement that the photograph says almost nothing about another, the curve’s shape far from the marks, which nobody asked about.

The node is not chosen by the lens. It sits where the marks are densest in their leverage on the two coefficients, which is near the outer rings of the target, so moving the target moves the node. No design separates the two coefficients found the correlation set by the radii the marks cover; this is the same fact from the other side. The radii the marks cover are the radii where the curve is known.

Every pool reads it to a fraction of a pixel

The pools of the earlier essay can each be read the same way.

Every pool knows the curve to a fraction of a pixel, out to the edge of the image circleThe scatter of the displacement against radius for five pools of photographs of the ring target, read to half a pixel. At 300 px out: one, square on 0.244 px; one, tilted 50° 0.253 px; four tilts 0.149 px; four tilts at two distances 0.147 px; at four, one close 0.084 px. Each curve rises from nothing at the centre and levels off across the outer marks, and the square-on photograph's turns over near the edge, where its two coefficients' errors begin to cancel.00.1000.2000.300100200300radius in the picture (px)scatter of the displacement (px)one, square onone, tilted 50°four tiltsfour tilts at two distancesat four, one closefive pools, 0.5 px300 px, four tilts: 0.15 px
Fig. 3 The scatter of the displacement against the radius in the picture, for five pools of photographs of the ring target, each read to half a pixel.

At 300 px: one photograph square on, 0.244 px; one tilted by 50°, 0.253; four tilts, 0.149; four tilts at two distances, 0.147; four tilts at four distances with one close, 0.084. Every pool knows the whole curve, to the edge of the image circle, to better than a quarter of a pixel, and the best to a twelfth. Each curve has the same shape: nothing at the centre, a rise through the middle of the picture, a plateau across the outer marks.

That settles what the earlier comparison’s wall meant. The coefficients cannot be separated; the curve is known, everywhere the lens can draw, to a precision well inside a single pixel. The wall would matter only to someone who wanted k2k_2 as a number in its own right, to compare lenses, or to hand one coefficient to software that uses a different second term, or to extrapolate the curve past the radii the model is good for. Undistorting a picture needs none of those.

The gains that do not carry over

The pools differed a great deal in the first coefficient. They differ less in the curve, and not in the same order.

The pools' gains in k₁ overstate their gains in the curveHow many times better than one square-on photograph each pool reads k₁ (upper bar) and the curve at its worst radius in the picture (lower bar). one, tilted 50°: 1.46 against 0.98; four tilts: 2.60 against 1.79; four tilts at two distances: 2.71 against 1.86; at four, one close: 4.79 against 3.03. Tilting the one photograph by 50° buys almost half as much again in k₁ and nothing in the curve, whose worst radius it reads slightly worse; the pose added close up buys a real gain in both.one, tilted 50°: k₁1.46×the curve, worst radius0.98×four tilts: k₁2.60×the curve, worst radius1.79×four tilts at two distances: k₁2.71×the curve, worst radius1.86×at four, one close: k₁4.79×the curve, worst radius3.03×against one photograph square on300 px: 0.24 px
Fig. 4 How many times better than one square-on photograph each pool reads the first coefficient (upper bar of each pair) and the curve at its worst radius in the picture (lower bar).

Tilting the single photograph by 50° read the first coefficient 1.46 times better, which a tilted target pays for its tilt in perspective counted as a real gain. It reads the curve 0.98 times as well at its worst radius, slightly worse. The tilt moved the ellipse, mostly along its own length, and that is a direction the curve does not care about. Four tilts read the first coefficient 2.6 times better and the curve 1.8 times better; four tilts at two distances, 2.7 and 1.9; the pool with a close pose, 4.8 and 3.0.

So the pools’ gains in the first coefficient overstate their gains in the curve, by a factor between one and a half and two, and the single tilt’s gain does not carry over at all. The close pose’s gain does, which is the reassuring part: it brings marks to new radii and new leverage, and the curve improves with them. The rule that comes out is the one the earlier essays kept approaching. A pose is worth what it adds to the curve at the radii the pictures will be undistorted at, and the scatter of k1k_1 is a poor proxy for that, because most of what makes it small is a sharpening along the ellipse that changes no displacement.

The centre decides the middle of the picture

The curve is one part of where a fitted lens draws a point. The distortion centre is the other, and its error moves every point by the same amount in the same direction, which matters most where the curve itself matters least.

Near the middle of the frame the centre, not the curve, decides where a point is drawnThe scatter of where the fitted lens draws a point, from the curve alone (dashed) and with the distortion centre's own error added (solid), for three pools. Near the middle the curve's share is nothing and the centre's is all of it: one, square on 0.196 px at 50 px, four tilts 0.070 px at 50 px, at four, one close 0.032 px at 50 px. At 300 px the two are 0.244 and 0.313, 0.149 and 0.165, 0.084 and 0.089.00.1000.2000.300100200300radius in the picture (px)scatter of a drawn point's position (px)one, square onfour tiltsat four, one closesolid: with the centredashed: the curve alone
Fig. 5 The scatter of where the fitted lens draws a point, from the curve alone (dashed) and with the distortion centre’s own error added (solid), for one photograph square on, four tilts, and four distances with one pose close.

Near the middle of the picture the curve contributes nothing and the centre contributes everything: at 50 px from the centre the drawn point’s scatter is 0.196 px from one square-on photograph, 0.070 from four tilts, 0.032 from the pool with a close pose, all of it the centre. At 300 px the curve dominates and the centre adds a little: 0.244 and 0.313 px for one photograph, 0.149 and 0.165 for four tilts. The tilts help the centre far more than they help the curve, since a tilt is what lets the fit tell a shifted centre from a turned target, and that is where four tilts beat one photograph by a factor of nearly three.

So a calibration report that quotes the first coefficient’s scatter is quoting the wrong number twice. The number that says how well the lens is undone at a radius is the curve’s scatter there, and near the middle of the picture it is the centre’s scatter instead, which no coefficient’s standard deviation describes. Both are available from the same covariance the coefficients came from, and neither takes any more measurement to find.

What a calibration should report instead

The measurement suggests a different report, and it costs nothing to produce. A calibration that has fitted two coefficients has their covariance, and from it the scatter of the displacement at any radius, and of the drawn position at any point once the centre’s covariance is included. Three numbers carry nearly all of it: the scatter of the displacement at the outer edge of the region the pictures will be used in, the same at half that radius, and the scatter of the centre. For the square-on photograph those are 0.24 px, 0.08 px and 0.13 px; for four tilts, 0.15, 0.03 and 0.05. Those are numbers a user can compare directly with the half-pixel a reading is worth, and they say at once that either calibration is good enough to undistort a picture to well under a pixel everywhere, and that four tilts are worth taking if the centre matters.

The coefficients’ scatters say none of that. Quoted alone, 4.77 thousandths in k1k_1 on a lens whose k1k_1 is 280 thousandths reads as a 1.7 per cent coefficient error, which sounds respectable; quoted with k2k_2’s, 6.0 thousandths on a coefficient whose true value is zero, it reads as a second term that cannot even be given a sign, which sounds alarming. Neither impression is about the thing being calibrated. The lines that calibrate a lens set out to find which arrangement of lines best fixes a lens; the arrangement it should be judged by is the one that best fixes the curve at the radii in use, and by that test several arrangements the coefficient comparison ranked apart come out nearly level.

A comparison of two lenses is where the coefficients’ habit does real harm. Two copies of one lens design calibrated from different pools can report coefficient pairs that differ by several of their own standard deviations along the ellipse’s long axis, and look like different lenses, while drawing curves that agree to a tenth of a pixel. The test for whether two lenses differ is whether their curves differ by more than the curves’ scatters, at the radii both are used at, and that test is one line of arithmetic from the covariances both calibrations already produced.

Why the curve is well known and the pair is not

The arithmetic has a plain reading. The marks sample the lens’s displacement at a band of radii, and in that band the two functions ρ3\rho^3 and ρ5\rho^5 look very alike; a little more of the first and a little less of the second makes very nearly the same curve across the band. That is why the fit cannot say how much of each there is, and it is also exactly why it does not need to: whatever split it chooses, the curve across the band comes out the same. The response is at the ends and the information is not found the same thing on straight lines, where the lens’s response is largest at the frame’s edge while what the fit learns is spread through the middle.

The two coefficients are a coordinate system for the space of curves, and it happens to be a badly skewed one for this band: its two axes point in nearly the same direction. A correlation of −0.993 is a property of the coordinates, not of what is known. Written in better coordinates, say the displacement at two stated radii, the same fit would report two numbers with modest scatters and a modest correlation, and nobody would think it had failed. Fitting a lens from straightness alone read its result as a curve for this reason; the calibration that reads it as two coefficients makes the result look worse than it is.

A two-term lens, read to half a pixel, with the pose fitted

Every figure here assumes the lens is exactly the two-term model it is fitted with, so that the curve’s only error is the coefficients’ scatter. A real lens has higher terms, and a fit with two terms then has a model error as well, a systematic departure of the fitted curve from the true one that no number of poses removes and no covariance reports. Across the band of radii the marks cover, that error is small because the fit is chosen to be good there; past the marks it is an extrapolation, and the curve’s small scatter there is a statement about the model, not about the lens. Straight lines that are not found that a few tenths of a per cent of displacement bows a long line by pixels, and a third term of that size would be invisible to everything measured here.

The marks are read to half a pixel across the drawn curve, independently, as in a known target sharpens the fit and does not separate it, with no mark past the model’s fold; the scale and tilts of every pose are fitted with the lens. The scatters are first-order, from the Fisher information, which is accurate for errors this small.

Still open: what a third term does to the curve the two terms know

The two-term fit knows its own curve to a quarter of a pixel, which is a statement about precision. Whether that curve is the lens’s is a statement about the model, and it can be tested by giving the true lens a third radial term and fitting it with two.

The measurement that settles it draws the target through a lens with a stated small third coefficient, fits two terms as every essay here has, and asks how far the fitted curve sits from the true one at each radius, against the scatter measured here; whether the error is largest past the outer marks, as an extrapolation would be, or spread through the band the fit was good at; and whether the residual of each fit, the misfit left in the marks themselves, is large enough to say that a third term is needed, before the curve’s quarter of a pixel is believed.

A pair of radial coefficients correlated at −0.993 is an accurate measurement of a curve written in coordinates that cannot separate its parts. The curve is known to a quarter of a pixel at the edge, ten times better than the coefficients suggest, and a pose’s worth is what it adds to that curve, which the scatter of the first coefficient overstates.

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.

Brown–ConradyCamera calibrationConditioningCovarianceIdentifiabilityRadial distortion