## Sunday, November 8, 2015

### One-point perspective for orthogonal box

There is an image Fig 3.6 in a book "Viewpoints"  which explains one-point perspective. An observer looks at a box (B1,B2,B3,B4) and the box projects to an image plane containing points V1 and V2. It is a one-point perspective because the close side of the box (B1,B4) is parallel to the image plane. The observer looks in OZ direction and OZ is parallel to (B4,B3). Hence V1 is the vanishing point for line (B4,B3). (O,V2) is parallel to the box's diagonal and hence V2 is the vanishing point for the line (B4,B2).

When an image is shot with a camera, the camera is the observer.
In the actual set up the camera is placed slightly above the box so the box appears slightly below of the image horizon's line (V1,V2).
In this set up the shaded triangles are similar and hence a/d=A/D. If we know the dimensions A and D of the box and can measure the size a=(V1,V2) in the image, we can determine the distance 'd' from observer to the image, or focus distance in the scenario with a camera.
For my camera and a box with dimensions (A=73mm, D=175mm) I've got d=a*(D/A)=363pix(175mm/73mm)=870pix
The OpenCV camera calibration routines give for my camera with resolution=(1280,720) the focus distance fx=981.73. I think the error=981-870=111pix is due to inaccurate placement of the camera which have to be parallel to the front of the box.
The other scenario is when we record a video of a box, which moves parallel to OX or OZ directions, without rotations. Then the d=const because camera is the same. Hence the (V1,V2) must be constant too. I should say it is somewhat nonintuitive. But it turns out to be true. In the video below, the box moves parallel to OZ and the (V1,V2) is more or less fixed.

The (V1,V2) distance oscillates around value of 360 pixels.

To make the measurment more precise, one need to recognize the corners of the box more accurately. Second, one has to accurately place the camera, so that the image is parallel to the front of the box
 "Viewpoints. Mathematical Perspective and Fractal Geometry in Art", Marc Frantz, 2011.
Source code
20151108_1ppersp_orthobox.zip
(Dev env: Win8 x64, Python 2.7.8)