Game Development Reference
In-Depth Information
In this view, the left and back sides of the box have been removed so
you can see the inside. Notice that the image projected onto the back of
the box is inverted. This is because the rays of light (the projectors) cross
as they meet at the pinhole (the center of projection).
Let's examine the geometry behind the perspective projection of a pin-
hole camera. Consider a 3D coordinate space with the origin at the pinhole,
the z-axis perpendicular to the projection plane, and the x- and y-axes par-
allel to the plane of projection, as shown in Figure 6.7.
Figure 6.7
A projection plane parallel
to the xy -plane
Let's see if we can't compute, for an arbitrary point p , the 3D coordi-
nates of p
, which is p projected through the pinhole onto the projection
plane. First, we need to know the distance from the pinhole to the projec-
tion plane. We assign this distance to the variable d. Thus, the plane is
defined by the equation z = −d. Now let's view things from the side and
solve for y (see Figure 6.8) .
By similar triangles, we can see that
−p
y
= p y
z
−dp y
z
=⇒
p
y =
.
d
Notice that since a pinhole camera flips the image upside down, the signs
of p y and p
y are opposite. The value of p
x is computed in a similar manner:
−dp x
z
p
x =
.
Search WWH ::




Custom Search