From: D B on
I'm getting this error:

??? Error using ==> maketform>box2 at 762
OUTBOUNDS(1,k) may equal OUTBOUNDS(2,k) if and only if INBOUNDS(1,k) equals INBOUNDS(2,k).'INBOUNDS and OUTBOUNDS must be
2-by-N (for the same N).

Error in ==> maketform>box at 720
t = box2(inbounds,outbounds);

Error in ==> maketform at 126
t = feval(fcn,varargin{2:end});

Error in ==> imtransform>make_composite_tform at 339
reg_b = maketform('box', fliplr(args.size(1:2)), ...

Error in ==> imtransform at 266
args.tform = make_composite_tform(args);



Here is my code:

totwarps is a 4x2 matrix

udata = [0 1]; vdata = [0 1]; % input coordinate system
in_size = size(I2);

if sum(totwarps(1:2,1))+1 > sum(totwarps(3:4,1))+1
out_size(2) = round((sum(totwarps(1:2,1))+1)*in_size(2));
else out_size(2) = round((sum(totwarps(3:4,1))+1)*in_size(2));
end
if totwarps(1,2)+totwarps(4,2)+1 > totwarps(2,2)+totwarps(3,2)+1
out_size(1) = round((totwarps(1,2)+totwarps(4,2)+1)*in_size(1));
else out_size(1) = round((totwarps(2,2)+totwarps(3,2)+1)*in_size(1));
end


tform = maketform('projective',[ 0 0; 1 0; 1 1; 0 1],...
[0-totwarps(1,1) 0-totwarps(1,2);
1+totwarps(2,1) 0-totwarps(2,2);
1+totwarps(3,1) 1+totwarps(3,2);
0-totwarps(4,1) 1+totwarps(4,2)]);



[B,xdata,ydata] = imtransform(I2, tform, 'bicubic', ...
'udata', udata,...
'vdata', vdata,...
'size', out_size,...
'fill', 255);

where I2 is a grascale image

PLEASE help.