reference
API Reference › DIC Preprocess
dic_preprocess.analysisRun.autoAlignMovingToReference
Estimate and apply an integer translation.
Syntax
[alignedImage, transform, method] = ...
dic_preprocess.analysisRun.autoAlignMovingToReference( ...
referenceImage, movingImage)Inputs
referenceImage- Numeric grayscale or RGB reference image. Its first two dimensions define the output canvas and correlation size.
movingImage- Numeric grayscale or RGB image to translate.
Outputs
alignedImage- Original movingImage translated onto the reference canvas, with linear interpolation and zero fill.
tformRigid- Three-by-three row-vector homogeneous translation transform, shown as transform in the usage syntax.
method- Character vector identifying the fixed phase-correlation method.
Description
Each image is converted to normalized grayscale independently. For shift estimation only, moving grayscale data is resized to the reference size by nearest-neighbor sampling. Phase correlation returns a whole-pixel circular shift. Rotation, scale, deformation, repeated texture, and large nonoverlap can produce a poor fit.
Failure Behavior
The function does not assign a confidence score or reject an ambiguous phase-correlation peak; low-texture or repeated-pattern inputs can return a numerically valid but poor translation. Empty arrays, unsupported image classes, or invalid channel shapes propagate image conversion/interpolation errors.
Example
reference = zeros(16); reference(5:8, 6:9) = 1;
moving = circshift(reference, [2 -3]);
[aligned, transform, method] = ...
dic_preprocess.analysisRun.autoAlignMovingToReference( ...
reference, moving);
assert(isequal(size(aligned), size(reference)))
assert(isequal(size(transform), [3 3]) && contains(method, "phase-correlation"))Related APIs
dic_preprocess.analysisRun.alignMovingToReference— Fit and apply a rigid transform from matched points.dic_preprocess.analysisRun.applyRigidTransform— Resample a moving image onto a reference-sized canvas.dic_preprocess.analysisRun.cropImage— Crop an image using base-MATLAB indexing.dic_preprocess.analysisRun.makeFalseColorOverlay— Build a red/green registration preview.
Source
This page is generated from the MATLAB help text in apps/dic/dic_preprocess/+dic_preprocess/+analysisRun/autoAlignMovingToReference.m.