Through water and glass

A water surface's height trades against its index

Three eyes that must find the water's surface as well as its index find the two along a valley: a surface assumed higher bends every ray sooner, and an index assumed weaker makes up for it. From one stick at a quarter pixel the index is known to ±0.14 and the surface to ±48 mm, and the fits do worse than that promises — they slide down the valley, and the metre-long stick comes back 881 mm. A second stick eight metres out narrows the valley to ±7.6 mm. Holding water's own index at 1.333 closes it: the surface to ±23 mm, the stick to 994.

Worth reading first: What a ray does at a surface · Two rays that do not meet.

A third eye sees the water the pair cannot put a camera ten centimetres above a level stereo pair looking at a stick half under water, and found that the three rays to each point, read as if in air, disagree by pixels where the pair’s two agreed exactly. Told that there is a flat surface where the water is, and asked for the index, the three eyes found 1.333 — the index of water — and put the metre-long stick back at a thousand millimetres; read to a quarter of a pixel, the index came back as 1.336 ± 0.059.

That fit was given the surface. A rig looking into a tank can see the surface’s rim and place it; one looking into a pond, or at a river bed through moving water, has to find the surface from the same pictures it is trying to correct. The essay ended by pointing out that raising the surface and weakening the index do similar things to a ray — both change where a bent ray goes as it deepens — and asking whether three eyes, which see the stick at several angles through the surface, can tell them apart.

They can, in principle, and badly in practice.

The valley the two lie in

The rig is the earlier essay’s, and the bending at the surface is the one what a ray does at a surface set out: a level pair 65 millimetres apart 1.6 metres above the water, a third eye raised a hundred millimetres above their middle, a metre-long stick leaning thirty degrees under the surface two metres out, eight points along it. Each eye’s reading of each point is a direction in air. Read with an assumed surface height and an assumed index, every direction becomes a ray that meets the surface at that height and bends there by that index; the three bent rays to each point are brought as close together as they will go — where exactly is the choice the midpoint is a choice of ruler examined, made here by angle at each eye — and how far each misses, as an angle at its eye, is the disagreement. At the true surface and the true index, with exact readings, the disagreement is exactly nothing.

With one stick the three eyes' disagreement lies in a valley running from a low index and a high surface to a high index and a low one; at a quarter pixel the index is known to ±0.143 and the height to ±48 mmThe root-mean-square disagreement of three eyes — a level pair 65 mm apart and a third raised 100 mm — looking at a stick 2 m out, a metre of each under water leaning 30°, eight points on each, every ray read as bending at a flat surface of an assumed height with an assumed index; darker is smaller. The true index 1.333 and height 0 are where it is exactly zero. The dark valley is where the two trade: a surface assumed higher bends the rays sooner and is matched by an index assumed lower. The ellipse is one standard deviation of the fitted pair at a quarter pixel of reading error: the index ±0.143, the height ±48.0 mm, correlated -0.85. Told the height, the same readings give the index to ±0.075; told the index, the height to ±25.2 mm. The slider adds sticks further out.-0.10000.1001.201.301.401.50the index the rays are read withthe surface's height they are read with (m)the valley floorwater, at the surface±1σ: 0.143, 48 mmthree eyes, 8 points a stick, a quarter pixeldarker: the rays agree better
Fig. 1 The three eyes’ disagreement over assumed indices from 1.2 to 1.5 and surface heights ±12 cm; darker is smaller. Exactly zero at water and the true surface, and small along a valley from a weak index and a high surface to a strong index and a low one. The ellipse: one standard deviation at a quarter pixel, ±0.143 and ±48 mm, correlated −0.85. The slider adds sticks 4 and 6 m out.

The disagreement is zero at one place and small along a line through it. A surface assumed higher than it is meets every ray sooner, so the rays turn downward sooner; an index assumed weaker turns them less; and for points under the surface a moderate distance away the two changes nearly cancel. The dashed curve marks the floor of the valley, and it runs from an index of 1.2 with the surface ten centimetres high to an index of 1.5 with it several centimetres low.

