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.

답변 (1개)

Image Analyst
Image Analyst 2013년 2월 21일

0 개 추천

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

댓글 수: 1

Garth
Garth 2013년 2월 21일
편집: Garth 2013년 2월 21일
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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

질문:

2013년 2월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by