I would like to stitch together a pair of images. For example:
imgOriginal=ImageTake[ExampleData[{"TestImage","Aerial"}],{1,-2},{2,-1}];
img1=ImageTake[imgOriginal,{0,160}];
img2=ImageTake[imgOriginal,{-160,-1}];
ImageAlign
successfully registers these, but of course it only returns the part of img2
that overlaps with img1
.
img2a = ImageAlign[img1, img2];
ImageCompose[img1, {Colorize[img2a], 0.25}]
To stitch the images together, I need to keep the entire area of img2
. I can derive a transformation to align the two images, then apply it to img2
:
ImageTransformation[img2,FindGeometricTransform[img2,img1,TransformationClass->"Rigid"][[2]],DataRange->Full]
But using PlotRange->All
to show the entire image area appears to effectively un-transform the image so they no longer align.
img2it=ImageTransformation[img2,FindGeometricTransform[img2,img1,TransformationClass->"Rigid"][[2]],DataRange->Full,PlotRange->All]
ImageCompose[img1,{Colorize[img2it],0.25}]
How can I retain the entire non-overlapping area of both images when registering them?