The ellipse is what a quarter of a pixel of reading error makes of that. Linearised at the truth, the fit’s own curvature says the index is known to ±0.143 and the surface’s height to ±48 millimetres, and the two are correlated at −0.85: the ellipse is long and lies in the valley. The same readings, told the surface, give the index to ±0.075, which is consistent with the earlier essay’s ±0.059 from twelve points; told the index, they give the surface to ±25 millimetres. Freeing the second unknown costs each of them about a factor of two, and it costs it along one particular line.

Why the valley exists

The trade is the geometry of a flat surface, and it has the same shape as the one a pair of eyes met in air at the start of this sequence. A point under water has two depths found that the rays from a submerged point to an eye pass through the surface at a point whose depth below it scales the image, and the scaling depends on how steeply the ray arrives: a steep ray’s image is lifted by about one over the index, a shallow ray’s by less. Raising the surface lifts every point’s crossing by the same amount; weakening the index lifts steep and shallow rays by different amounts. For the two to be told apart the rig has to see the water at angles that differ enough for their different lifts to show.

Three eyes a hundred millimetres apart, two metres from a stick, see each point at nearly one angle, the angle a straight stick in water is a kink and a curve found shaping the whole of the stick’s image. That is what makes the ellipse long. The directions from which the eyes see the stick differ by a few degrees at most, and the only spread of angles in the whole reading comes from the stick’s own depth — its tip seen more steeply than its top — which is a spread of angles in one plane over a metre of stick. The remedy the earlier essay proposed was a second stick at a different distance, seen through the surface at a different angle.

A second stick, further out

A second stick 2.5 m out barely helps the height (±27 mm); one 8 m out brings it to ±7.6 mm, against ±48 from the first stick aloneThe first stick 2 m out and a second one a stated distance out and 0.6 m to the side, a metre of each under water, eight points on each, three eyes, a quarter pixel of reading error: the spread of the surface height fitted together with the index, from the fit's curvature. Second stick at 1, 1.5, 2.5, 3, 4, 5, 6, 8 m: 42.4, 38.2, 27.2, 22.3, 15.4, 11.6, 9.5, 7.6 mm; the index's spread 0.115, 0.105, 0.096, 0.093, 0.089, 0.086, 0.084, 0.080; their correlation -0.84, -0.85, -0.84, -0.82, -0.75, -0.66, -0.57, -0.42. The first stick alone: ±48.0 mm, ±0.143, -0.85 (the dashed line). A stick at another distance is seen through the surface at another angle, and the index bends a steep ray and a shallow one by different shares while the height moves both the same distance; the further apart the two angles, the better the two are told apart.11.52.54685102050how far out the second stick stands, metres (log scale)the surface height's spread, mm (log scale)one stickwith a secondthree eyes, a quarter pixelthe angle the second is seen at
Fig. 2 The first stick 2 m out and a second at 1 to 8 m, 0.6 m to the side: the surface’s spread from the fit’s curvature at a quarter pixel. 42 mm with the second at 1 m, 27 at 2.5 m, 15 at 4 m, 9.5 at 6 m, 7.6 at 8 m, against 48 from the first alone (dashed). The correlation falls from −0.85 to −0.42.

The second stick helps in proportion to how differently it is seen. Standing a metre out, where it is seen more steeply than the first, it brings the surface’s spread from 48 millimetres to 42; at two and a half metres, just beyond the first, to 27; at four metres to 15, at six to 9.5 and at eight to 7.6. The correlation between the index and the height falls from −0.85 to −0.42, so the ellipse is not only smaller but rounder. The index improves less — from ±0.143 to ±0.080 — because each stick’s points still see it through a narrow range of angles; what the second stick adds is a second slope of the valley.

The reason is the one the previous section gave. A stick eight metres out is seen through the surface at a grazing angle, about eleven degrees above it from a 1.6-metre eye, where the index bends a ray far more than it does the first stick’s steeper rays. A surface assumed too high then moves the two sticks’ images in proportions no single index can reproduce. More sticks at other distances continue the effect: with sticks at two, four and six metres the linearised spread of the surface is ±8.5 millimetres.

