I needed to calculate the dimensions of some historical buildings for which I only had photographs. A WAG is acceptable as I am only making rough models of the buildings. However, I did want to know how to do it with more accuracy and so looked around for an answer. SketchUp has a facility to do this and it is remarkably easy to use. Unfortunately, the rest of SketchUp is not as it is a technical tool that expects a trained user. So I kept looking around and finally found a clear explanation of the algorithm to use.
The key to understanding the algorithm is that you make right angled triangles in a plane perpendicular to a known height. For the rest of the explanation I am going to quote the author and present his diagram:
"Starting from the corner C of the building, draw a horizontal line on the image plane. This line represents a horizontal line in space, parallel to the image plane and at the same distance (and so the same length scale) as the vertical edge of the building above C, so you can measure lengths along it. It intersects the line AB, along the other side of the building, at B. (B is not necessarily the opposite corner of the building; this particular perspective view just happens to have the corners drawn about the same distance from the central corner A.) Now triangle ABC, in space, is a right triangle (assuming the corner A of the building is a right angle). You know the length BC of the hypotenuse (by measuring with a ruler calibrated to the vertical edge C, as I've shown with the green 45-45-90 triangle--just coincidentally, this is about the same height as the building for this drawing) and the length AC of one leg, so you can find the true length AB of the other leg by AB2=BC2-AC2.
"All this assumes that your camera isn't imposing too much distortion on the image. It would probably be a good idea to test this (take a picture of an object of known dimensions at similar lens zoom settings and with similar perspective) to see if this provides accuracy sufficient for your purposes."