I am trying to register a stack of images to one fixed image, using imregister. I have 9 pictures and sometimes, the registration seem totally wrong. I use the following code:
tformEstimate = imregcorr(img_1, img_2);
[optimizer, metric] = imregconfig('monomodal');
movingRegistered = imregister(img_2, img_1, 'affine', optimizer, metric,'InitialTransformation',tformEstimate);
Some of the images totally flip, which is weird, since the images are almost the same. I notice if I do not use the transformation matrix, I get the result of the "flipped" image. So my thought is that maybe the transformation is not used. Is there any way to check for this?
I am doing this in order to perform a focus stacking after aligning the images.