# FindGeometricTransform

Posted 8 years ago
4045 Views
|
2 Replies
|
1 Total Likes
|
 Dear CommunityI tried to figured out the image angle and translation compared to an origin resp. reference image but the function FindGeometricTransform does not work to my comprehension. I tested it with two simple images, which are slightly different resp. shifted, see attachment. To transform the shifted image back to the reference image I used the ImagePerspectiveTransformation function, but It gives me only back a black image. Did anyone know what is wrong with the two pictures resp. with my application of FindGeometricTransform?Many thanks.Best regardsgeorg Attachments:
2 Replies
Sort By:
Posted 8 years ago
 Dear HenrikA late - many thanks - for your explanation!Best regards Georg
Posted 8 years ago
 Hallo Joerg or Georg,the arguments of FindGeometricTransform are lists of points, not images. A good function to find those points is ImageCorrespondingPoints. But for your example images this works extraordinarily bad: ClearAll["Global*"] SetDirectory[NotebookDirectory[]]; {i1, i2} = Import /@ {"foto1.png", "foto2.png"}; MapThread[ HighlightImage[#1, #2, "HighlightColor" -> Red, Method -> {"DiskMarkers", 5}] &, {{i1, i2}, ImageCorrespondingPoints[i1, i2, "TransformationClass" -> "Similarity"]}] gives:I thought the first and obvious problem here might be the different dimensionality of the images: ImageDimensions /@ {i1, i2} (* Out: {{150,204},{137,300}} *) I tried to correct this by padding: {dDimX, dDimY} = (#1 - #2) & @@ (ImageDimensions /@ {i1, i2}); bgColor = RGBColor@ImageData[i1][[1, 1]]; {in1, in2} = {If[dDimX > 0, ImagePad[i2, {{0, dDimX}, {0, 0}}, bgColor], ImagePad[i1, {{0, -dDimX}, {0, 0}}, bgColor]], If[dDimY > 0, ImagePad[i2, {{0, 0}, {0, dDimY}}, bgColor], ImagePad[i1, {{0, 0}, {0, -dDimY}}, bgColor]]} with the result: ImageDimensions /@ {in1, in2} (* Out: {{150,300},{150,300}} *) Now it seems to work somehow, but only for the most simple case ("TransformationClass" -> "Translation"): MapThread[ HighlightImage[#1, #2, "HighlightColor" -> Red, Method -> {"DiskMarkers", 5}] &, {{in1, in2}, ImageCorrespondingPoints[in1, in2, "TransformationClass" -> "Translation"]}] `which gives:Meanwhile I came to the conclusion that the main problem is the simplicity (or periodicity) of these test images. With "real" images it ought to work much better.I hope this helps a bit!Henrik