The second eye

A sheared rectification reads every wall at once

One constant shift of a rectified pair's principal points can put one depth exactly on a whole-pixel shell and no more. A shift that grows from row to row does what no constant can: shear one picture against the other so the shift climbs by one pixel over a wall's rows, subtract each row's share after the reading, and the rows' average lands on the wall's own disparity to within 1/(2n) of a pixel, at every depth at once — 2.1 cm at ten metres from forty rows, where the shells are 1.72 m apart. Only a shear can do it: a rotation or a difference of vertical scale breaks the shared rows. The price is one slant that the shear leaves undithered, and the gain belongs to a precise matcher; by 0.4 px of matcher error the matcher has dithered the wall itself.

Worth reading first: A point is a line over there · Depth is a reciprocal.

A rectification’s free shift is free only near the pair took the one free number in a rectified pair that moves no ray, the sideways shift of the two pictures’ principal points, and found that it is not free once disparity is read in whole pixels. The shift slides every shell a whole-pixel reading can report, and for a wall ten metres away the difference between the best shift and the worst is 1.71 m. One shift can put one wall exactly on a shell; every other depth is then read by luck. A matcher with half a pixel of error of its own erases the choice and is worse than the worst shift.

It closed on a shift that varies across the picture. If each row of a rectified pair carried a slightly different shift, a wall crossing many rows would sit in a different part of its shell in each, and a plane fitted to all of them would average over the positions, the way the half-pixel matcher averaged over pixels but without the matcher’s spread. The question was whether such a fit reaches the exactness a well-chosen single shift gives one wall, and whether it does so for walls at every depth at once.

The pair throughout is the same one: 65 mm between the eyes, 900 px of focal length, so the product of the two is 58.5 metre-pixels. Every reading is rounded to a whole pixel, and no matcher error is added until the last section.

Which members of the family can vary the shift

The essay that asked the question offered two ways to make the shift vary from row to row: a slight rotation of both rectified pictures about their optical axes, or a slight difference between their vertical scales. Neither works, and the reason is the definition of the thing being kept.

Rectification is a family, not an operation defined a rectified pair by one property: the epipolar line of every point is the same row in both pictures, so that matching is a search along a row. A point is a line over there is why that matters, since the row is where the other picture’s match is known to lie. Rotating both pictures about their optical axes turns every row by the same angle, so the epipolar lines are still parallel to each other and no longer rows. A matcher searching along rows would search across them. A difference of vertical scale is worse: the left picture’s row 400 becomes the right picture’s row 404, so a point and its match are no longer in the same row at all.

What keeps every row a row is anything that leaves the vertical coordinate alone in both pictures, or changes it identically in both. So the two pictures may each be transformed by any map that sends a point to a new horizontal position computed from its old horizontal and vertical positions, with the vertical position untouched. Two members of that freedom vary the shift. A horizontal shear of one picture against the other moves each point sideways by a fixed multiple of its row, so a point in row yy gains s ys\,y of disparity: the shift grows steadily down the picture. And a small difference between the two pictures’ horizontal scales moves each point sideways by a multiple of its column, so the shift grows along each row instead.

The shear is a change of the right camera’s skew, a number every camera model carries and every rectification sets to zero by habit. Nothing about the rays changes. The pair knows ss, as it knew the constant shift, so each row’s reading has its own s ys\,y subtracted before the depth is computed. That subtraction is the whole of the trick. A disparity offset the pair knows and takes back out is exactly what signal engineers call subtractive dither, and the earlier essay found its single-number version already beat a matcher’s own error by a factor of two.

The rest of this essay uses the shear, because a wall or a person standing up crosses more rows than a floor does columns, and because one row’s reading is the unit a matcher already works in.

A wall at ten metres, row by row

The hero figure reads a frontal wall at ten metres in forty rows, once with no shear and once through a shear that grows the shift by one pixel from the wall’s top row to its bottom.

