The rectangle behind the lens

A box leaves a line of cameras

Let pixels be any width and one picture of a box has three equations for four unknowns, so it does not read one wrong camera but a whole line of right ones. The principal point sweeps across the frame as the width is assumed. Every member keeps all three right angles exactly, and the line has ends, because a squeezed triangle can stop being acute.
17 min read 5 figures The round tripFitted, not assumed

Worth reading first: A focal length is not an angle · Recovering the camera from the picture it drew.

The pixel that is not square handed a recovery a picture from a camera with two focal lengths and watched it come back with one. A 2-to-1 anamorphic returned a focal length 49.6 per cent out, a principal point far from the truth, and no complaint from any of the checks. That essay’s limit was stated in careful words: a single view of a box determines three camera parameters and cannot determine four. And it left it there, because its interest lay in how silently the recovery fails.

A limit of that kind has a shape, and that shape is worth drawing. If three equations bind four unknowns, then what a picture of a box leaves is not a wrong answer but a curve of answers: one for each value of the fourth unknown, every one of them exact. A recovery that assumes square pixels reports one point on the curve. The whole curve is what the picture holds. Measuring it answers questions that a single wrong point cannot: how far the other members lie from the truth, whether any of them can be ruled out on their own terms, and how much each kind of extra knowledge is worth in closing the curve.

Three right angles in a squeezed page

The classical recovery rests on an elementary fact. Three mutually perpendicular directions in the world vanish at three points on the page, and for a camera with square pixels the principal point is the triangle’s orthocentre, the point where its three altitudes meet. Recovering the camera measured how well that works.

Now let each pixel be aa units wide for each unit of height. Divide every column by aa and the page becomes the page of a square-pixelled camera, with its vanishing points at (x/a,y)(x/a, y). Everything the classical recovery says holds on that squeezed page. So for any assumed aa there is a squeezed triangle, an orthocentre, and a focal length from the same right-angle equations. Then multiply the orthocentre’s column back by aa and the result is a camera with that width, that focal length and that principal point, which is exact.

One triangle of vanishing points and every camera it allowsThree vanishing points of a box photographed through an anamorphic lens with pixels 1.33 wide for 1 tall, and the track its principal point follows as the pixel's width is assumed. Each assumption makes a different triangle by squeezing the page, and each squeezed triangle has its own orthocentre, its own focal length and no complaint. At 1.1 the principal point stands at (217, 407) with a focal length of 985. The track runs across the frame, and it ends at 0.59 and 2.52, where the squeezed triangle stops being acute and a real focal length stops existing.the framethe line: where the centre goesat 1.1: focal 985 px
Fig. 1 Three vanishing points from a true 1.33 anamorphic, and the track the principal point follows as the pixel’s width is assumed. This member assumes 1.1. A different width squeezes the page differently, giving another orthocentre and another focal length, with no change to the three points themselves.

That track is the picture’s own statement of what it knows. Take a camera with f=854f = 854 px, pixels 1.33 wide, principal point at (345, 210), photographing a box. Its vanishing points are on the page at the positions they are at. Assume a width of 1.33 and the recovery returns the camera exactly, as it must. Assume 1.1 and it returns a centre at (217, 407) and a focal length of 985. Assume 1 and it returns (169, 539) and 1,039, the same report the square-pixel recovery gives. Assume 1.7 and it returns (601, 44) and 658. Every member satisfies all three right-angle conditions to the rounding of the arithmetic: they are all right.

The centre’s journey deserves a look. Over the widths a real lens might have, it travels from below the frame’s lower left to near its upper right, covering most of the frame’s width and more than its whole height. The true centre is one point on that path, and nothing about the path marks it out.

What the rest of the camera does along the line

Those three numbers vary together, and as the width grows the focal length falls and the centre’s column grows, in the way the page’s geometry dictates.

