[ptx] automatch: another attempt at semi-automatic panorama stitching

JD Smith jdsmith at as.arizona.edu
Mon Jan 5 01:17:30 GMT 2004


On Sun, 2004-01-04 at 14:45, Pablo d'Angelo wrote:
> Hi Bruno,
> 
> > (BTW hugin still detects all my photographs as 179 degrees fov)
> 
> hmm, still have to check that sometime.
> 
> > Not at all, the feature-points are mapped to a spherical surface in
> > 3d space before being analysed, but this is necessary even if the
> > eventual result is a rectilinear or cylindrical panorama.
> 
> Hmm, 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, I think.

Actually, I think it's more like:

sin(angular_sep/2)=sqrt[sin((phi_1-phi_2)/2)^2+cos(phi_1)*cos(phi_2)*sin((theta_1-theta_2)/2)^2]

which is a round-off resistant formulation suggested by Sinnott, called
the Haversine formulation.  Here's the suggested pseudo-code:

dlon = lon2 - lon1 
dlat = lat2 - lat1 
a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2 
c = 2 * arcsin(min(1,sqrt(a)))

You can read all about it at:

http://www.census.gov/cgi-bin/geo/gisfaq?Q5.1

For very small separations, your version is equivalent, but that won't
hold for most.  Using the straight-line (Euclidean) distance will also
become an increasingly bad approximation for larger separations, just as
the straight-line distance between two cities is not their true
separation.  The true distance and the angular separation are just
related by the radius of the sphere, which can be taken to be 1 without
loss of generality, i.e. they're interchangeable for our purposes.

You might of course make the sensible comment: "So what, I don't care
that the straight-line distance isn't the correct distance... it is just
as valid a sorting key as the true distance: any pair of points with a
matching true distance will have a matching straight-line distance."  
And you'd be mostly correct.  If d is the straight-line distance, and A
is the angular separation:

sin(A/2)=d/2

This is one-to-one in a hemisphere, but separations larger than a
hemisphere are double valued.  This probably isn't really a problem for
stitching anything hugin will come across, so it's probably OK.

JD



More information about the ptX mailing list