The assignment here was to write a program that takes 2 or more images
as input, and via user entered
point correspondences, creates a panoramic view combining all the
images. The user can declare as
many point correspondences as desired, with a minimum of four.
For solving for the homography (a projective map that takes one image
to the plane of another), I
implemented both the normalized DLT algorithm (using A'*A, to allow
for limitless correspondences)
and the Gold Standard algorithm with the Gold Standard error.
Once the homography is computed, I first place the reference image
on the new image space. Then,
I use back projection to get the warped image into the new space.
I found that the normalized DLT worked as well as the Gold Standard
algorithm (or at least my
implementation of it) for ten or fewer point correspondences.
Also, it was frustrating to get the
GS algorithm working at all. My reprojection errors are always
close to zero, which says to me
that the code isn't optimizing at all.
images to register.
the four images registered.
Once the homography is computed, the process is like texture mapping,
in that the forward projection
is not onto a whole bounding box. Grids where no colors projected
to are common. To solve for that,
most use a backward projection method which, though avoiding this
problem, can lead to unintended
distortions. My method for avoid the grids (as seen below)
is to used a box filtering method I found
in Don Mitchell's ray tracing paper (more information here).
Basically, if a pixel is black, the filter
makes it a combination of nearby (down and right) pixels.
Peroforming the filter twice clears up most
of the problems. Of course it is simple to implement the backwards
projection, but I found the results
were not noticeably better.
normalized DLT.
uncorrected.
corrected
close up of the correction.