A rig is right on one surface
Worth reading first: The pivot that is not the eye · Depth is a reciprocal · What a 360-degree photograph actually is.
The two rungs before this one are about a mistake: a camera bolted to its tripod by the wrong point, when the right point was available and a rail would have found it. The rig is not a mistake. Put several cameras on a ball and point them outward and they have several entrance pupils, several centimetres apart, and nothing can be done about it — two lenses cannot occupy the same place.
So the question changes. It is no longer how badly is this mounted but which depth should the stitch be right at, since it cannot be right at all of them.
The residual is a disparity, and disparities are reciprocal
Two cameras a baseline apart, both looking the same way, image a point at depth at positions differing by pixels. That is the stereo disparity the depth field is built on, and it is what a rig’s stitch is fighting.
A warp computed to register depth is a shift of . Apply it and what is left over is
which is zero at and nowhere else. The picture is correct on one surface — the sphere or cylinder of radius around the rig — and every feature off it is drawn twice, or cut in half where the seam runs through it.
The reciprocal is doing the work in everything that follows. A depth range from a metre and a half to thirty metres is a factor of twenty in distance and a factor of twenty in disparity, and the near end dominates so heavily that any choice made by looking at the metres will be wrong.
The best depth is the harmonic midpoint
Ask for the choice of that makes the worst residual over a range as small as possible. The residual is monotone in , so the worst is always at one end or the other, and the minimum of the worse of the two is where they are equal:
which is the harmonic mean of the two ends. For a scene from one and a half metres to thirty, that is under three metres — a fifth of the way along the range in metres, and exactly halfway along it in disparity.
The search in that figure is not decoration. The closed form above is three lines of algebra and three lines of algebra can be wrong; a sweep over four thousand candidate depths that lands on the same number is what makes it a measurement. assertTheStitchingDepthIsTheHarmonicMidpoint requires the search’s minimum to agree with the formula to two parts in a thousand, which is the resolution of the sweep rather than of the claim.
The penalty for the obvious choice, in closed form
The arithmetic midpoint is what a person picks. It is wrong, and by how much has an exact answer:
For a range of one and a half to thirty metres that is a shade over one point nine — nearly twice as bad. And as the far end runs away it tends to exactly two and never exceeds it, so the penalty for the natural choice is bounded, and the bound is a factor of two.
That bound is the useful half. A rig whose stitching depth was set by somebody eyeballing the middle of the room is not catastrophically wrong; it is within a factor of two of the best it could have been, forever, whatever the scene. Which is worth knowing because it says where not to spend effort: the depth is worth choosing well and it is not worth choosing perfectly, and the thing that actually matters is the next paragraph.
And the floor, which is why the choice is small
Put the harmonic midpoint back into the residual and the worst case comes out as
— half the disparity spread of the whole depth range. That is the best any choice of can achieve, and it is not zero. On an eighty-millimetre baseline over a range from one and a half to thirty metres it is tens of pixels, which is a visible doubling.
So the optimisation is real and it is not a repair. assertNoStitchingDepthIsRight exists to stop the previous section being read as one: it requires the best achievable worst case to equal the closed form for the floor, and requires that floor to be pixels rather than nothing, and then requires it to vanish exactly when the baseline does. Without the third the floor could be an artefact of the fit; without the second the whole essay could be read as a tuning guide.
depth field. Everything in this essay is a consequence of the fact that a fixed error in the picture maps to an interval in depth that is not symmetric and eventually is not bounded.Why the harmonic mean, in words
The algebra is three lines and the reason is one sentence, and the sentence is worth having because it transfers.
The stitch’s error is linear in , not in . So the natural coordinate of the problem is inverse depth, and every question about “the middle of the range” has to be asked there. The middle of is , and the depth whose reciprocal that is, is the harmonic mean. Nothing about harmony is involved; it is the arithmetic mean, taken in the variable the problem is linear in.
This site meets the same move in three other places and it is the same move each time. The depth a stereo pair reports is a reciprocal, so a symmetric error in the picture is an asymmetric interval in the world. A depth buffer stores a reciprocal, so its precision is spent near the eye. A frustum’s near plane can be moved almost freely at the far end and not at the near one.
The transferable form is short: find the variable the error is linear in, and do the averaging there. Averaging in metres a quantity that lives in reciprocal metres is how the arithmetic midpoint gets chosen, and the factor of two is what it costs.
Checked against pictures rather than against itself
Everything above is algebra about a rig, and this site’s habit is that algebra about a thing is not a measurement of it.
So the closed form is checked against two actual cameras. rigPair builds a rectified pair at a stated baseline, projects six points at depths from two metres to twenty-four, applies the shift a warp for would apply, and asks where each point landed. The residuals agree with over the whole set, and the point at the stitching depth itself registers exactly, which is the control.
That control is the one that matters. A closed form and an implementation can share a sign error and agree perfectly; a point at the depth the warp was built for has to land at zero, and if it does not, the whole comparison is between two versions of the same mistake.
screen field, where the two pictures are shown rather than stitched. A disparity is a disparity whether it is being removed or displayed.Why this is not the pivot error with a bigger number
It looks like the same problem at a larger scale and it is not, and the difference is what a reader can do about it.
A pivot error is a mounting mistake with a remedy: slide the camera back on a rail until the pupil sits on the axis and both halves of the parallax go to exactly zero. The whole of the previous rung is about how much of it can be bought off without the rail, and the answer is a specification rather than a fix.
A rig’s baseline is not a mistake and has no remedy. Two lenses cannot be in the same place, so the residual has a floor set by the hardware’s size, and the only choices available are which surface to be right on and how big to build the rig.
There is also a difference in what the residual is a residual of. The pivot error’s miss is a length in the room, computable before any scene exists, because it is a property of the rays. A rig’s residual is a disparity in pixels and needs a depth before it is a number at all — the geometry is fixed and the scene supplies the divisor.
What the rig gets in exchange
It is worth stating what the baseline buys, because an essay that only prices a defect reads as an argument against the thing.
A rig of several cameras exposes every direction at the same instant. No sweep, no sequence of frames seconds apart, so the tear that a stitched panorama puts through a moving subject does not happen — a person walking through a rig’s picture is drawn once, in the right shape, from one of the several eyes.
And it needs no moving parts and no time. A rig can record video; a swing-lens camera and a tripod sequence cannot record a moment.
So the three arrangements this field now carries divide up cleanly. The swing lens has one centre and pays in detail and in a shear. The tripod sequence has many centres a rail can collapse to one, and pays in time. The rig has many centres nothing can collapse, and pays in a floor — and buys the only thing the other two cannot have, which is simultaneity.
What a rig would have to know to do better
The residual is a function of depth, so a warp that knew the depth of every pixel would remove it exactly. That is not a rhetorical observation — it is what a rig with a depth sensor does, and it works.
What it costs is the premise. A stitch that consults a depth map is no longer a projection at all: different parts of the picture are warped by different amounts, so there is no single map from directions to marks, and every quantity this field computes about a picture surface stops applying. The result is a rendering rather than a photograph, and the distinction is the one the pipeline field draws between a projection and a program that produces a picture.
So the rig has three settings and they are not on a scale. Register on the far field and accept the near disparity; register on a chosen depth and accept half the spread; or measure the depth and give up being a projection. This site can price the first two exactly and can only say what the third gives up.
The surface the picture is right on
There is a way of reading the whole result that puts it in this field rather than in depth, and it is the reason the essay sits where it does.
A rig’s stitch does not produce a picture with an error in it. It produces a picture that is a correct projection of one surface — the sphere of radius — with everything else drawn as though it were on that surface. The doubling at a near object is not noise; it is the picture faithfully reporting two directions for a thing that is not where the picture assumes it is.
That is the same move the second-eye essay makes on a two-centre drawing: instead of asking how wrong the picture is, ask what arrangement it would be a correct picture of. Here the answer is a shell at one distance, which is a stranger scene than a sheared room and is just as much a scene.
What this does not settle
It does not say which depth a real stitcher should use. Real scenes are not intervals with two ends; they have a distribution of depths, and minimising the worst case over a range is a different objective from minimising what a viewer notices.
It does not model the seam’s placement. A stitcher chooses where to cut as well as what to warp, and cutting through a region with nothing in it removes the artefact without removing the disparity — which is a good practical answer and is not a geometric one, in the same way choosing where to put the horizon is a choice about the drawing rather than about the room.
It does not treat the cameras’ own errors. Each of them has a lens, and a lens bends straight lines by an amount that is usually larger than any number here; a rig’s calibration is a bigger problem than its baseline and a different one.
And it does not say a rig is worse than a rail. It says the rig’s residual has a floor and the rail’s does not, which is a statement about the arrangements rather than about the pictures they make.
When an error cannot be removed, the useful question is which one thing it can be made zero at. The answer is a surface, and stating that surface is more informative than stating the error — because the surface is a choice and the error is a consequence.
depth field: the distance past which a pair of views stops distinguishing depths at all.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.
- A picture with two eyes in it — both name centre of projection, demonstration, parallax
- A scroll is not a panorama — both name centre of projection, panorama, picture surface
- A set cut for one eye — both name demonstration, disparity, parallax
- Six flat pictures of everything — both name demonstration, panorama, picture surface
- The ball at the edge of the frame — both name centre of projection, demonstration, picture surface
- The eye is a place, not a point — both name centre of projection, panorama, parallax
Named objects
A flat tag is an object no other essay names yet.
Baselinecentre of projectionDemonstrationDepth from disparityDisparityMinimaxPanoramaParallaxPicture surfaceStitching