A wall at 10 m read row by row through a shear of 1 px: each row reports a different depth, and their average lands on the wallForty rows of a frontal wall at 10 m on a 65 mm pair at 900 px, each read to a whole pixel. With no shear (the single column of marks) every row reads the same whole pixel and reports 9.75 m, so a plane fitted to all forty is 9.75 m. Through a rectification sheared so its shift grows by 1 px from the wall's top row to its bottom (filled), each row reads a whole pixel, the row's known share of the shear is taken back out, and the rows report depths spread across a shell's width; the forty readings' average disparity gives 9.979 m, 2.1 cm from the wall.0102030409.501010.5depth each row reports (m)row of the wallthe wall, 10 mno shear, each rowsheared, each rowfit, no shearfit, sheared65 mm pair, 900 px, 40 rowsfit 9.979 m against 9.75 m
Fig. 1 Every row of a frontal wall at 10 m, read to a whole pixel, with no shear and through a shear spanning one pixel over the wall’s forty rows. Unsheared, every row reports 9.75 m; sheared, the rows report depths spread across a shell’s width and their fitted plane is 9.979 m. The slider sets how many pixels the shear spans.

The wall’s disparity is 5.85 px. With no shear every row reads 6, reports 58.5/6=9.7558.5/6 = 9.75 m, and a plane fitted to forty identical readings is 9.75 m. Forty rows of one wall are one reading repeated forty times; averaging them buys nothing, because nothing differs between them.

Through the shear, row jj of forty has j/40j/40 px added before the rounding and subtracted after it. The first rows still read 6, and once 5.85+j/405.85 + j/40 passes 6.5 the rounding ticks over to 7. Each row’s reported disparity is its whole pixel less its own known share of the shear, so every row reports a slightly different depth, the forty spread across one shell’s width from 9.21 m to 10.88 m. Their average disparity is 5.8625 px against the wall’s 5.85, and the plane through them stands at 9.979 m, 2.1 cm short of the wall. With no shear, the same forty rows were 25 cm short.

The slider widens the shear. At a quarter of a pixel the rows cover a quarter of the pixel, and the ones that tick over are too few to pull the average far; at half a pixel the fit is better and still biased; at exactly one pixel the readings cover every part of the pixel equally and the fit comes home. At two pixels it is home again. The reason is arithmetic, and it is short. Rounding a number up from half-way is taking the floor of the number plus a half. The floor of xx, plus the floor of x+1/nx + 1/n, plus the floor of x+2/nx + 2/n, and so on across nn terms, is the floor of nxnx, which is Hermite’s identity, and dividing by nn leaves the average of the nn readings within 1/(2n)1/(2n) of the true disparity. The forty rows put it within an eightieth of a pixel, and at ten metres an eightieth of a pixel is 2.1 cm.

Every wall, with one shear

That bound does not mention the depth. The single shift’s defect was that it placed one depth and left the rest to chance; the shear’s bound holds for any disparity at all.

One shift reads one wall exactly; a one-pixel shear reads every wall, at every depth, to a few hundredths of a pixelThe error of a frontal wall's fitted depth, as a percentage of its depth, from forty rows read to a whole pixel. A single shift of 0.150 px, chosen to put a wall at 10 m on a shell (dashed), reads that wall exactly and every other depth by luck, a sawtooth whose teeth grow with the depth to 27.0% by 30 m. A shear that grows the shift by one pixel over the wall's rows (solid) reads every wall within 0.64%: −0.043% at 2 m, −0.213% at 10 m, −0.637% at 30 m.-20020102030depth of the wall (m)fitted depth's error (% of depth)one shift, 0.150 px1 px shear, 40 rowsfrontal walls, 40 rows eachdot: the wall the shift was chosen for
Fig. 2 The error in a frontal wall’s fitted depth, as a percentage of its depth, from forty rows, for walls from 0.5 to 30 m: a single shift of 0.150 px chosen to read the wall at 10 m exactly, and a shear spanning one pixel over each wall’s rows. The shift’s sawtooth reaches 27% by 30 m; the shear stays within 0.64% everywhere.

