• Scientific Computing | SciVision

  • Blog
  • Tags
  • Categories

Matlab imwarp over 3x faster than imtransform

5 May, 2014

For a simple test (a horizontal linear shift) imwarp() was several times faster than imtransform()

bg = imread('myimage.jpg');
[nRow,nCol] = size(bg);

tform = affine2d(T);
RA = imref2d([nCol,nRow],[1 nCol],[1 nRow]);
data(:,:,i) = imwarp(bg,tform,'outputView',RA);
tform = maketform('affine',T);
data(:,:,i) = imtransform(bg,tform,...
  'Udata',[1 nCol],...
  'Vdata',[1 nRow],...
  'Xdata',[1 nCol],...
  'Ydata',[1 nRow]);
  • matlab
  • gnu-octave