https://it.mathworks.com/help/images/ref/imregmtb.html
imregmtb - Register 2-D images using median threshold bitmaps - MATLAB
This MATLAB function registers an arbitrary number of moving images M1,M2,...,Mn with respect to the fixed (reference) image, F, using the median threshold...
registerimagesusingmedianthreshold