What the rest of the camera does, for each widthThe focal length and the principal point's two coordinates, for every pixel width between 0.59 and 2.52, all of them reproducing the box's three right angles exactly. The true camera is at 1.33, with 854, 345 and 210. At a width of 1 the same picture reads as 1039, 169 and 539.05001e+31.5e+32e+311.502the pixel's width assumedpixelsfocal lengthcentre's columncentre's rowone picture, one curve of camerasall exact
Fig. 2 The focal length and the principal point’s two coordinates along the whole family, from a single picture. Each vertical slice through this figure is a complete and exact camera, and the true one is only one of them.

Between a width of 1 and 1.7 the focal length falls by 37%, the column more than triples and the row falls to a twelfth. A person who has decided, on grounds unrelated to the picture, that the principal point is in the middle has done a great deal of work with that decision, and the figure makes that visible: a centred principal point selects one vertical slice.

It is worth reading the same figure as an account of the failure the earlier essay measured. A 2-to-1 anamorphic read as square lands 49.6 per cent short on its focal length. This figure’s camera is a 1.33 and reads 21.6 per cent long at a width of 1. The signs differ, because it is the box’s turn that sets where along the family the camera lies and how the family runs. The size of the error depends on the view as much as on the lens, and a single figure quoted for a given squeeze is a statement about one view. So the failure measured at 2 to 1 should be read as an example and not as a rate.

The family has ends

A curve of exact answers looks like a free parameter, as though a picture could be read at any width. The arithmetic says otherwise, and that is the first new thing the family gives.

A focal length is real only if the orthocentre lies inside the triangle, which requires the triangle to be acute. Squeezing a page along its columns changes the triangle’s angles, and a sufficiently hard squeeze will make one of them obtuse. At that point the equation for the focal length’s square yields a negative number. No camera with that width can have drawn these vanishing points, at any focal length, whatever the principal point. So each picture of a box comes with an interval: the widths its triangle allows.

For the 1.33 camera here, the interval runs from 0.59 to 2.52. A claim that this lens has pixels 3 wide can be refuted on the spot, from this picture alone, using nothing but the right angles of a box. That is a different kind of thing from a measurement of the width: it is the picture rejecting a whole range of cameras without being able to name the one that took it.

How much squeeze a box's triangle allows, by the viewFor a square-pixelled camera in six views of a box, the range of pixel widths a reader could assume before the triangle stops being acute: yaw 45°, pitch 35° 0.57 to no upper limit up to 20, yaw 38°, pitch 26° 0.45 to 1.90, yaw 30°, pitch 20° 0.34 to no upper limit up to 20, yaw 20°, pitch 12° 0.21 to no upper limit up to 20, yaw 60°, pitch 30° 0.17 to 2.35, yaw 15°, pitch 45° 0.76 to 1.79. A squeeze along the page's rows turns the triangle's angles, and how soon one of them reaches a right angle depends on how the view has placed the three points, so the same box can bound the family tightly or hardly at all. The bars cap the upper limit at 6.yaw 45°, pitch 35°×10.46yaw 38°, pitch 26°×4.26yaw 30°, pitch 20°×17.54yaw 20°, pitch 12°×28.83yaw 60°, pitch 30°×13.90yaw 15°, pitch 45°×2.35widest over narrowest, upper limit capped at 6the view sets it
Fig. 3 For a square-pixelled camera in six views of the same box, the range of pixel widths the triangle allows, with the upper limit capped for drawing. The same camera allows a width over a very different range in different views, so what one picture can rule out depends on the view.

How large the interval is depends entirely on the view, and the figure makes that plain. A view at yaw 15° and pitch 45° bounds a true width of 1 between 0.76 and 1.79, which is a useful result. Others have no upper limit at all up to a width of twenty, because squeezing their triangle keeps every angle acute at any strength the sweep tried. A view nothing excludes is possible, and it costs nothing to compute which is in hand. So a practitioner’s first check on a suspected anamorphic is available for the price of an orthocentre and six comparisons: for the widths the supplier claims, does the triangle stay acute? This check can only refute, never confirm. It is a necessary condition rather than a sufficient one, and it has the rare merit of needing no extra knowledge about the scene.

What the internal check says

The recovery’s standard internal check is the agreement of its three focal lengths. Each pair of vanishing points gives its own estimate of the focal length, and a large disagreement should warn that something is wrong. The pixel that is not square found this silent at its wrong answer, and it is worth saying now why it had to be.

