title: Matlab imwarp, images don't fit
body: <p>I'm using Matlab R2013a to align two similar images. The output looks fine except that both images don't fit due to a x,y misalignment. I reason that this is due to the rotation of the image. Is there an easy way to "center" the images such that after affine transformation both images can be overlayed?</p>
  
  <pre><code>Transformation = imregtform(uint8(A),uint8(B),'affine', ...
                          optimizer,metric);
  [X RB] = imwarp(A,Transformation,'OutputView',imref2d(size(A)));
  </code></pre>
  
  <p>B is the original images. A gets registered to B. After affine transformation X contains a rotated and scaled image but need to be aligned on the x and y axes to perfectly fit A.</p>
  
  <p>Thanks for any hint!
  Durin</p>