The single shift of 0.150 px reads the ten-metre wall exactly, at the dot, and every other wall falls wherever the lattice of whole pixels happens to put it. The teeth of its sawtooth grow with the depth, because a shell is wider the further it is, and by thirty metres a wall can be reported 27% from where it stands. The shear’s curve is the flat line along zero: 0.043% of the depth at two metres, 0.213% at ten, 0.637% at thirty. In disparity it is always within an eightieth of a pixel. In depth that eightieth grows with the square of the depth, as every disparity error does here, which is why the line rises slightly to the right; but it never becomes a shell.

So the answer to the second half of the question is yes, and it is the more important half. A single shift is one number and can satisfy one condition. A shear is also one number, but it does not try to put any wall on a shell. It makes the rounding irrelevant to the average, for every wall whose rows it spans by a whole pixel, at whatever depth the wall happens to stand. Whole pixels cut space into shells found the shells’ spacing set by the pair and their position set by the reading’s origin. The shear does not respace or move them. It reads each row from a different origin, and the wall’s rows between them cover the whole of a shell.

There is a sense in which this is the dither the earlier essay recommended, done properly. That essay found that a single shift drawn at random and subtracted left a root-mean-square error of 0.50 m at ten metres, better than any matcher with as much as 0.15 px of error of its own. A random shift is still one shift for the whole picture, so it leaves a wall wherever its draw puts it, and the 0.50 m is the spread over draws. The shear draws a different shift for every row and spaces them evenly rather than at random, so the forty draws a wall gets are already the average of the distribution. Even spacing is what turns a dither’s error from the spread of one sample into the error of a stratified mean, and the stratified mean of a uniform rounding error is zero to within the strata’s width.

The rows a wall covers

The bound is 1/(2n)1/(2n) px for a wall nn rows tall, so a tall wall is read better than a short one, and the curve should fall as one over the count.

Through a one-pixel shear the worst error falls as one over the rows a wall covers; with none it stays a shellThe worst error in a 10 m wall's fitted depth, over every placement of the wall against the pixel grid, against the number of rows it covers. With no shear (dashed) a frontal wall is read as one shell whatever its height, up to half a pixel of disparity, 0.85 m. Through a shear spanning one pixel over the wall's rows (solid) the readings are spread evenly across a whole pixel and their average is within 1/(2n) px of the wall's disparity: 21.4 cm for 4 rows, 2.1 cm for 40, 0.21 cm for 400, a slope of −1.000 on logarithmic axes.10301003000.010.11rows the wall coversworst error at 10 m (m)no shear1 px shearworst over placement on the gridslope −1.00
Fig. 3 The worst error in a 10 m wall’s fitted depth, over every placement of the wall against the pixel grid, against the rows it covers. Through a shear spanning one pixel over those rows it falls from 21.4 cm for four rows to 0.21 cm for four hundred, a slope of −1.000; with no shear it stays at half a pixel, 0.85 m.

It does, to three decimal places of the slope. Four rows read through a one-pixel shear put a ten-metre wall within 21.4 cm, forty within 2.1 cm, four hundred within 2.1 mm. With no shear the worst case stays at half a pixel whatever the row count, 0.85 m, because a frontal wall’s rows agree with one another and their number buys nothing.

How many rows a real object covers is a matter of its size and distance. At 900 px of focal length, something a metre tall at ten metres covers 90 rows, so a person standing at that distance covers about 150 and a two-metre wall 180. Read through a shear that spans one pixel over 150 rows, a person at ten metres is placed to within 6 mm by the rounding, against 0.85 m with no shear. A distant object covers fewer rows and has a wider shell, and both work against it: at thirty metres the same person covers 50 rows and is placed within 15 cm, against up to 7.7 m with no shear. The shear helps the far object least in absolute terms and most in proportion to what the shell would have cost it.

A whole number of pixels

A shear is set once for the whole picture, and the objects in a scene come in every height. A shear chosen so that it spans exactly one pixel over a 150-row person spans two thirds of a pixel over a 100-row doorway and three pixels over a 450-row building. So the bound’s other condition, that the shear span a whole number of pixels over the surface’s rows, cannot hold for everything at once.

