trouble using axes in imcrop

I am trying to register one image with another. I am able to apply the transforms (translation, rotation and translation) to the one image which gets it to where I want it to go. However, due to these transforms the resulting image is larger than my other image. I am able to overlay them using imshow, but I would now like to crop the larger (transformed) image to be the same size as the base image (basically where the two images overlap). I do not understand how the axes work with imcrop. Below is how I plot it, followed by the failed attempt at cropping.
figure; imshow(registered,'Xdata', xdat, 'Ydata', ydat)
hold on
h = imshow(base,gray(256));
set(h,'AlphaData',0.3)
hold off
[basey, basex] = size(base)
rect = [1 1 basex basey];
[xdat ydat final rect]=imcrop(registered);
I have tried a bunch of variations of the above for imcrop but no luck. The xdat and ydat run from negative numbers while my base image starts at the origin. I hope it is clear what I am trying to do here. Thanks in advance.

Antworten (1)

Image Analyst
Image Analyst am 21 Feb. 2013

0 Stimmen

Did you see the demos for imregister()? I think that does what you want.

1 Kommentar

Garth
Garth am 21 Feb. 2013
Bearbeitet: Garth am 21 Feb. 2013
Thanks for the fast response. For some reason I do not have imregister or imshowpair in my version of Matlab, which is the reason I was doing this the manual way. I thought I understood the axes in imcrop but apparently I don't, so any explanation would be appreciated. Thanks.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Feb. 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by