A sheared rectification reads every wall at once
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 gains 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 , as it knew the constant shift, so each row’s reading has its own 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.
The wall’s disparity is 5.85 px. With no shear every row reads 6, reports 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 of forty has px added before the rounding and subtracted after it. The first rows still read 6, and once 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 , plus the floor of , plus the floor of , and so on across terms, is the floor of , which is Hermite’s identity, and dividing by leaves the average of the readings within 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.
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 px for a wall rows tall, so a tall wall is read better than a short one, and the curve should fall as one over the count.
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.
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.
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.
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 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.
- Turning the cameras inwards — both name disparity, principal point, rectified pair
- A bowed stick is read as a wrong index — both name bias, least squares
- A chain of resizes remembers its smallest picture — both name bias, quantisation
- A crop moves the frame and not the camera — both name principal point, quantisation
- A display's scales cancel, if they are true maps — both name principal point, quantisation
- A pair over a ripple wobbles in depth, by the sea's curvature — both name depth from disparity, disparity
Named objects
A flat tag is an object no other essay names yet.
BiasDepth from disparityDisparityleast squaresPrincipal pointQuantisationRectificationrectified pair