A shear dithers a surface fully only when it spans a whole number of pixels over the surface's rowsThe worst error in the fitted disparity of a frontal surface 400 rows tall, over every placement against the grid, against how many pixels the shear spans over those rows. At a whole number of pixels the readings cover each part of the pixel equally and the error is 0.0013 px; between whole numbers it rises, 0.251 px at half a pixel, 0.084 at one and a half and 0.053 at two and a half, and the peaks fall roughly as one over the span. With no shear it is half a pixel.00.2000.40001234shear over the surface's rows (px)worst disparity error (px)a frontal surface 400 rows talldots: whole-pixel spans
Fig. 4 The worst error in the fitted disparity of a frontal surface 400 rows tall, against how many pixels the shear spans over its rows. It dips to 0.0013 px at every whole number and rises between them, to 0.251 px at half a pixel, 0.084 at one and a half and 0.053 at two and a half.

At every whole number of pixels the readings cover each part of the pixel equally and the error is a thousandth of a pixel for a 400-row surface. Between whole numbers the readings cover one part of the pixel once more than the rest, and the over-covered part pulls the average. At half a pixel the error is a quarter of a pixel, half of the unsheared half. At one and a half pixels it is a twelfth, at two and a half a nineteenth: the peaks fall roughly as one over the span, because the one over-covered part is a smaller share of a longer sweep.

That gives the shear’s practical rule. A shear spanning several pixels over the objects of interest leaves every one of them within a small fraction of a pixel whatever its exact height: at four pixels or more over the smallest object, the worst case between whole numbers is a few hundredths of a pixel, already a thirteenth of what the rounding costs undithered. A rectification sheared by a pixel over every twenty rows, 1/20 px per row, spans 7.5 px over the 150-row person and 2.5 over a 50-row one, and reads both well.

What the shear costs

The rectification family’s members were compared, in the essay that introduced the family, by what they do to the pixels: one choice stretched its pictures unevenly by a factor of 1.77, another by 4.86. A shear also stretches pixels, and it also widens the range of disparities the matcher must search.

The stretch is negligible. A shear of 1/40 px per row leans the right picture’s columns by 1.4° and lengthens a vertical step by three parts in ten thousand; 1/20 leans them by 2.9° and lengthens it by twelve. Rectifying a pair spends what its lines lean priced rectification’s resampling in its stretches, and against them these are invisible.

The search is the real cost. A shear of 1/40 adds 18 px of disparity between the top and bottom of a 720-row picture; 1/20 adds 36. The matcher searches each row over a range shifted by that row’s share, not widened by it, since the shear is known and each row’s search can start where its share says. A matcher that uses one fixed range for every row, as many do for simplicity, must widen it by the whole span, and that is a real price in time and in false matches.

Surfaces that slant dither themselves

Every surface so far has faced the pair, so that its own disparity is the same in every row and only the shear varies the readings. A floor, a road or a wall leaning back changes its disparity from row to row by itself.

A surface that slants across a pixel dithers itself; the shear dithers the frontal one and leaves one slant undithered insteadThe worst error in the fitted disparity of a surface 40 rows tall, against how much its own disparity changes from its top row to its bottom: a frontal wall at 0, a floor or a leaning wall either side. With no shear (dashed) the surface's own slant spreads its rows across the pixel, and only surfaces slanting by less than a pixel are read badly, worst at frontal (0.5 px). Through a one-pixel shear (solid) the frontal wall is read to 0.013 px, and the half-pixel error moves to the surface that slants by −0.975 px, whose own change cancels the shear row for row.00.2000.400-2-1012the surface's own change of disparity over its rows (px)worst disparity error (px)no shear1 px shearsurfaces 40 rows tall0 is a frontal wall
Fig. 5 The worst error in the fitted disparity of a surface 40 rows tall, against how much its own disparity changes from its top row to its bottom, with no shear and through a one-pixel shear. Unsheared, only surfaces changing by less than a pixel are read badly, worst at frontal; sheared, the frontal wall is read to 0.013 px and the half-pixel error moves to the surface that changes by −0.975 px.

