1
$\begingroup$

The following question uses the answers taken from here.

I have two images which should be adjusted by image correlation using FindGeometricTransform.

The desired overlapped result should be the "overlapped image".

enter image description here

To do that I am using the following code:

img1 = Import["http://i.imgur.com/flgbobm.png"];

img2 = Import["http://i.imgur.com/ajXibPe.png"];

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

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

Blend[{ColorNegate[img1], imgt}, {0.3, 1}]

enter image description here

The results is not exactly what I want.

  • First, the small disk is not centered inside of the larger disk.

  • Second, it has not the same size (I assume this should be obtained since TransformationClass -> "Similarity"considers translation, rotation, and scaling).

  • Third, the resulting image is only showing some overlapped squared region and not the whole scaled images.

How could this be solved?

$\endgroup$

1 Answer 1

1
$\begingroup$

I got your disks to align by filtering them into doughnuts.

{fi1, fi2} = 
 ImageAdjust[
    DistanceTransform[
     ImageAdjust[
      GradientFilter[DistanceTransform[#], 4], {0, 0, 1}, {0.5, 1}]]
    ] & /@ {img1, img2}

Filtered disk images converted to doughnuts

{merit, trans} = FindGeometricTransform[fi2, fi1];
imgt = ImageTransformation[img2, trans, DataRange -> Full];
Image[ImageDifference @@ Binarize /@ {img1, imgt}]

Difference of aligned images

The above difference image shows FindGeometricTransform found a better transform. However, I don't know how applicable this technique is to other images.

As for producing a union of the two images, there may be help in the Mathematica documentation for FindGeometricTransform under Applications (text starts "A basic image-stitching method" and uses images of a shoreline.)

$\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.