What the fits actually do

The ellipses are what a linear model of the fit promises. The fit itself is not linear, and the valley is curved, and the difference shows as soon as the readings carry real error.

Read to a quarter pixel, the fits do not scatter about the truth but slide down the valley: from one stick the index averages 1.257 and the surface 69 mm high; from two, 1.191 and 50 mmThe index and the surface height fitted together from 40 rigs, every direction misread by a Gaussian quarter pixel of a 900 px camera, three eyes, eight points a stick. One stick 2 m out (dark): index 1.257 ± 0.127, height 68.5 ± 86.9 mm. A second stick 4 m out as well (light): 1.191 ± 0.069, 50.2 ± 34.7 mm. The ellipses are two standard deviations about the truth from the fit's own curvature, which promises ±0.143 and ±48 mm for one stick and ±0.089 and ±15 mm for two. The clouds lie along the valley, and mostly on the side of a weaker index and a higher surface: the valley curves, and noise pushes a fit down the side where the curve is gentler.00.2000.4001.201.401.60the fitted indexthe fitted surface height (m)the truthone stick (dark)two sticks (light)40 rigs a cloud, a quarter pixelellipses: 2σ from the curvature
Fig. 3 Forty rigs each read to a quarter pixel, the index and the height fitted together. One stick (dark): index 1.257 ± 0.127, surface 69 ± 87 mm. Two sticks (light): 1.191 ± 0.069, 50 ± 35 mm. The ellipses are two standard deviations about the truth from the fit’s curvature. The clouds lie along the valley and mostly on the weak-index side.

The forty fits from one stick do not scatter about the truth. They lie along the valley, and mostly on one side of it: the index averages 1.257, well below water’s 1.333, and the surface averages 69 millimetres above where it is. The spread is about what the ellipse promised — ±0.127 in index — but the cloud’s centre has slid a large part of that distance down the valley. With a second stick four metres out the spread of the surface falls to ±35 millimetres, as the second stick promised, and the slide does not go away: the index averages 1.191 and the surface 50 millimetres high.

The index comes back low by 37 to 53 per cent of the spread its own fit promises, at every reading error from 0.05 to 0.25 pxOne stick 2 m out, three eyes, the index and the surface fitted together, 40 rigs at each reading error of 0.05, 0.1, 0.15, 0.2, 0.25 px. The mean amount by which the index comes back low: 0.0107, 0.0243, 0.0404, 0.0583, 0.0759; the spread the fit's curvature promises: 0.0286, 0.0572, 0.0858, 0.1145, 0.1431; the surface's mean height 4.1, 11.4, 22.6, 39.9, 68.5 mm. The slide grows with the noise a little faster than the spread does, so it is never negligible beside it: a fit that reports its curvature as its uncertainty is always a third to a half of an uncertainty off to one side, and always the same side. At 0.3 px one rig in forty runs off down the valley altogether, to an index of 159.0.050.10.150.20.250.010.020.050.1reading error, px (log scale)how far the index is off (log scale)the slide (mean error)the promised spreadone stick, 40 rigs a pointa curved valley
Fig. 4 One stick, both fitted, 40 rigs at each reading error from 0.05 to 0.25 px: the mean amount the index comes back low (solid) against the spread the fit’s curvature promises (dashed). The slide is 0.011 at 0.05 px and 0.076 at 0.25, between 37 and 53 per cent of the promised spread; the surface averages 4 mm high at 0.05 px and 69 at 0.25.

The slide is not a feature of a quarter of a pixel. At every reading error from a twentieth of a pixel to a quarter, the index comes back low by between 37 and 53 per cent of the spread the fit reports for itself, and the surface high by a matching amount — four millimetres at a twentieth of a pixel, sixty-nine at a quarter. It grows with the reading error a little faster than the spread does. A fit that quotes its curvature as its uncertainty is therefore always between a third and a half of an uncertainty off, and always on the same side — the shape of failure the residual does not warn met in the pair, where a confident fit reported nothing of its own bias; at 0.3 pixels one rig in forty runs off down the valley altogether and reports an index of 159.

