From: <dk...@us...> - 2009-06-16 22:41:47
|
Revision: 994 http://panotools.svn.sourceforge.net/panotools/?rev=994&view=rev Author: dkg5 Date: 2009-06-16 22:41:43 +0000 (Tue, 16 Jun 2009) Log Message: ----------- Added MATLAB script Added Paths: ----------- branches/libpano_gsoc2009_mosaic/matlab/mosaic_v6.m Added: branches/libpano_gsoc2009_mosaic/matlab/mosaic_v6.m =================================================================== --- branches/libpano_gsoc2009_mosaic/matlab/mosaic_v6.m (rev 0) +++ branches/libpano_gsoc2009_mosaic/matlab/mosaic_v6.m 2009-06-16 22:41:43 UTC (rev 994) @@ -0,0 +1,42 @@ +clear all; +%close all; + +% make synthetic image of a square +im = zeros(200,200); +pixsel = 50:150; + +im(pixsel,50:51) = 255; +im(50:51,pixsel) = 255; +im(pixsel,150:151) = 255; +im(150:151,pixsel) = 255; + +% projective transformation for slant +udata = [-1 1]; vdata = [-1 1]; % input coordinate system + +Corig = [-1 -1; -1 1; 1 -1; 1 1]; +Cnew = [-1 -1; -0.5 1; 1 -1; 0.5 1]; +% Uses MATLAB's transform generator to create transform stucture +tform = maketform('projective',Corig,Cnew); + +% Use my slant function to create a slant matrix +M = slant([0 0]', 30); + +% [v, M] = rot([1 1 1]', 15, 'y'); +% [v, M] = trans([1 1 1]', [0 0]'); + +% Replace the matrices in the transform created by MATLAB with my +% transformation matrices +tform.tdata.T = M; +tform.tdata.Tinv = inv(M); + +[B,xdata,ydata] = imtransform(im, tform, 'bicubic', ... + 'udata', udata,... + 'vdata', vdata,... + 'size', size(im),... + 'fill', 128); +figure(2), subplot(1,2,1), +imagesc(udata,vdata,im), axis on, axis image, colormap(gray) + +subplot(1,2,2), +imagesc(xdata,ydata,B), axis on, axis image, colormap(gray), +title('Tilt') \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |