MATLAB: Apply transformation of Registration Estimator App to another image

registration estimator app

Hi, I register 2 grayscale images of slightly different sizes using the Registration Estimator App. The results are (1) the registered image, (2) the 2-D geometric transformation, and (3) the reference 2-D image to world coordinates. Then I want to apply the same transformation to another similar image with the exact same size of the Moving Image I used in the App. So I use imwarp as follows:
imwarp(MovingImage2, movingReg.Transformation)
The result is good, but there is a translation missing and the image size is not the same as the resulting image from the App. I believe that I have to make use of the reference to world coordinates to fix this problem, but I don't understand how. Can somebody give me a help?

Best Answer

You first need to Create an imref2d object, specifying the size and world limits of the image with which you want to associate the object.
fixed = imref2d(movingReg.SpatialRefObj.ImageSize);
imwarp(MovingImage2,movingReg.Transformation,'OutputView',fixed);
This should Work!!