The three focal lengths agree at every memberThe spread among the three focal lengths each pair of vanishing points gives, which is the usual internal check on this recovery, read at each member of the family: all of them zero to rounding. Agreement among the three is a consequence of how the orthocentre is defined and carries no evidence about the width, so it reports the same at 1039 px as at 854 px.width 11e-9%width 1.11e-9%width 1.21e-9%width 1.331e-9%width 1.51e-9%width 1.71e-9%width 21e-9%spread of the three focal lengthssilent at every width
Fig. 4 The spread of the three focal lengths at each member of the family, drawn on a scale of one per cent. It is at the arithmetic floor at every width, because this agreement is what defines an orthocentre.

The three estimates −(vi−c)⋅(vj−c)\sqrt{-(v_i - c)\cdot(v_j - c)} are equal exactly when cc is the orthocentre: subtract any two of the expressions and the difference is an altitude’s equation. So the check is a theorem about the orthocentre, not a test of the camera. It compares a quantity with itself. For exact points it must report zero at all widths, as the figure shows. For noisy points it reports some value, but that value concerns the noise and says nothing whatever about the width. Other checks on a recovery that are really consequences of its definition can be found in the same way, and the question to put to each is whether a wrong assumption could change its answer. For this one the answer is a clean no, since every member of the line passes.

The centre closes it, at a price

If a true principal point is known, the family closes at once. Its track crosses the known column once. That is one equation in the width, and the picture gives the width.

Assume the centre and the family gives up its widthAssuming the principal point's column closes the family at a stated point, because the track crosses that column once. Assumed at its true value, the width comes back exactly as 1.33. An error in the assumption moves it: 1.363 for a column 20 px too far right and 1.297 for 20 px too far left, about 0.02 per pixel. The assumption has the full weight of the answer, and the picture cannot check it.1.251.301.351.40-50-2502550error in the assumed centre's column (px)pixel width readexact vanishing pointsat 0 px: 1.330
Fig. 5 Assuming the principal point’s column closes the family, and the width read depends on that assumption. Sliding the error in the assumed column shows the width it would report, with exact vanishing points and no reading error.

The closure is exact: assume a column of 345 and the width comes back as 1.33 to eight digits, with a focal length of 854 and a row of 210. The row is a by-product, which makes it a check, since an assumed row was never used. So with an assumption about the column, a box does read the squeeze. Yet the price is plain in the slope. A column 20 px too far right reads 1.363 and 20 px too far left reads 1.297, or 0.0017 per pixel. That is mild, on its face. The difficulty is that a lens can be shifted or a picture cropped by a great deal more than 20 px with no visible trace, and that a fitted camera’s centre is often the least well-known thing about it. A cropped anamorphic frame, for instance, has a principal point nowhere near the frame’s centre, and a recovery that assumes otherwise reads a squeeze that is really the crop.

A mirror-image trap sits inside this. A practitioner who assumes a centred lens and a square pixel at the same time is assuming two things, against a picture that can only supply three of four numbers. It is a consistent, overdetermined system, and the leftover residual looks like a check on both. It is then tempting to read a small residual as a confirmation. In fact it confirms only the combination, and a slight error in one can be compensated by a slight error in the other, all along the line. The residual is the distance of that assumed point from the line, and nothing else. In the figure above, that is the difference between the assumed row and the row the family reports at that column. The arc every eye stands on is the same structure with the width held and the eye free: one more unknown than the equations, and a curve of exact answers.

What a picture from a shifted anamorphic looks like

The most useful single observation may be how ordinary the members look. Any member of the family draws the box’s three vanishing points exactly, with all its right angles preserved. Draw a whole scene with one of those cameras and look at it: the camera on the line differs from the true one in focal length and in width and in where the frame’s centre falls, and the box itself is unchanged. The wrong member gets every right angle of a box exactly and gets other things wrong, such as the shape of a circle or the ratio of two lengths on a face. Those are what the box does not constrain.