Without any shear, a surface whose own disparity changes by a whole pixel over its rows is already read to an eightieth of a pixel. Its rows sweep the pixel by themselves, and a fitted plane averages them exactly as it averaged the sheared wall’s rows. Whole pixels cut space into shells found that a floor seen by this pair comes back as standing plates rather than flat treads, and that is the same fact seen from the other side: each plate is a run of rows reading the same whole pixel, and the plates’ edges are where the readings tick over. A plane fitted through the plates, rather than each plate read alone, recovers the floor. Only a surface that changes by less than a pixel over its height is read badly, and the worst is the frontal one, which changes by nothing.

The shear moves that blind spot. Through a one-pixel shear the frontal wall is read to 0.013 px, and the surface now read worst, at half a pixel, is the one whose own change is minus 0.975 px over its forty rows, cancelling the shear row for row. For that surface every row’s disparity plus its share of the shear is the same number, the rows read the same whole pixel, and nothing is dithered. The shear has not removed the blind spot; it has moved it from the frontal wall to a surface leaning back by a particular amount.

The trade is still a good one in most scenes, for a plain reason. Frontal surfaces are common: walls seen square, people, signs, the side of a vehicle crossing the view. A surface whose disparity falls by exactly one pixel over its own height, leaning back at the one angle that cancels the shear, is a single member of a continuous family, and a stronger shear, spanning several pixels per object, puts that member at a lean steep enough to be rare. A vehicle’s pair looking down a road sees the road change by many pixels over its rows and reads it well either way.

A matcher with error of its own

All of this assumed an exact matcher, one that finds each row’s match perfectly and only rounds it. The earlier essay found that a matcher’s own error dithers the rounding by itself, and that by half a pixel it had made the constant shift irrelevant. The same should be true of the shear.

The shear is worth most to a precise matcher; by half a pixel of matcher error the matcher has dithered the wall itselfThe root-mean-square error of a 10 m wall's fitted depth, averaged over where the wall falls against the grid, against the matcher's own Gaussian error before each row is rounded, computed exactly over the whole pixels each row can land on. Forty rows with no shear (dashed): 49.3 cm with an exact matcher, 19.7 cm at 0.2 px, 15.6 cm at 0.5 px. Forty rows through a one-pixel shear (solid): 1.4 cm, 9.1 cm, 15.6 cm. Four hundred rows through the shear (dotted): 0.14 cm, 2.9 cm, 4.9 cm.00.2000.40000.2000.4000.6000.8001matcher's own error before rounding, σ (px)fitted depth's rms error at 10 m (m)40 rows, no shear40 rows, 1 px shear400 rows, 1 px sheara frontal wall at 10 maveraged over placement
Fig. 6 The root-mean-square error of a 10 m wall’s fitted depth, averaged over where the wall falls on the grid, against the matcher’s own Gaussian error before rounding, computed exactly over the whole pixels each row can land on: forty rows with no shear and through a one-pixel shear, and four hundred rows through the shear.

It is. With an exact matcher, forty unsheared rows leave a ten-metre wall 49.3 cm out, root-mean-square over where it falls, and forty sheared rows leave it 1.4 cm out. With 0.2 px of matcher error the unsheared rows have been partly dithered by the matcher, 19.7 cm, and the sheared rows have taken on the matcher’s own spread divided among forty rows, 9.1 cm. By 0.4 px the two curves have met, and from there on they are one curve, the matcher’s error falling as one over the square root of the rows. At half a pixel both are 15.6 cm.

