WOLFRAM

ImageAlign[ref,image]

returns a version of image that is aligned with the reference image ref.

ImageAlign[ref,{image1,,imagen}]

gives the result of aligning each of the imagei with the reference image ref.

ImageAlign[{image1,,imagen}]

uses image1 as the reference image.

Details and Options

  • ImageAlign[image1,image2] finds a transformation of image2 that registers it with image1 and returns the result of applying this transformation to image2.
  • ImageAlign works with arbitrary 2D and 3D images.
  • Resulting images have the same dimensions as the reference image.
  • Use FindGeometricTransform to compute the geometric transformation used for alignments.
  • The following options can be specified:
  • Background Automaticbackground value
    Method Automaticalignment method to use
    TransformationClass Automaticgeometrical relation between images
  • Possible settings for the Method option are:
  • Automaticautomatically choose a suitable method
    "Keypoints"use corresponding keypoints
    {"Keypoints",method}use an ImageCorrespondingPoints method
    "MeanSquareGradientDescent"minimize the mean square distance of corresponding pixels
    "Fourier"Fourier-based registration
    "FourierBlurInvariant"blur invariant Fourier-based registration
  • With the default setting TransformationClass->Automatic, ImageAlign attempts to find the simplest possible transformation.
  • Possible transformations in order of increasing complexity are:
  • "Translation"translation only
    "Rigid"translation and rotation
    "Similarity"translation, rotation, and scaling
    "Affine"linear transformation and translation
    "Perspective"linear fractional transformation

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Align a part of an image with the full image:

Out[1]=1

Align two 3D volumes:

Out[1]=1

Scope  (2)Survey of the scope of standard use cases

Align a list of three images to a reference image:

Out[2]=2

Align a list of three images, using the first image as the reference:

Out[1]=1

Three images are returned:

Out[2]=2

Options  (11)Common values & functionality for each option

Background  (1)

By default, a transparent background is used:

Out[1]=1

Specify a different background color:

Out[2]=2

Method  (5)

By default, ImageAlign uses an automatic combination of methods and initializations:

Out[1]=1

The "Keypoints" method works well with natural 2D photos:

Out[2]=2

Use "KAZE" keypoints:

Out[3]=3

Use all keypoints detected by multiple methods:

Out[4]=4

The "MeanSquareGradientDescent" method uses dense distances between images:

Out[1]=1

This method typically needs a large initial overlap between images:

Out[2]=2

The "Fourier" method can align images even with a small overlap:

Out[2]=2
Out[3]=3

Use the "FourierBlurInvariant" method in the presence of noise and motion blur:

Out[2]=2
Out[3]=3

TransformationClass  (5)

Restrict the transformation to only translation:

Out[2]=2

"Rigid" transformation allows for rotations in addition to translations:

Out[1]=1

"Similarity" transforms allow for translation, rotation, and scaling:

Out[1]=1

Allow any affine transformation:

Out[1]=1

Perspective transformation:

Out[1]=1

Applications  (4)Sample problems that can be solved with this function

Align an image with its mirror image:

Out[1]=1

Overlay the aligned images:

Out[2]=2

Align two different images of the same object:

Out[1]=1

Align images before performing focus stacking:

Out[2]=2

Perform focus stacking:

Out[3]=3

Compare with the stacking without alignment:

Out[4]=4

Properties & Relations  (2)Properties of the function, and connections to other functions

For aligning images using a specific set of corresponding points, use FindGeometricTransform:

Out[3]=3

Transform the image with ImagePerspectiveTransformation:

Out[4]=4

Use FindGeometricTransform to find the geometric transformation that aligns images:

Out[2]=2

Stitch images together by transforming one and composing on top of the other one:

Out[3]=3
Wolfram Research (2010), ImageAlign, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageAlign.html (updated 2021).
Wolfram Research (2010), ImageAlign, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageAlign.html (updated 2021).

Text

Wolfram Research (2010), ImageAlign, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageAlign.html (updated 2021).

Wolfram Research (2010), ImageAlign, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageAlign.html (updated 2021).

CMS

Wolfram Language. 2010. "ImageAlign." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ImageAlign.html.

Wolfram Language. 2010. "ImageAlign." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ImageAlign.html.

APA

Wolfram Language. (2010). ImageAlign. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageAlign.html

Wolfram Language. (2010). ImageAlign. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageAlign.html

BibTeX

@misc{reference.wolfram_2025_imagealign, author="Wolfram Research", title="{ImageAlign}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ImageAlign.html}", note=[Accessed: 08-July-2025 ]}

@misc{reference.wolfram_2025_imagealign, author="Wolfram Research", title="{ImageAlign}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ImageAlign.html}", note=[Accessed: 08-July-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_imagealign, organization={Wolfram Research}, title={ImageAlign}, year={2021}, url={https://reference.wolfram.com/language/ref/ImageAlign.html}, note=[Accessed: 08-July-2025 ]}

@online{reference.wolfram_2025_imagealign, organization={Wolfram Research}, title={ImageAlign}, year={2021}, url={https://reference.wolfram.com/language/ref/ImageAlign.html}, note=[Accessed: 08-July-2025 ]}