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

Bruno Postle bruno at postle.net
Sun Jan 4 19:29:59 GMT 2004


On Fri 02-Jan-2004 at 06:39:07 +0000, Bruno Postle wrote:
> 
> If klt can identify 100 or so likely features in any one photo, we
> only need a handful of them to be common between any pair of
> pictures.
> 
> Matching might proceed like this:

[snip inaccurate speculation from Bruno]

> All this assumes that klt is capable of matching at least a small
> proportion of features consistently between two photos.

The good news is that the feature identification part of KLT is very
fast and tends to pick up mostly the same features regardless of
image orientation.

So I've written a proof-of-concept tool that implements my "angular
distance" technique of automatically detecting control points:

    http://bugbear.blackfish.org.uk/~bruno/distance/control-points.jpg

The picture shows 31 control points, maximum error 2.2 pixels, with
no misplaced control-points (in fact the technique doesn't seem to
be capable of getting control-points wrong) - Notice that the two
photos are handheld and very badly aligned :-).

The technique is purely computational and doesn't involve any image
matching whatsoever, I suspect that larger images will actually give
faster results.

A bit more detail...

I've hacked one of the KLT examples so that it stops after the
feature-point identification stage and doesn't try and do the clever
tracking stuff:

    http://bugbear.blackfish.org.uk/~bruno/distance/example1.c

Now it just outputs a text file listing all the feature-points:

    http://bugbear.blackfish.org.uk/~bruno/distance/a/output.txt

..and a pretty picture showing their locations:

    http://bugbear.blackfish.org.uk/~bruno/distance/a/output.jpg

These text files form the input for the main program which tries to
find matching geometrical patterns of points.  This tool is written
in perl:

    http://bugbear.blackfish.org.uk/~bruno/distance/automatch.pl

It's very slow (10 minutes), but it is exceptionally badly optimised
and perl is a terrible medium for this kind of thing; so I would
expect a properly written C program by somebody with some actual
computer science training to take a fraction of a second to do the
same job.

It outputs a hugin compatible script file:

    http://bugbear.blackfish.org.uk/~bruno/distance/foo.pto

Currently the program is hard-coded with the parameters of my
camera, so if you want to play with it you will need to do the
following:

-  Lens correct your images first, it needs rectilinear photos, they
   also need to be converted to pgm format.

-  Locate the hfov, width and height parameters and change them to
   suit.

-  Look in the source for the command-line parameters.

The perl source contains a fair bit of documentation, so it _might_
be comprehensible.

-- 
Bruno


More information about the ptX mailing list