A street can read its own lens, if its edges are found finely
Worth reading first: The cube that is a box · Fitting a lens from straightness alone.
A lens bends a table’s tilt, not its lines photographed a street through a lens with 2% of barrel distortion and found that the lens’s main effect on a draughtsman’s table of leans was not the bending of the verticals. They bow by 0.38 px, too little to see. What the lens moves is where their straight chords meet, so a table fitted to the chords, the table of a table of leans converges on the wrong point, reads the camera’s 20° tilt as 18.87° and copies the photograph to four hundredths of a pixel, while drawing the scene itself more than a pixel wrong. Taking the lens out first made the pinhole table exact. Taking it out needs the lens.
The essay ended by asking whether the street could supply it. The photograph holds nine verticals and whatever rooflines the street has, all straight in the world, and fitting a lens from straightness alone showed that straight edges alone give a lens back, to fifteen digits from exact marks. The question here is practical. How precisely do the street’s own verticals fix the lens when their edges are found to a fraction of a pixel? Is that enough to bring the street, drawn through the lens it read, below the verticals’ own bow? How much do rooflines add? And does reading the lens and taking it out beat the copyist’s shortcut, fitting the table’s constant to the chords and never naming the lens at all?
Reading the lens wins when the edges are found finely, rooflines widen the margin, and one choice in the reading decides whether it works at all.
The edges, and what is read from them
The street and camera are the earlier ones: nine verticals 10 m tall spread across 18 m at 25 m, a camera 1.6 m up tilted 20° up, a 595 px focal length on a 690 by 420 sheet. The lens moves every point along its radius by a factor , with chosen so that the sheet’s corner moves 2% inward. To the verticals are added three rooflines along the facade at heights of 3, 6.5 and 10 m, long horizontal edges that run across the picture.
These are straight lines that are not in the smallest measure. At their true size the verticals bow by at most 0.38 px and the rooflines by up to 1.10 px: the rooflines are longer and run further from the picture’s centre, where a radial lens moves points most. Every edge is found as 41 points along it, each moved across the edge by a reading error.
The lens is read by straightening. For a trial lens, every found point is moved back through it, each edge is given its own best straight line, with its direction and offset free so that nothing is assumed about where any edges meet, and the misfit of the points to their lines is summed. The lens read is the trial lens with the least misfit. That is the method of the straightness essays, applied to the street’s own edges rather than to edges placed for calibration.
The misfit has to be measured where the edges were read
One choice in that recipe looks like a detail and is not: where the misfit is measured.
Measured after the trial lens is taken out, which is the natural place since that is where the edges should be straight, the reading drifts as the edges get noisier. At 0.3 px it reads −1.70% for a lens of −2%; at 0.5 px, −1.19%; at a pixel, +1.65%, the wrong sign. The cause is that a trial lens rescales the picture it straightens. A pincushion trial pulls the outer parts of the picture inward, and with them the readings’ own scatter about the edges, so it lowers the misfit by shrinking the noise as well as by straightening the bow, and the noisier the edges, the more that second effect is worth. Measured in the photograph’s own pixels, where the edges were found, by scaling each distance back by the lens’s local magnification, the reading stays on the lens: −1.99%, −2.01% and −2.15% at the same three errors.
This is the estimator’s error, not the method’s, and nothing in a fit’s output flags it. The misfit in the wrong place is a perfectly smooth function with a perfectly clean minimum. Every reading below measures it in the photograph.
How well the street reads its lens
For a single photograph the misfit has a shallow valley whose floor is the readings’ own 0.3 px and whose bottom sits near the true lens: −2.43% from the verticals alone in this photograph and −1.73% with the rooflines. The valley’s width is how well the lens is pinned, and the rooflines make it much narrower, because their bows are larger and a lens that is slightly wrong leaves them visibly curved.
Over 120 photographs, the nine verticals read the 2% lens to ±0.13% from edges found to 0.1 px, ±0.38% at 0.3 px and ±1.24% at a pixel. With the rooflines, ±0.07%, ±0.22% and ±0.74%, about 1.7 times as finely at every reading error. Both spreads grow in proportion to the reading error, as a reading of a fixed bow through noise must. At a pixel the verticals alone cannot even say reliably whether the lens is barrel, which is the earlier essay’s point about the bow seen from the other side: 0.38 px is too little to see, and it is also too little to measure against a pixel of noise.
The lines that calibrate a lens found that an edge’s worth for this purpose grows with its distance from the centre. The street’s own rooflines are its best edges for exactly that reason. A street photographed with its rooflines cut off by the frame has thrown away most of what it knew about its lens, and a street framed so that its longest edges cross the middle of the picture has hidden it.
Drawn through the lens it read
The question that matters to a draughtsman is not how well the lens is known but how well the street is then drawn. Reading the lens and taking it out makes the pinhole table exact only if the lens is exact, and the lens read carries its spread into the drawing.
The copyist’s table, fitted to the photograph’s chords with no lens named, draws the scene 1.07 px wrong at its worst top, and that is the bar to clear. The lens read from the verticals and taken out does better while their edges are found finely: 0.51 px at 0.3 px of reading, and level with the copyist at about two thirds of a pixel, beyond which the copyist’s shortcut is the better method. With the rooflines the read lens draws the street 0.30 px wrong at 0.3 px of reading, under the verticals’ own 0.38 px bow, and it is still marginally ahead of the copyist at a full pixel, 1.00 px against 1.07.
So the essay’s last question has a conditional answer. With the verticals alone, reading the lens is worth it for a photograph sharp enough to place an edge to better than about two thirds of a pixel and not otherwise. With rooflines it is worth it at any reading error a usable photograph allows. The copyist’s shortcut, which absorbs the lens into the table’s tilt, is never far behind and never needs to know what a lens is. It is what the earlier essay called it: a lens a draughtsman can absorb and never name, as long as nothing better is in the picture.
One photograph is one draw
The comparison above is of averages over 120 photographs, and a draughtsman has one. The two methods fail in different ways, which makes the average the wrong summary for a single picture. The copyist’s error is a bias: the same 1.07 px on every photograph of this street, because it comes from the lens and not from the reading. The read lens’s error is a scatter: some photographs read the lens well and draw the street almost exactly, others read it poorly and draw it worse than the copyist.
Counted photograph by photograph, the read lens from the verticals at 0.3 px draws the street worse than the copyist in 2% of photographs, with a median error of 0.33 px and one photograph in ten above 0.90. At 0.5 px it is worse in 22% of photographs, at 0.75 px in 38%. With rooflines the same counts are none at 0.3 px, 3% at 0.5 and 15% at 0.75, with medians of 0.21, 0.35 and 0.53 px. So the crossover of the averages, two thirds of a pixel for the verticals, already hides a draughtsman who has a one in three chance of doing worse than the shortcut. A cautious reader, wanting the read lens to win on nearly every photograph and not merely on average, needs edges found to about 0.3 px from the verticals or 0.5 px with rooflines.
There is a check available in the picture itself. The misfit at the read lens should be the reading error and no more; a photograph whose edges straighten to their reading error has read its lens consistently, and one whose edges stay visibly curved at the best trial lens has edges that are not straight in the world or a lens the one-term model does not describe. The copyist has no such check, because a table of leans fitted to chords always fits its chords.
More points along an edge do what finer points do
A reading error is set by the photograph’s sharpness, but the number of points found along each edge is the reader’s choice.
With 11 points an edge, the verticals’ read lens draws the street 0.91 px wrong; with 41, 0.51; with 161, 0.28. With rooflines, 0.54, 0.30 and 0.14. Four times the points halves the error, exactly as halving each point’s error would, since the reading averages over the points. Where along an edge they are spent matters less than how many there are, as the response is at the ends and the information is not found. Tracing each edge along its whole length is therefore worth as much as finding each point more finely, and a photograph whose edges are only good to half a pixel can still read its lens well if they are traced densely.
That has a practical edge. An edge found by fitting a line to every pixel of a sharp gradient along its whole length is effectively hundreds of points. The 41 points used throughout are a hand’s worth, marked one at a time; a program that follows an edge does far better than that from the same photograph.
What the draughtsman’s choice comes to
The earlier essays found three things a lens does to a table of leans: it moves the tilt the chords imply, it leaves a bow no straight lean can draw, and it makes the copyist’s fitted table a faithful copy of the photograph but not of the scene. Here is the fourth. The photograph holds what it needs to undo the lens, in the bows of its own edges, and a careful reading recovers it well enough to beat the shortcut. That reading needs three things the shortcut does not: edges found to a fraction of a pixel or traced densely, the long edges far from the centre, and a misfit measured where the edges were found.
None of these is exotic. The last is the only one a careful reader might get wrong, and the bias it produces is the dangerous kind, smooth and confident and growing with exactly the noise a reader cannot see.
Why the rooflines are worth what they are
The rooflines’ advantage has a simple shape that predicts where else to look for edges. A straight edge’s bow under a radial lens grows roughly with its length squared and with its distance from the centre, since the lens’s movement grows as the cube of the radius and the bow is the departure of the middle from the chord through the ends. The verticals here are 10 m tall at 25 m, about 250 px long in the picture, and the outer ones stand about 215 px from the centre. The rooflines are 400 to 450 px long, at rows 15 to 180 px below the centre, so the lowest and longest bows by 1.10 px, nearly three times the largest vertical’s 0.38, and the three of them carry as much about the lens as many more verticals would. The highest roofline, running almost through the centre, bows by only 0.075 px, less than all but the middle vertical: length pays only on an edge that also runs well away from the centre, and an edge through the centre has no bow at all, whatever its length, because the lens moves its points along the edge itself. A street’s kerbs, cornices and window rows are the same kind of edge, and every long one far from the centre is worth having.
A one-term lens, a facade, a fair copyist
One radial term, centred. The lens has a single coefficient about the sheet’s centre. A real lens has more terms and a centre that is not the sheet’s, and no design separates the two coefficients found how poorly straight edges tell the first two terms apart. A two-term lens read from the street would carry that correlation into the drawing, though a lens’s curve is known where its coefficients are not found the curve itself far better pinned than either term.
Rooflines square to the view. The rooflines run along a facade facing the camera, so they are parallel in the picture. On a street seen at an angle they converge, and since each edge’s line is fitted free, the reading does not need to know where they meet; what it loses is that receding rooflines are shorter in the picture and run less far from the centre.
The copyist reads the chords exactly. The copyist’s table is scored without reading error, which flatters it slightly against the read lens. With its feet and tops found to the same error the copyist’s fitted constant would carry its own spread, and the crossover would move a little in the read lens’s favour.
Error is scored at the tops. A drawn vertical is worst at its top, the end furthest from the foot it was ruled from, as in the earlier essays.
Still open: whether one lens read from several photographs fixes the streets one alone cannot
A camera’s lens does not change between photographs. A photographer who shoots a street, then the next street, then a doorway, has several pictures through one lens, each with a few straight edges, some near the centre and some far from it. Pooled, those edges might pin the lens where no single photograph can, and the street with its rooflines cropped could borrow its lens from the doorway.
The measurement that settles it reads one lens from the edges of two, four and eight photographs of different scenes together, each with its own tilt and its own edges, and asks how the lens’s spread falls with the number of pictures, whether a photograph with only weak edges near its centre is drawn as well through the pooled lens as one with strong rooflines through its own, and whether pooling across pictures hides a lens that changed between them, a zoom or a refocus, inside a single smooth misfit.
A lens read from many photographs follows the best one takes that measurement: pooled, the edges read the lens as well as the photographs’ informations added, mostly the best photograph’s, a weak street is drawn through the pool’s lens twelve times better than through its own, and a lens that changed is hidden only when it changed for the photograph that dominates the pool.
A street can read its own lens from the bows of its straight edges and draw itself through it, and that beats the copyist’s chord-fitted table while the edges are found finely: from the verticals alone below about two thirds of a pixel, with rooflines at any usable error, reaching 0.30 px against the copyist’s 1.07 at 0.3 px of reading. More points along an edge buy what finer points do. And the misfit must be measured where the edges were found; measured after the lens is taken out, noise reads as pincushion.
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 known target sharpens the fit and does not separate it — both name plumb-line calibration, radial distortion
- A rolled table is repaired by a sideways step — both name three-point perspective, vertical vanishing point
- The plane is a choice — both name three-point perspective, vertical vanishing point
Named objects
A flat tag is an object no other essay names yet.
Biasplumb-line calibrationRadial distortionthree-point perspectivevertical vanishing point