MATLAB: Does IMTRANSFORM generate a matrix of an unexpected size in MATLAB 7.8 (R2009a)

largerMATLABsmaller

I successfully went through the "Registering to a Digital Orthophoto" example in the documentation for Image Processing Toolbox:
web([docroot,'/toolbox/images/f20-14791.html#f20-25391'])
Now, I added one thing. Immediately after loading the unregistered image:
unregistered = imread('westconcordaerial.png'); % The result has a size of 394x369x3.
I resize the image to 25% its original size by adding this code:
unregistered = imresize(unregistered, 0.25); % The result has a size of 99x93x3.
I then proceed through the example and runs the following command as shown in the example:
registered = imtransform(unregistered, mytform);
Here, I expect the size of 'registered' to be similar to the size of 'unregistered' (394x369x3), but it is significantly smaller (199x191x3). I know it may not be exactly the same size but do not understand why it is so dissimilar.
When going through the example I am manually selecting control point pairs and skipping Step 4. Specifically, I select three sets of control points on the street around the island block around the center of the images.
Resizing the unregistered image by down to 50% seems to avoid the issue. Also, even when resizing down to 25%, the results look fine when I use the following code to overlay the images:
imshow(transformedImage, 'XData', xdata, 'YData', ydata);

Best Answer

This enhancement has been incorporated in Release 2010b (R2010b). For previous product releases, read below for any possible workarounds:
IMTRANSFORM has logic in it that automatic adjusts the size (in X-Y space) of the output pixels in order to keep the dimensions of the output image from growing too large. The XData and YData of the output image are adjusted appropriately to match, which is why your overlay code, which uses the XData and YData when displaying the transformed image, looks OK.
To prevent this automatic (and unexpected) adjustment of the output pixel size, specify the 'XYScale' parameter to be 1, like this:
[transformedImage xdata ydata] = imtransform (resizedInputImage, ...
transformationMatrix, 'FillValues', 255, 'XYScale', 1);