Search code examples
imageopencvimage-processingaffinetransform

Affine Transformation: Picking points


I'm looking at OpenCV's tutorial on Geometric Transformations of Images, and under Affine Transformation, it states:

To find the transformation matrix, we need three points from input image and their corresponding locations in output image.

How will you know or determine their corresponding locations in the output image?


Solution

  • When you apply such a transformation, you want to find 3 points in the input image, and the exact same three points in the target image. See an example here with multiple points, but three are enough for an affine transformation. Then the registration is going to modify/twist the input image in order to register/align the triplets of points. So the triplet of points in input image is going to overlay the triplet of points in the target image.

    The best algorithm I know for affine registration, including automatic interest point detection and matching, is the TurboReg.

    An other solution would be to use the SURF or SIFT algorithms to detect and match the points, then apply the affine transformation.