2
$\begingroup$

I have to images (img1, img2) which should be overlapped.

The best solution which I find is the following:

{merit, trans} = FindGeometricTransform[img2, img1, TransformationClass -> "Similarity"]

imgt = ImageTransformation[img2, trans, DataRange -> Full];

overlapped = Blend[{ColorNegate[img1], imgt}, {0.5, 0.5}]    

ImageAssemble[{img1, img2, overlapped}]

enter image description here

In the lower part of the overlapped image a small vertical misalignment of the horizontal lines is seen.

How can the adjustment be optimized/improved?

$\endgroup$
1
  • $\begingroup$ Try adding Method -> {"ImageAlign", {"Keypoints", "BRISK"}} or some other variant of Keypoints related methods, like "AKAZE" or "KAZE" or "ORB" $\endgroup$
    – UDB
    Aug 9, 2017 at 17:50

1 Answer 1

3
$\begingroup$

Mathematica 11.1 introduces keypoints-based registration methods. As your example exhbits patterns with relatively large homogeneous regions, a global intensity difference based target function might lead to suboptimal results as in your attempt. Try using keypoints, e.g. binary robust invariant scalable keypoints (BRISK):

img1 = Import@"https://i.imgur.com/RJEFiuO.png";
img2 = Import@"https://i.imgur.com/J79TrG9.png";
{merit, trans} = FindGeometricTransform[img2, img1, 
  Method -> {"ImageAlign", {"Keypoints", "BRISK"}}, 
  TransformationClass -> "Similarity"];
imgt = ImageTransformation[img2, trans, DataRange -> Full];
overlapped = Blend[{ColorNegate[img1], imgt}, {0.5, 0.5}];
ImageAssemble[{img1, img2, imgt, overlapped}]

assembled resulting images

You might want to see the locations of the corresponding keypoints used inside FindGeometricTransform (demonstrated using code given in the Neat Examples section of ImageCorrespondingPoints):

matches = ImageCorrespondingPoints[img1, img2, Method -> "BRISK", 
 TransformationClass -> "Similarity"];
ImageAssemble[{MapThread[Show[#1, Graphics[{Yellow, 
 MapIndexed[Inset[#2[[1]], #1] & , #2]}]] &, {{img1, img2}, matches}]}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.