The cause is the valley’s curvature. Noise moves each fit off the truth in a random direction, the fit then settles on the valley’s floor, and a curved floor is closer, on average, on its gentler side. The shape of that bias could be computed and subtracted — it is a property of the rig and the scene, not of the readings — but a reader who does not know it is there, and takes the fit’s reported uncertainty at face value, is wrong in a consistent direction.

What a better matcher buys

A quarter of a pixel is a careful reading of a well-lit edge. A good matcher on a textured stick does better, and the question is whether the slide is a problem only for rough readings.

It is not, though it shrinks. At a tenth of a pixel the one-stick rig’s index is promised to ±0.057, and it comes back 0.024 low on average, with the surface 11 millimetres high; at a twentieth of a pixel, ±0.029 promised and 0.011 low, the surface 4 millimetres high. The slide falls with the reading error, as every error does, but it falls no faster than the spread, so it stays at a third to a half of it. A rig five times more precise than this one has a slide about seven times smaller and a spread five times smaller, and is still more than a third of its own uncertainty off.

That is the property worth remembering. An error that scales with the spread is not rescued by precision: it can only be removed by changing the estimate — subtracting the slide, which a simulation of the rig can compute, or fitting fewer nuisance numbers, or holding one of the two unknowns from outside.

What the slide costs a length

The quantity the rig was built for is the stick, and the valley’s slide reaches it directly: a surface fitted too high with an index fitted too weak puts every point too shallow, and the stick comes back short.

The first stick's metre comes back 881 ± 182 mm with both fitted, 994 ± 85 with water's index held, and 988 ± 129 with the surface heldThe length of the metre-long stick 2 m out, rebuilt from three eyes read to a quarter pixel, 40 rigs a row; each bar is the length's error from a metre plus its spread, labelled with its mean. One stick, both fitted: 881 ± 182 mm, the surface at 68.5 ± 86.9 mm; One stick, index known: 994 ± 85 mm, the surface at 7.8 ± 23.0 mm; One stick, surface known: 988 ± 129 mm, the surface at 0.0 ± 0.0 mm; Two sticks, both fitted: 792 ± 117 mm, the surface at 50.2 ± 34.7 mm; Two sticks, index known: 994 ± 85 mm, the surface at 7.2 ± 17.4 mm; Two sticks, surface known: 925 ± 145 mm, the surface at 0.0 ± 0.0 mm. Holding the index at water's 1.333 leaves the height free and costs almost nothing; freeing both slides the fit along the valley, and the stick comes back short by the slide.one stick, both fitted881 mmone stick, index known994 mmone stick, surface known988 mmtwo sticks, both fitted792 mmtwo sticks, index known994 mmtwo sticks, surface known925 mm40 rigs a row, a quarter pixelbar: error from a metre plus spread
Fig. 5 The metre-long stick 2 m out rebuilt from 40 rigs at a quarter pixel. One stick: 881 ± 182 mm with both fitted, 994 ± 85 with water’s index held, 988 ± 129 with the surface held. With a second stick 4 m out: 792 ± 117, 994 ± 85 and 925 ± 145.

With both the index and the surface fitted from the stick itself, the metre comes back 881 ± 182 millimetres — short in the way a miss-weighted fit trusts the surface found a fit short when it leaned on the wrong part of the stick: short by the slide and scattered by more than the earlier essay’s surface-known rig. Adding the second stick shrinks the scatter to ±117 and deepens the shortfall, to 792: the second stick’s shallow rays pull the index weaker still, which matters to the first stick’s length. The surface-known rig of the earlier essay, reading eight points instead of twelve, gives 988 ± 129 from one stick; with the second stick added it too is pulled short, to 925 — the grazing rays bias the index even when the surface is given, which the linear figures did not show and which was not derived here.