So the shear’s gain belongs to a precise matcher, exactly as the constant shift’s did, and for the same reason. A dither is a way of making the rounding irrelevant, and a matcher whose own error is as wide as the rounding has already done that, at the price of its spread. Where the matcher is precise, to a tenth or a fifth of a pixel before rounding, the shear removes nearly all of the rounding’s cost without adding any spread of its own, because its dither is known and subtracted rather than random and kept. Four hundred sheared rows read a ten-metre wall to 0.14 cm with an exact matcher and to 2.9 cm at 0.2 px; four hundred unsheared rows were 49 and 18 cm.

There is a lesson in the minimum on the unsheared curve, near 0.3 px, where a noisier matcher does better than a quieter one. That is the matcher dithering the rounding, and paying for it: its 13 cm there is the best a whole-pixel reading of a frontal wall can do by luck. The shear reaches below it at every matcher precision, and far below it where the matcher is good.

What was assumed

Each row is read independently. A matcher that correlates a window several rows tall sees the shear inside its window, leaning a vertical edge by a degree or two. Over a seven-row window at 1/40 px per row the lean is 0.15 px from the window’s top to its bottom, small beside the window’s own blur, but it is not nothing, and a matcher that assumes upright texture would pay it.

The rows are evenly spaced and the shear exactly known. Both are true of a rectification by construction. A shear introduced deliberately is a number in the rectifying warp, written down when the warp is made.

Every surface is plane over its rows. A fitted plane averages a plane’s rows; a curved surface’s fit has its own bias, which the shear neither creates nor removes.

The column-wise alternative is not measured. A difference of horizontal scale between the two pictures varies the shift along each row instead, and it would dither a surface across its columns as the shear dithers it across its rows. Combined, the two would dither a patch in both directions. Because the scale difference multiplies the column, its effect on a reading depends on where in the picture the match lies, and that interaction is not drawn here.

Why a constant could not do this

Depth is a reciprocal and the range a pair cannot see past both measured what a fixed reading error costs at depth, and the second disparity cuts cells separated the labels a reading can print from the depths it can tell apart. A constant shift moved the labels and left the telling apart untouched; vergence moves the shells and does not respace them found the same of turning the eyes. Both relabel, and a relabelling is one number applied everywhere, which can satisfy one condition.

The shear is not a relabelling. It reads each row against a different origin, and a surface that crosses rows is read against many origins at once. No single reading becomes finer; the average becomes exact, because the many origins between them cover the whole of the pixel. That is a property no constant can have, since a constant reads every row against the same origin, and it is the reason the family of rectifications, which the two pencils keep one number showed is rich in what it leaves free, contains a member that turns its own freedom into precision.

Still open: whether a matcher’s window should be sheared with the picture

A sheared rectification gives every row its own origin, and an average over rows then recovers what rounding threw away. A real matcher does not read one row alone. It correlates a window several rows tall and assigns its best disparity to the window’s centre, so neighbouring rows’ readings are not independent: two rows that share most of a window share most of their reading, and the forty readings of a forty-row wall may be fewer independent readings than forty.

The measurement that settles it renders a textured frontal wall through the sheared pair, matches it with windows of three, seven and fifteen rows, reads each window’s disparity to a whole pixel, and asks how close the fitted wall comes to the 1/(2n)1/(2n) the independent rows reached; whether a window sheared to follow the picture’s own shear, so that its rows are read along the leaning columns, restores the independence; and whether the lean the shear puts on vertical texture costs the window’s correlation peak more than the dither gains back.

A rectified pair keeps its rows shared under any map that leaves the vertical coordinate alone, so a rotation or a difference of vertical scale is not one, and a horizontal shear of one picture against the other is: it adds a known multiple of the row to every disparity. Subtracted after the rounding, it reads each row against a different origin, and a frontal surface whose rows the shear spans by a whole pixel is fitted to within 1/(2n) of a pixel, at every depth at once — 2.1 cm at ten metres from forty rows, where a single shift reads one wall exactly and every other by luck. The blind spot moves to the one slant that cancels the shear, and the gain is a precise matcher’s: by 0.4 px of matcher error the matcher has dithered the wall itself.

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.

BiasDepth from disparityDisparityleast squaresPrincipal pointQuantisationRectificationrectified pair