I have the following problem: I am taking free-handedly photographs from the same scene during e.g. hiking, because sometimes I don't want to lug around a tripod. The goal is e.g. to create later on with Mathematica an image with an artificial long term exposure (see here) or artificial "quasi"-aperture (see here). For that I create with Mma a binary Mask for the rigid regions
BGMask and use this mask to find with
ImageCorrespondingPoints the matching points between the images. (There is also
ImageAlign but unfortunately it doesn't support a Mask, and I need that mask to get keypoints from rigid structures in the photographed scene.) After that I calculate the Transformation necessary to get the one Image transformed from one to the other by
FindGeometricTransform. In this step I specify manually the expected transformation class, e.g. in case if the foreground or only the background of the scene is static. After that I export the image. The relevant code I'm using is given here:
RMA = ImageCorrespondingPoints[Image1, Image2, Masking -> BGMask, MaxFeatures -> 15]; tr = FindGeometricTransform[RMA[], RMA[], TransformationClass -> "Perspective"]; EntwackeltesBild = ImagePerspectiveTransformation[Image2, tr[], DataRange -> Full, PlotRange -> Full]; Export[Name <> " Entwackelt.jpg", Show[EntwackeltesBild, ImageSize -> ImageDimensions[EntwackeltesBild][]], "CompressionLevel" -> 0];
While this method works well enough as you can see in the above image links, it takes unfortunately 1h to deshake an image, due to their size which is 21 MPixel. Given that sometimes I need to deshake up to 100 images this results in ~4 day long computations, for just a single photographic scene.
Thus my question, whether there is an efficient way to speed up the calculations besides using parallel-computing capabilities of Mma? Compiling isn't obviously intended for image processing functions (see SE: Mma compilable functions) and
ImageCorrespondingPoints doesn't accept any
But of course there are 3 key components
ImagePerspectiveTransformation that might be slow, but somehow, as I am using only up to 15 key points to calculate the necessary transformation, I don't believe that
FindGeometricTransform is the problem.
Edit 1: I will add later the corresponding time durations of each operation, but currently I am waiting for the images to get calculated...
Edit 2: I just saw on Mma-help that
ImageCorrespondingPoints can take in the newest version also Options for Methods such as "AKAZE" "BRISK" or "ORB" and so on and obviously there is a lot of papers investigated the performance and stability of these methods (e.g. here (IEEE) here (PDF) or here (PDF)). Unfortunately, on my machine I got only Mathematica 10.2 so I can't test those features. I don't know where to look up which kind of algorithm Mma is using in my version.