I agree that your test, where you have photographed the same subject –
a properly flat, rectangular sheet – from two very different angles and
tried to align one with the other, does indeed reveal a case where the
optimiser fails.
In base.pto you sought to make the alignment by leaving image 0, the
base image unchanged and optimising y, p, r, X, Y and Z for the image 1,
the image that is to be aligned with the other. It didn't work. I agree
that it should have, but I tried introducing the parameters in various
different orders and did no better than you. The errors in pixels
(mean/max) remained around 49/188 (after calculating the optimum size,
as, for consistency, I have done for the other examples). The X, Y
and Z parameters seem to have worked well, but the angular alignment was
still well adrift. Maybe the optimiser couldn't cope here with the very
large difference in the alignments of the two images.
On the other hand, simply adding the Plane Yaw and Pitch parameters into
the optimisation of image 1 yields a good result, with error figures at
optimum size of 1.5/3.1 - for your SQ.pto, the equivalent figures at
optimum size are 1.5/5.8. And the alignment of the superimposed image
now matches that of the underlying one. The optimiser has recovered its
mojo. Obviously this is not what the Plane parameters are designed for
and I am not at all clear how the angle values are distributed between
the normal and Plane yaw and pitch parameters. It may simply be that,
with more parameters to play with, the optimiser does a better job.
That may also be why your example YPR.pto, which adds optimisation of
those parameters for the base image 0 also works. It yields error
figures at optimum size of 1.5/3.2. Of course the whole image is
rotated, but that is not surprising, since the roll is allowed to vary
for both images. It can be prevented by leaving the roll of image 0 at
90 deg and non-optimisable. The error figure is hardly distinguishable,
but, remarkably, the yaw and pitch values that the optimiser settles on
are such that the image of the sheet is now nearly rectangular, as the
attached screen-shot shows. It certainly seems that the optimiser works
best when the area of interest is, or can be made, at least roughly
rectangular. That probably explains why it helps to add horizontal and
vertical control points at an early stage, as I tend to do anyway when
stitching maps, .
One warning I should give is that while using Plane Pitch and Yaw
parameters can improve the error figures and eliminate some stitching
flaws it can also, I have found, introduce some distortion of the
overall image. It's probably only worth doing if there are problems and
it may be possible to restrict it to individual images.
Roger Broadie