A focus stack is sharp everywhere but its edges
Worth reading first: The eye is a place, not a point · The centre has an area.
One focus stopped down is as sharp as six in a deep room found a floor that no lens can get under. A frame that holds everything from a table half a metre away to a wall at four metres can be held, at one focus, no sharper than radians, where is the span of reciprocal distance the frame holds and the wavelength. For that room and green light the floor is 5.27 arcminutes, reached at whatever f-number gives an entrance pupil, the hole a scene actually sees, 1.24 mm across: f/40 on a fifty-millimetre lens. Defocus shrinks as the pupil closes and diffraction grows, and the floor is where they meet. No focal length appears in it.
The essay ended on the one strategy that escapes the floor by not asking one focus to hold the room. Focus stacking shoots the same frame several times at several focuses, each wide enough to avoid diffraction, and merges the sharp part of each. The essay proposed splitting the reciprocal depth into equal slices, giving each its own focus and the aperture that holds that slice best, so that the stacked frame’s worst blur would be the slice’s floor, . Against that it set a cost: each exposure’s pupil sits at its own focusing extension, so neighbouring slices see the scene from slightly different places. It asked how many slices make the stack sharper than one focus before the disagreement between slices becomes the larger error.
The first half is right and the second asked about the wrong boundary. Neighbouring slices barely disagree. What a stack pays for is the boundary between the first slice and the last, which a frame meets wherever something near stands in front of something far.
A stack of n exposures reaches the slice’s floor
The lens is the earlier fifty, the frame the table’s: half a metre to four metres, a reciprocal span of 1.75 per metre. A stack of splits that span into equal slices, focuses one exposure on the middle of each and stops it to the pupil that holds that slice best. The merge keeps each point from whichever exposure is sharpest for its distance.
Each exposure draws the earlier essay’s V, blur against reciprocal distance with its point at the exposure’s focus, and a narrower slice lets each V open its pupil wider before diffraction catches it. The merged frame follows the lowest V at every depth, so its worst blur is where two neighbouring Vs cross, at the slice boundaries, and that is the slice’s own floor. With four exposures at f/20.2 every depth in the room is held to 2.63 arcminutes, half of one focus’s 5.27.
Measured over the room, the stack’s worst blur matches the closed form at every count: 3.73 arcminutes for two exposures, 2.63 for four, 1.52 for twelve at f/11.7. It falls as one over the square root of the count, so halving the blur costs four times the exposures. The f-number falls as the square root too, so a twelve-exposure stack is shot three and a half stops wider than one focus, and each exposure needs about a twelfth of the time.
The seam the essay worried about is small. At a slice boundary the merge switches from one exposure to the next, and their pupils sit apart by the difference of their focusing extensions, the shift focusing moves the pivot past its best place measured for a panorama, at each focus. The two exposures then disagree about where a point at the boundary’s depth lies by the tangent of its field angle times that pupil difference times its reciprocal distance from the depth the merge aligned the exposures at, taken here as the room’s middle. At the frame’s edge, 19.8° off the axis, the worst such seam is 0.70 arcminutes at any count, about a quarter of the stack’s own blur. Neighbouring slices differ in focus by a slice and in pupil by a slice’s extension, and both shrink together as the count grows.
So on a continuous surface, a floor running back from the table or a wall seen at a slant, a stack does exactly what the essay hoped. It is sharper than one focus with two exposures and keeps getting sharper, and its seams never come near its blur.
An occlusion edge meets the first slice and the last
A frame of a room is not a continuous surface. The table stands in front of the wall, and at the table’s edge the frame jumps from half a metre to four metres without passing through anything between. The merge then takes the table from the exposure focused nearest and the wall beside it from the exposure focused farthest, and those are the two exposures that differ most: by the whole room’s depth in focus and the whole room’s extension in pupil.
Near the edge, every exposure sees the wall through some of the table’s blur, because a near object out of focus spreads its edge across whatever is behind it, the effect a pupil sees around an edge measured from the other side. A wall point is usable from an exposure only beyond the table’s blur radius in that exposure, and the merge can only choose among the usable ones. One focus at f/40 blurs the table by 5.27 arcminutes, so for 2.7 arcminutes beside the edge the wall is seen through the table, and beyond that it is held to 5.27.
A stack does worse beside the edge, and worse the more exposures it has. It has a usable exposure sooner, the one focused on the table, which barely blurs the table at all. But that exposure blurs the wall badly, by up to 20 arcminutes for a stack of eight, since its focus is half a metre away. The exposures that hold the wall sharply are focused far and, being shot wider open than one focus, blur the table further across the wall. So the wall beside the edge steps down through progressively farther-focused exposures, and comes down to one focus’s 5.27 arcminutes only at 4.2 arcminutes from the edge with two exposures, 6.6 with four and 8.6 with eight.
That band is the halo stacked pictures are known for, and its width is measurable. One focus spoils 2.63 arcminutes beside the edge, the radius of its own blur of the table. A stack spoils 4.16 with two exposures, 6.58 with four and 11.29 with twelve. Up to four exposures the band is exactly the table’s blur radius in the farthest-focused exposure, whose pupil grows as the square root of the count. Beyond, an intermediate exposure clears the wall a little earlier and the band grows more slowly, even narrowing for a step at five. In every case it is wider than one focus’s.
The trade has a simple shape. Each exposure’s pupil is , so its defocus of the table, seen from the far end of the room, grows as , while its blur of the slice it was focused on falls as . What the stack gains in the middle of each surface it spends beside each edge, in the same currency, because both are set by how wide the far exposures are opened.
The first and last exposures see from different places
There is a second cost at the edge, and it is geometric rather than a matter of blur. The table’s edge comes from the exposure focused nearest, whose pupil is carried furthest forward by its focusing extension, and the wall comes from the one focused farthest, whose extension is least: 4.24 mm and 1.78 mm for two exposures, 5.22 mm and 0.91 mm for eight. So the two halves of the edge are seen from places between two and a half and four and a half millimetres apart along the axis.
A forward step of the pupil moves every off-axis point outward by its field angle’s tangent times the step over its distance, and moves a near point more than a far one. The table’s edge and the wall beside it are therefore shifted against each other by . At the centre of the frame that is nothing. At the frame’s edge, 19.8° off the axis, it is 5.32 arcminutes for two exposures, 7.99 for four and 9.32 for eight, approaching the 10.7 the full extension difference would give. No alignment of the exposures removes it, because an alignment scales and shifts whole pictures and the two sides of the edge need different corrections. A stacker that aligns on the wall leaves the table’s edge displaced; one that aligns on the table leaves the wall displaced; either way the edge is drawn in the wrong place relative to what is behind it.
One focus has one pupil and none of this. It is the refocused panorama’s seam of a refocused panorama is six lenses, moved from between frames to inside one frame: there, two frames focused differently disagreed along the line where they were stitched; here, two exposures focused differently disagree along every occlusion edge in the picture. Focusing is a zoom found that each focus is a slightly different lens, and a stack is a picture assembled from several lenses along every edge where depth jumps.
Where in the frame a stack is right
Putting the two costs together gives a map of where a stack can be trusted.
With two exposures, the misregistration at an occlusion edge stays below one focus’s 5.27 arcminutes almost to the frame’s edge, out to 19.6° of its 19.8°, and below the stack’s own 3.73 out to 14.1°. With eight, it stays below one focus’s blur only out to 11.5° and below the stack’s own 1.86 only to 4.1°. The more exposures, the sharper the stack and the smaller the part of the frame in which its edges are where its sharpness says they are. Outside that part, a twelve-exposure stack shows a wall rendered to a minute and a half of arc with a table’s edge misplaced against it by nine.
So the answer to the essay’s question is a count that depends on what the frame holds. For a frame of continuous surfaces, a landscape seen across a field, a document lying at a slant, every additional exposure pays, and the seams never catch up. For a frame with occlusion edges near its own edge, two exposures already misregister those edges by about as much as one focus blurs them, and more exposures make the misregistration larger while making everything else sharper. One focus stopped down is never as sharp as a stack in the middle of a surface, and never wrong at an edge.
How large these are in pixels
The earlier essays measured in arcminutes and took sixty pixels to a degree, so that an arcminute was a pixel. A fifty-millimetre lens on a full-frame sensor six thousand pixels across spreads them over 39.6°, about 150 to the degree, so an arcminute there is two and a half pixels. On that sensor one focus at f/40 blurs every point of the room over about thirteen pixels. A stack of eight holds every continuous surface to under five pixels, which is the difference between a picture that looks soft when viewed at full size and one that does not.
Beside the table’s edge the same stack spoils a band of wall about twenty-one pixels wide, and at the frame’s edge it draws the table’s outline twenty-three pixels away from where it belongs against the wall, while one focus draws it in place inside its thirteen-pixel blur. A viewer looking at the whole picture on a screen sees the sharpness and not the edges. A viewer looking at full size at the frame’s corner sees an outline that the wall behind it does not agree with, which in a stacked picture looks like a seam with nothing on either side of it to explain it. Both are the same stack, judged at two magnifications, which is the sharp band is a decision’s point about blur, carried over to registration.
What this means for a photographer
Stacking is used most in close-up photography, where the reciprocal depth of a small subject is large and one focus can hold it only at apertures where diffraction is severe. The same arithmetic applies there with larger numbers. A subject a few centimetres away has a reciprocal span of tens per metre, the extensions are millimetres per slice, and the occlusion edges are the subject’s own outline against its background. The halos stacking software is known to leave around such outlines are the band measured here, and their width follows from the farthest exposure’s pupil, not from the software.
Two rules follow. Stack a subject seen against a background close behind it, so that the jump in depth at its outline is small, since both costs scale with that jump. And put the outlines that matter near the middle of the frame, since the misregistration grows with the tangent of the field angle and vanishes on the axis. A focusing rail, which moves the whole camera instead of turning the focus, moves the pupil by the change of subject distance itself, far more than a focusing extension, and is not measured here.
The room and the stack, as assumed
Equal slices of reciprocal distance and each exposure at its slice’s best pupil. A stacker that shoots every exposure at one aperture reaches a different floor, and one that spaces its focuses unequally can trade blur between slices. The equal split is the one the closed form assumes and the measurement confirms.
Blur and diffraction combined by root sum of squares, as in the earlier essay, and stated there as the assumption the floor is most sensitive to.
A merge that chooses whole exposures point by point. Real stacking software weights and blends neighbouring exposures, which softens the steps in the wall’s blur beside an edge but cannot make usable a point that every exposure sees through the table’s blur.
The pupil carried forward by the focusing extension, as the thin-lens model of the earlier essays has it. A lens that focuses by moving an internal group shifts its pupil differently, usually by less, and the misregistration scales with whatever shift it has.
Still open: whether a stack can be shot from one pupil
The misregistration at an edge exists because each exposure’s pupil is in a different place. A camera on a rail that moves backward by each exposure’s extension as the lens focuses forward, the tracking head of the panorama essays turned into a stacking rig, would put every exposure’s pupil in the same place. The halo would remain, since it is a matter of how wide the far exposures are opened and not of where they stand, but the edge’s two sides would then be seen from one point.
The measurement that settles what such a rig buys moves the camera back by each exposure’s extension, and asks how far the occlusion edge’s misregistration falls once the pupils coincide, leaving only the walk of the pupil with field angle that no rig removes, which the entrance pupil walks with the angle measured; whether the magnification each focus brings, which a stacker currently removes by scaling, is then the same for both sides of an edge and can be taken out exactly; and whether, with the parallax gone, the band beside an edge can be narrowed by choosing the far exposures’ apertures by their effect on the edge rather than on their own slice, so that a stack trades its interior sharpness for its edges deliberately rather than by default.
A stack shot from one pupil is one picture scaled takes that measurement: with every pupil at one place each exposure is the same projection scaled, so the misregistration goes entirely and breathing becomes one known scale per exposure; the rail must hold its pupils to about 0.7 mm, and stopping the far exposures down trades the halo deliberately, twelve at half their pupils beating four at full on both counts.
A focus stack holds a continuous surface to , sharper than one focus with two exposures and sharper again with every exposure added, and its seams between neighbouring exposures stay a quarter of that. Where a near object stands in front of a far one, the stack meets its first exposure and its last. The far exposures are shot wider open, so they blur the near edge across more of what is behind it, a band from 2.6′ at one focus to 11.3′ at twelve exposures, and the two sides of the edge come from pupils a focusing extension apart, misregistered by up to 9.8′ at the frame’s edge. One focus has one pupil and neither cost.
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.
- One depth per sample is not enough — both name entrance pupil, instrument limit, occlusion
- The camera that is a cylinder — both name entrance pupil, instrument limit, parallax
- The disc and the streak — both name depth of field, entrance pupil, instrument limit
- The hole a rig cannot fill — both name entrance pupil, occlusion, parallax
- The parallax you cannot shoot away — both name entrance pupil, instrument limit, parallax
- A close picture carries its own distance — both name depth of field, thin lens
Named objects
A flat tag is an object no other essay names yet.
depth of fieldEntrance pupilinstrument limitOcclusionParallaxThin lens