I am trying to write a matlab code for image morphing . I have to prewarp the images first , i have used imwarp function with the tform as follows , the code is ,
function []= min_view_morphing(im1,im2)
F = findfundmat(im1,im2)
[ H1, H2 ] = computeH1H2( F )
H1(:,3)=0;H1(3,:)=0; H1(3,3)=1;
H2(:,3)=0;H2(3,:)=0; H2(3,3)=1;
inH1=inv(H1);
inH2=inv(H2);
% t_aff1=maketform('projective',real(inH1));
% t_aff2=maketform('projective',real(inH2));
%
% imw1=imtransform(im2double(im1),t_aff1,'FillValues',.3);
% figure,imshow(imw1);
% imw2=imtransform(im2double(im2),t_aff2,'FillValues',.3);
% figure,imshow(w2);
H1=affine2d(inH1);
H2=affine2d(inH2);
imw1=imwarp(im1,H1);
imw2=imwarp(im2,H2);
figure,imshow(imw1);
figure,imshow(imw2);
every time i run this i get an out of memory error no matter how small image size i use , and it happens only for the second image only while both H1 and H2 are 3 cross 3 matrices . any solutions ??