Holding the index at water’s 1.333 and fitting only the surface is better than all of them: 994 ± 85 millimetres, with the surface placed at 8 ± 23 millimetres from one stick and 7 ± 17 from two. That is the practical answer for water. The index of clear fresh water is known to the third decimal from its temperature, and a rig that trusts it has one unknown, the surface, which three eyes place to a couple of centimetres, and a stick that comes back to within a centimetre of its length on average.

When the index is the unknown

The trade matters when the liquid is not water — a brine of unknown strength, an oil, a syrup, a tank of some reagent — or when the surface carries a film, or the rig is calibrated for air and does not know what it is looking into. Then the index is a real unknown and so, unless its rim can be seen, is the surface.

For that case the measurements give a procedure and a warning. The procedure: see the liquid at as wide a range of angles as possible, which in practice means objects at very different distances — a stick near the rig and one far across the pool, seen almost edge-on through the surface — since that is what separates a raised surface from a weaker index. The warning: even then the fit slides, and the slide is a third to a half of the reported uncertainty in the direction of a weaker index and a higher surface. A length rebuilt from such a fit is short, and the shortfall should be expected rather than discovered.

The stick a stereo pair puts back found the level pair’s error systematic: 285 millimetres short, with no scatter, and no way for more readings of the same kind to reveal it. The earlier essay traded that for a random error by adding a third eye and a known surface. Freeing the surface brings a systematic error back, smaller and of a different kind — not the geometry’s blindness but the estimator’s curvature — and it can be removed, by the same move that removed the first: bring in what is known from outside the pictures.

What a rig should report

The measurements suggest a form for the answer that is more useful than a pair of numbers. What three eyes actually determine from one stick is a line — the valley — along which the index and the surface’s height may lie, and a short distance along it. Reported as a point with an ellipse, that answer invites a reader to trust the point; reported as the valley, it invites the reader to bring in whatever fixes a position along it.

For water, the index fixes it. For a tank with a visible rim, the rim fixes the height. For a pool whose far edge is in the picture, a second object seen at a grazing angle narrows it. Each of these is outside information that the pictures alone do not carry, and each moves the answer from the valley’s floor to one place on it. A rig that reports the valley — its direction, the correlation of the two unknowns along it, and where on it the fit settled — leaves that choice to the reader who has the outside information, instead of making it silently and a third of an uncertainty off.

What was assumed

The surface is flat and level. A real pond’s surface ripples, and a river’s slopes and moves. The fit here has one height for the whole surface; a surface that varies across the pictures adds a height per place, and the valley then has as many dimensions as there are places.

The eyes know where they are. The rig’s own geometry is exact. A rig that recovers its cameras from the same pictures adds the cameras’ poses to the unknowns, and an uncertainty is quoted from something found that a height measured from a rig carries the rig’s own uncertainty with it; the camera heights and the surface’s height would trade too.

The sticks are straight and their points known to lie on them. Each point is triangulated on its own here; a fit that also knew the points lie on a straight line would have far fewer nuisance numbers, and would likely slide less.

Reading errors are independent and the same size for every ray. A ray arriving at a grazing angle through the surface is imaged through a thin sliver of water and is harder to read than a steep one. Weighting the far stick’s readings down would reduce its pull on the index, and with it the bias it introduces.

Still open: whether knowing the points lie on a line stops the slide

The fits here triangulate every point on its own, so each of the sixteen points carries three numbers of its own for the fit to adjust, against two numbers — the index and the height — that all of them share. That is the shape of estimation problem in which the shared numbers are known to be pulled off by the nuisance ones, and the slide measured above is consistent with it; that it is the cause was not shown here.

The measurement that settles it fits the same readings with each stick constrained to be a straight line — five numbers a stick instead of three a point — and asks whether the index still comes back low by a third to a half of its spread. If the slide disappears, it was the nuisance numbers’, and any rig whose objects have known shapes should fit the shapes rather than the points. If it stays, it belongs to the refraction itself, and the only cure is the one this essay found for water: know one of the two.

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.

instrument limitleast squaresMultiviewRefractionRefractive indexReprojection errorTriangulation