[ptx] angular distance measure

Yili Zhao ylzhao at vip.sina.com
Mon Jan 5 02:46:07 GMT 2004


Pablo wrote:
>why don't use a spherical coordinate system? instead of 3d positions on
>a sphere. sqrt(theta^2+phi^2) would then measure the angular distance.
For angular distance measure, suppose two points p1(x1,y1) in image1 and
p2(x2,y2) in image2, first transfrom p1 and p2 into spherical coordinate,
and get s1(theta1,phi1) and s2(theta2,phi2), and from spherical to cartesian
coordinate transform formula (maybe some signs difference):
                         x = sin(theta) * sin(phi)
                         y = cos(phi)
                         z = -cos(theta) * sin(phi)
can get two vectors V1(x1,y1,z1) and V2(x2,y2,z2) in unit sphere (radius = 1).
>From vector scalar product of linear algebra, scalar product of V1 adn V2 is
                         V1 o V2 = |V1||V2|cos(beta)
                         V1 o V2 = x1*x2 + y1*y2 + z1*z2
where beta is the angle between V1 and V2, and |V1| and |V2| equal 1.
  Thus, the angle between V1 and V2 can be calculated by
                         beta = acos((V1oV2)/|V1||V2| = V1oV2
I think this is the angular distance. But, pt measures angular distance in radian length
                         angular distance = beta * pano.width / (2.0 * PI)
where pano.width / (2.0 * PI) is the radius of the sphere, and the radian length formula is
                         radian length = central angle * radius
You can validate this in adjust.c, line 977, 1298 and filter.h, line 294.

Yili    






More information about the ptX mailing list