In other words, the three right angles of a box and a pixel’s width are close to independent as evidence. A picture is under-determined precisely in the direction that alters what is not a right angle, and it stays exactly determined in every other. That shows up in practice: the same picture, read to the wrong width, is often perfectly useful for what it was taken for, such as finding walls and aligning a model, because the wrong camera has the right map on the faces of the box. It is much less useful for reading off a true aspect from what was photographed, because the aspect is what has been traded away, which is the point at which it starts to matter.

The size of what a reader can claim

Because every member is exact, none of this depends on how well the box was read. But the noise matters in one place. Each member of the family is built from three vanishing points that a real picture knows only approximately. With a few long edges read to half a pixel, a vanishing point near the frame is good to a few pixels, and one a long way off can be good only to hundreds. The track then has a thickness. The family becomes a band, and a width that the exact points allowed may fall outside it, or one they ruled out may be accepted. Those bounds at 0.59 and 2.52 will wobble from picture to picture.

The ends of the family are the most fragile part of it. An orthocentre near a triangle’s edge changes fast with the positions of the points, so that an end measured from noisy points is noisy, and the check above should not be used near a boundary with any confidence. Well inside the interval, or well outside it, the verdict holds up. No band of the track is measured here, because nothing in the argument needed it. A square closes the line of cameras supplies the reading directly for the number that counts.

Why not simply fit four parameters

Most calibration routines allow two focal lengths and fit them as a matter of course, so why does this family not appear to their users? Because they photograph a flat target from many positions, and each position gives two equations. Three views of a plane is six equations for four unknowns. The family is a fact about a single view of a box, and a routine fed many views never meets it. One picture of a box is the arrangement that creates it, and what a single view cannot give has always been stated for that arrangement. It is common wherever the camera is not available for calibration: any archive photograph, a film still, a rendering whose settings have been lost, or any picture a recovery is applied to after the fact. Those are the pictures most often read with a square pixel assumed. For them the honest output is the line itself, and reporting a single camera says more than the picture knows. An angle is a cross-ratio puts the underlying right-angle condition in another form, and it runs into the same count.

What a practitioner might do with the line is limited but real. Report the interval the triangle allows. Report what follows for the column and the focal length at each width of interest. If a lens’s known squeeze ratios are in a short list, as they generally are, compute the family’s camera at each of them and compare with what else is known. That is a modest result to deliver. It is nevertheless more honest than one exact-looking wrong number, and it can be delivered in a line.

Skew, a leaning wall and a breathing lens all leave the family

The family assumes no skew. Allowing one would make it a two-parameter surface, and it was noted in the earlier essay that an anamorphic whose axis is not aligned with the rows produces exactly a skew.

It assumes the box’s three directions really are at right angles, with no building that is out of true. A wall leaning a degree, of the kind a plumb wall tells from a horizon, does not sit on the family, and a recovery that absorbs it moves along the line by some amount that no single picture can detect. The size of that effect is a separate measurement.

And it assumes a pure lens: the bowing of a wide lens or an anamorphic’s own breathing, which changes the squeeze with the focus, would be extra distinct effects, and neither is treated here.

Still open: which single extra fact closes it best

The centre closes the family, but the centre is the thing least likely to be known. Other extra facts could do the same job without any reference to the camera’s centre, all from the scene: a square on one face, since a square’s diagonals are at right angles and two directions at 45° to a right angle are a new equation; a circle on a face, whose circular points supply the same kind of equation; or a second view of the same box, which has the same inner camera and three more right angles.

The measurement that settles it reads a true squeeze from each of them, with a stated number of edges read to half a pixel. It asks how the width comes back: which source is best, at what level of reading precision, and how the result depends on the box’s turn. It also asks what happens when the supplied fact is wrong, as when a rectangle is taken for a square, since an extra fact that has been silently assumed is the same kind of thing as a centred lens that has been silently assumed.

A picture that cannot say which camera took it has still said a great deal. Three right angles leave a line, the line has ends, and an honest reading reports the line.

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.

AnisotropyAspect ratioCamera calibrationDegeneracyFocal lengthnecessary, not sufficientPrincipal pointResidual