Vous êtes sur la page 1sur 3

Inferring depth cues from a changing viewing angle

Sarah Constantin December 13, 2011

We consider the problem of two skew lines in 3-d space. Using orthographic projection from some viewing angle gives a 2d projection of the scene, in which the two lines appear to intersect. The goal is to determine, from the rates of change in the location of the apparent intersection point as the viewing angle varies, the actual depth dierence between the two lines.

Formulating the Problem


(ax t + cx , ay t + cy , az t + cz ) (bx t + dx , by t + dy , bz t + dz )

We write the two lines as

In our case, we are concerned with two skew lines at dierent depths, which we can rewrite as A = (ax t + cx , ay t + cy , 0) and B = (bx t + dx , by t + dy , dz ) We want to deduce dz . The viewing angle is a matrix derived from 1 0 0 cos(y ) 0 cos(x ) sin(x ) 0 V = 0 sin(x ) cos(x ) sin(y ) the Euler angles x , y , z : 0 sin(y ) cos(z ) sin(z ) 0 1 0 sin(z ) cos(z ) 0 0 cos(y ) 0 0 1

For any given (x , y , z ), the corresponding viewing matrix V (x , y , z ) applied to the pair of lines gives a two-dimensional image in which the lines appear to cross. Call the point of apparent intersection P(A, B, V). We attempt to solve for dz , the distance between the lines (the depth dierence) in terms of the derivatives of the point of intersection with respect to the viewing angle: x P (A, B, V ) and so on.

First we solve for the location of the apparent intersection, given V and the coecients of A and B; we want to know the value of t. V (ax t + cx , ay t + cy , 0) = V (bx t + dx , by t + dy , dz) t= This gives us t= Now we compute dV (P ) dV (P ) dV (P ) , , dx dy dz , Each of these is a pair of expressions, in fact: ( dV (P ) x , dV (P ) y ), for instance. dx dx Computing this explicitly, in the case of dierentiation with respect to x , we get that the rst coordinate is cos(x ) cos(y )ax (dy cy ) cos(y ) cos(z )(ax bx ) cos x (ay by) sin x cos(z ) cos(y )(dx cx ) cos(y ) sin(x )(dy cy ) + sin() dz cos(z ) cos(y )(ax bx ) cos(x ) sin(x )(ay by ) V (dx cx , dy cy , dz) V (ax bx , ay by , 0)

ax (cos2 x (ay by ) + (ay by ) sin2 x )(cos y cos z (dx cx ) cosy sin x (dy cy ) + dz sin y ) (cos y cos z (ax bx ) cos x sin x (ay by ))2 = cos y cos z (dx cx ) cos y sin x (dy cy ) + dz sin y

Denote and = cos y cos z (ax bx ) cos x sin x (ay by ) So the rst coordinate is ax [ cos x cos y (dy cy ) (ay by )(1 2 cos2 x )/2 ]

Since were solving for dz , and the only component of this expression containing dz is , we have to solve for . Denote by Dx the (scalar) expression cos x cos y (dy cy ) (ay by )(1 2 cos2 x )/2

which is the rst component of the derivative divided by ax , or equivalently the second component divided by ay . Likewise, Dz = cos y sin z (dx cx ) + cos y sin z (ax bx )/2 2

= Dx

cos x cos y (dy cy ) 2 (ay by )(1 2 cos2 x ) (ay by )(1 2 cos2 x )

dz = 1/ sin y cos y cos z (dx cx ) cos y sin x (dy cy ) = 1/ sin y (Dx cos x cos y (dy cy ) 2 + )cos y cos z (dx cx )cos y sin x (dy cy ) 2 ) (a b )(1 2 cos2 ) (ay by )(1 2 cos x y y x

Vous aimerez peut-être aussi