Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

I = imread('mri.

tif');
imshow(I)
forward projection
udata = [0 1];
vdata = [0 1];
tform = maketform('projective',[ 0 0; 1 0; 1 1; 0 1],[0 0; 1 0; 1.5 1;
0.5 1]);
[B,xdata,ydata] = imtransform(I, tform, 'bicubic','udata', udata,'vdata',
vdata,'size', size(I),'fill', 128);
subplot(1,2,1), imshow(I,'XData',udata,'YData',vdata);
subplot(1,2,2), imshow(B,'XData',xdata,'YData',ydata);
back projection
udata = [0 1];
vdata = [1+offset-c 1+offset+d];
offset=2.5;
c=1.5;
d= -0.5;
tform = maketform('projective',[ 0 0; 1 0; 1 1; 0 1],[0 0; 1 0; 1.5 1;
0.5 1]);
[B,xdata,ydata] = imtransform(I, tform, 'bicubic','udata', udata,'vdata',
vdata,'size', size(I),'fill', 128);
subplot(1,2,2), imshow(B,'XData',xdata,'YData',ydata);
OR
I = imread('mri.tif');
imshow(I)
udata = [0 1];
vdata = [2 3];
tform = maketform('projective',[ 0 0; 1 0; 1 1; 0 1],[0 0; 1 0; 1.5 1;
0.5 1]);
[B,xdata,ydata] = imtransform(I, tform, 'bicubic','udata', udata,'vdata',
vdata,'size', size(I),'fill', 128);
subplot(1,2,1), imshow(I,'XData',udata,'YData',vdata);
subplot(1,2,2), imshow(B,'XData',xdata,'YData',ydata);

You might also like