xcfShift edit page

measure how far each part of one image moved relative to another

Divides the region the two images share into a grid of tiles and phase correlates each tile against the matching tile of the other image. The result is a displacement per tile, to sub pixel accuracy, and the height of the correlation peak that produced it.

The peak height is not a diagnostic - it is the weight. A tile that landed on featureless background correlates weakly and must not get an equal vote when a transform is fitted through the displacements:

[u,peak,pos] = xcfShift(A,B);
T = spatialTransformShift.fit(pos, pos + u, 'weights', peak);

Description

Only the region where both images are finite is tiled, so the padding an earlier resampling left behind is excluded rather than correlated against. A tile that still contains a non finite value, or that is flat, comes back with NaN in all three outputs - drop those before fitting, which every spatialTransform fit does for you.

Syntax

[u,peak,pos] = xcfShift(A,B)
[u,peak,pos] = xcfShift(mgA,mgB)
[u,peak,pos] = xcfShift(A,B,'ROISize',64,'numROI',[24 18])

Input

A, B r × c images, the same size
mgA, mgB mapImage on the same grid, in which case u and pos are in specimen units rather than pixels

Output

u n × 1 vector3d, the displacement from A to B at each tile: the feature at pos in A is at pos + u in B
peak n × 1 correlation peak height, the fit weight
pos n × 1 vector3d, the tile centres, in A

Options

ROISize tile width in pixels, default 2^ceil(log2(rows/4))
numROI tiles across, scalar or [nx ny]. A scalar is scaled by the aspect ratio to give ny. Default 24
XCFMesh peak upsampling, default 250
coarseMesh resolution of the first refinement pass, default 48

Flags

dedupeBand drop the duplicated band pass indices, see xcfCorrelate

References

  • M. Guizar-Sicairos, S. T. Thurman, J. R. Fienup, Efficient subpixel image registration algorithms, Optics Letters (2008), Vol. 33, 156.

See also

spatialTransform mapImage.edgeMap

Citing this page. This page is part of the documentation of MTEX, a free and open source MATLAB toolbox for analyzing and modeling crystallographic textures. It was written by The MTEX Developers and is published at https://mtex-toolbox.github.io/xcfShift.html. If you use MTEX, or reuse text or figures from this page, in your research, please cite

F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63

BibTeX
@article{bachmann2010mtex,
  author  = {F. Bachmann and R. Hielscher and H. Schaeben},
  title   = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
  journal = {Solid State Phenomena},
  volume  = {160},
  pages   = {63-68},
  year    = {2010},
  doi     = {10.4028/www.scientific.net/SSP.160.63},
  url     = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}

Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.