The lamp, out of the picture
Worth reading first: Where shadows vanish · Recovering the camera from the picture it drew.
This site recovers cameras from the pictures they drew, and the reason to do it is not that anybody needs the camera. It is that a recovery is a test the geometry can fail: draw from a known camera, forget it, get it back from the drawn edges alone, and compare. The lamp is the other centre of projection in the same picture, and it can be recovered the same way.
Two lines and two points
Two facts do all of it and neither requires the camera to be calibrated.
The line from a post’s top through the tip of its shadow passes through the light. That is what casting a shadow means. So the images of those lines, for two posts, meet at the image of the light.
The line from a post’s foot through the same tip lies in the ground plane and passes under the light. So the images of those lines meet at the image of the point on the ground directly below the light.
Two intersections, and they are vertically apart in space. The rest is arithmetic: the foot’s image is a point of the ground plane, so its world position comes from intersecting its ray with ; and the light lies on its own ray, above that foot.
Three residuals, and only one of them is a test
The construction produces three numbers that could be wrong, and it is worth separating them because two of them are self-consistency and one is truth.
Agreement between posts, in pixels. The intersection is taken from two posts and there is a third. If the scene were lit by two lamps, or if a shadow tip had been placed by hand, the third post’s lines would miss the fitted points. They miss by px, which says the scene is lit by one light.
Closure in space, in metres. The lamp’s own ray and the vertical through its recovered foot are two lines in space, and two lines in space are not obliged to meet. Solving them as a least-squares closest approach rather than as an intersection returns both the answer and the distance between them at their nearest — the only quantity in the construction that could report a failure. An intersection routine cannot; it would return a point either way.
The error against truth, in millimetres. The one comparison against something the recovery never saw. The lamp comes back where it was put.
The first two are checks a reader with a real photograph can perform. The third is available only because the picture was drawn from a known lamp, which is the whole reason this site draws its own pictures.
Telling a lamp from the sun
The construction does not need to be told which it is looking at, and where the foot lands is the answer.
Under the sun, the shadow-direction lines are parallel in space, so their images converge at a point on the horizon, which is where shadows vanish. The point where the foot-lines meet is px from the horizon, which is zero to any standard a photograph could set. Under a lamp it is a few hundred pixels below it.
So there is no separate test for is this the sun. There is one construction, and the answer is a point; if the point is on the horizon the light is at infinity, and the sun is the case of the light being at infinity. That is the same collapse the limit rung makes for parallel projection and the shadow rung makes for shadows generally, appearing for a third time.
One post, and the residual that means nothing
Now take away a post. With one post there is one ray-line and one ground-line, they intersect nothing, and there is no answer.
The temptation is to fit anyway. A single post plus a least-squares solver produces a point — the nearest point on the line, or whatever the parameterisation happens to prefer — and it produces it with a residual of exactly zero, because a system with fewer equations than unknowns has a solution space rather than a solution, and any member of it fits perfectly by construction.
The honest report is the family. Every lamp along the ray from the post’s top through its shadow tip casts exactly that shadow of that post: the shadow tip is where the line hits the ground, and moving the lamp along the line does not move it. Nine of them, spread over two and a half metres of the ray, all cast the identical shadow to a fraction of a millimetre.
This is the applied phase’s sharpest gotcha met again in a field it had nothing to do with. There it was a camera recovered from a picture with an unmodelled pixel aspect: the focal length came back 49.6% short, the spread across three independent estimates was exactly zero, and the worst bundle residual was px. Every alarm at its theoretical best, because a fit with fewer equations than unknowns produces a family and picks one.
A residual reports over-determination failing. It says nothing about under-determination. The number to look at is not the residual but the count of independent constraints against the count of unknowns, and the construction here has an exact version of that count: two posts is the minimum, and the third is what turns the answer into a test.
What it costs to be wrong about the ground
The construction assumes the shadows fall on one flat plane, and that assumption is doing real work: the foot-lines have to be lines in the ground plane for their intersection to be the light’s foot.
If the ground is not flat, the shadow tips are not where the flat-ground calculation puts them, and the two intersections drift apart — which shows up in the closure distance rather than in the pixel residual. That is a useful division of labour: the pixel residual catches a picture that was not lit by one light, and the closure catches a picture whose ground is not one plane. Two failure modes, two numbers, neither of which can mask the other.
What the recovery is worth
Two uses, and the second is the one that matters here.
Forensically, the light’s position in a photograph is a strong consistency constraint. An object composited into a scene brings its own lighting, and the geometry of a cast shadow is unforgiving in a way that its softness and colour are not: the shadow tip has to be on the line from the light through the top of the thing, and that is one linear condition per object with no adjustable parameters.
And as a check on the site’s own machinery, this is a round trip in a field that did not have one. The foundations field recovers the camera; the twoviews and manyviews fields recover cameras and structure together; the metrology field recovers lengths. The light field, until this rung, cast shadows and never got anything back out of them. A construction that only goes forwards is a construction whose errors accumulate silently, because nothing is ever compared with anything.
Why the construction needs no calibration
The recovery uses the camera’s horizon and nothing else about the camera, and that is worth dwelling on because most recoveries on this site need a focal length.
The reason is that both intersections are found in the picture. The lines through top-and-tip are drawn lines; their intersection is a drawn point; the same for the foot-and-tip lines. Neither step asks where the camera was or what lens it had. What the horizon supplies is the interpretation — a point below the horizon is a point of the ground plane in front of the camera, and a point on the horizon is a direction — and the horizon is itself findable in the picture from any two pairs of lines parallel on the ground.
So the image of the light and the image of its foot come out of a photograph with a straightedge, with no calibration at all. What needs the camera is only the last step: turning those two image points into metres, which requires knowing the ray each corresponds to, and that is the focal length’s job.
That division is worth keeping in mind because the first half is the half that catches inconsistency. Whether every post agrees about where the light is, and whether the light is at infinity or in the room, are both answered before any camera parameter is used.
Why the two intersections are the right two
There are several pairs of lines in the picture that could be intersected, and the construction picks two. It is worth saying why those two and not others, because the choice is what makes the answer the light rather than something else.
Top through tip gives the light itself. A shadow tip is where the ray from the light through the object’s top meets the ground, so the light, the top and the tip are collinear in space — and a projection preserves collinearity, so their images are collinear too. Two such lines, from two objects, share exactly one point in space: the light. Their images therefore share the light’s image.
Foot through tip gives the light’s foot. The foot and the tip are both on the ground, and so is the point directly below the light; the three are collinear because the vertical plane through the light and the object cuts the ground in that line. Two of those lines meet at the point below the light.
And every other pair gives nothing. Top through foot is the object itself, and two objects’ verticals meet at the vertical vanishing point — a real point of the picture, and a fact about the camera rather than about the light. Tip through tip is a line with no meaning at all.
So the construction is not a choice among several workable pairs. It is the only pair of families of lines in the picture that pass through the two points wanted, and the reason there are exactly two useful families is that a lamp has exactly two things worth locating: where it is, and where it is above.
The three ways a picture fails this test
Each of the construction’s numbers catches a different kind of wrong picture, and they cannot substitute for each other.
Two lamps. With more than one light source, different posts’ lines meet at different points, and the pixel residual against the fitted intersection grows. Two lamps at opposite ends of a room give a residual of hundreds of pixels; two nearly coincident ones give a small residual and are, correctly, nearly one lamp.
A ground that is not a plane. The foot-lines are only lines of the ground plane if the ground is a plane, so a floor with a step in it puts the shadow tips somewhere the flat calculation does not expect. That shows up in the closure distance between the lamp’s ray and the vertical through its foot, in metres, and not in the pixel residual.
And a shadow that was drawn rather than cast. The most common failure in constructed images, and it fails both tests at once — a hand-placed shadow tip has no reason to lie on the line from the light through the object’s top, so the picture is inconsistent before any of the arithmetic runs.
What the recovery would need to be a forensic tool
It is worth being honest about the gap between the geometry here and what a real photograph would demand, because the geometry is exact and the photograph is not.
The construction takes exact points. A real photograph supplies a shadow tip that is soft, several pixels wide, and ambiguous by more than that where the shadow runs onto grass or a kerb. The residual that reads 5.7e-14 px on a drawn figure would read a few pixels on a photograph, and the question would become whether a few pixels is consistent with one light — which needs an error model that this site does not build.
What survives the move to a real photograph is the structure: two intersections, a foot on or below the horizon, and a closure in metres. The numbers become uncertainties instead of certainties, and the three failure modes stay distinguishable, which is the part worth having.
The construction as a reader can use it
On a photograph with two or more vertical objects whose feet and shadow tips are visible, with a straightedge:
Draw the line from each object’s top through its shadow tip. Where they cross is the light in the picture. Draw the line from each foot through the same tip. Where those cross is the point under the light. If that second point is on the horizon, the light is the sun; if it is below, it is a lamp, and the vertical between the two crossings is the lamp’s height in the picture’s own units — which becomes metres as soon as anything in the picture has a known length, by the same cross-ratio the height from one photograph uses.
Two objects. And with one, the answer is a line, and a solver that reports a point is reporting its own preferences.
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.
- The shadow of a ball is a conic — both name centre of projection, horizon, point light, shadow vanishing point
- A frame is an interval — both name centre of projection, point light, residual
- A lens destroys the invariant — both name horizon, residual, single-view metrology
- Every row is a different camera — both name centre of projection, least-squares intersection, residual
- The centre a scroll does not have — both name centre of projection, least-squares intersection, residual
- Where parallel lines meet — both name horizon, least-squares intersection, residual
Named objects
A flat tag is an object no other essay names yet.
centre of projectiongauge freedomHorizonInverse projectionleast-squares intersectionPoint lightreconstruction ambiguityResidualshadow vanishing pointsingle-view metrology