问题
I have a very high number of small images (360x192), taken in sequence as screenshots from a DOS 2D computer game. They have decent overlap and i'd like to stitch them together into one big composite. Due to their very nature each subsequent image will fit pixel-perfect over the next or previous one. As such no rotation, stretching or distortion is required OR desired.
There is a lot of software out there to stitch together photo panoramas. But sadly all of them apply some distortion, even when they're explicitly instructed not to do so.
Is there software that will try to do pixel-perfect stitching?
回答1:
Mathematica 8 features functions to do that:
ImageAlign[img1, img2, "Transformation" -> "Translation"]
FindGeometricTransform[img1, img2, "Transformation" -> "Translation"]
By setting the option "Transformation" to "Translation" you are guaranteed that the result transformation will not have any of the "distortions" you are mentioning.
More examples in the documentation:
http://reference.wolfram.com/mathematica/ref/ImageAlign.html
http://reference.wolfram.com/mathematica/ref/FindGeometricTransform.html
I know one can link Mathematica to perl, but I have not tried it yet.
EDIT: Using the link you sent, I came up with the following. The only problem is that you need to specify in advance the size of the output---NB I tried only the first 10 images.
directory = "~/Downloads/done/";
files = FileNames["*.bmp", directory];
canvas = ImagePad[Import[files[[1]]], {{100, 100}, {500, 100}}, Transparent];
Do[
i = Import[f];
fun = FindGeometricTransform[canvas, i, "Transformation" -> "Translation"];
If[Head@fun === FindGeometricTransform,
Continue[]
];
canvas = ImageCompose[
canvas,
ImagePerspectiveTransformation[i, fun[[2]], DataRange -> Full, PlotRange -> Transpose[{{0, 0}, ImageDimensions[canvas]}], Padding -> Transparent],
{1, 1, -1}],
{f, files[[;; 10]]}]
回答2:
One of the definitive libraries to do panorama stitching is Panorama Tools. You can either port or call from Perl.
Note that your specification is at odds. Unless you images are 100% rectilinear (i.e., taken 1:1 by an imager the same size as the image) you MUST compensate for the lens distortion. To accurately stitch photos together (pixel by pixel) the image needs compensating distortion.
来源:https://stackoverflow.com/questions/9104649/is-there-software-to-stitch-together-a-high-number-of-small-digital-images-witho