MATLAB: Help with imwarp and affine2d

affine2dImage Processing Toolboximwarpshifttransformation

Hello,
I have been trying to get imwarp to do a simple translation on an image but have been having some problems getting it to work. I have a reference image which I am using to rectify another image. I have the coordinate translations as x=-64 and y=-302. I have set up a coordinate transformation matix but the resulting image does not change.
figure(4);
xform=[1 0 0;0 1 0;64 302 1]; input_image='DSC08069.JPG';
f1=im2double(imread(input_image));
tform=affine2d(xform);
corr_RGBIM=imwarp(f1,tform);
imshow(corr_RGBIM);
title('RGB registered');
Any suggestions?

Best Answer

The problem may be that imwarp() crops the output image to the transformed positions of the corners of the input image. A simple translation does not then have any effect. Try using imwarp_same(), attached, which applies the transformation and crops to the original positions of the corners.