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[[1]], RMA[[2]], TransformationClass -> "Perspective"];
EntwackeltesBild = ImagePerspectiveTransformation[Image2, tr[[2]], DataRange -> Full,
PlotRange -> Full];
Export[Name <> " Entwackelt.jpg", Show[EntwackeltesBild,
ImageSize -> ImageDimensions[EntwackeltesBild][[1]]],
"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 Method-Options...
But of course there are 3 key components ImageCorrespondingPoints, FindGeometricTransform and 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.
Edit 3: Just to show what kind of images I am talking about (downsampled):
and


![partitioned image with indexes [[2,2]]](../../images/b62557622ec9e76e855a93ce33ca2f47.webp)

ImageCorrespondingPointshas also an optionTransformationClass. Seemingly, you do something redudantly here... – Henrik Schumacher Nov 18 '17 at 16:22ImageCorrespondingPointsby default seems to useImageKeyPointsand"RANSAC"form ofFindGeometricTransform. Both are apt to be slow. In any case, are there services or libraries out there that can do this faster on images of your size? If not, I'm not sure there's really any reason this procedure should be fast. I think Mathematica's doing as much as is possible at the C level anyway. – b3m2a1 Nov 19 '17 at 19:47