SHARE
TWEET

test code

a guest May 7th, 2012 221 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pdf1=double(imread('image1.tif'));
  2. pdf2=double(imread('image2.tif'));
  3. %%% assumes 1 color channel images
  4.  
  5. [u dt cur energy] = match_pdfs_2d_haker(pdf1, pdf2);
  6.  
  7. %% computes a displacement interpolation
  8. [M N] = size(pdf1);
  9. [X,Y] = meshgrid(1:N, 1:M);
  10. uxmid = u(:,:,1)-repmat(1:N, M, 1);
  11. uymid = u(:,:,2)-repmat(transpose(1:M), 1, N);    
  12. k = 0;
  13. for t=0:0.025:1
  14.     uintx = repmat(1:N, M, 1) + t*uxmid;
  15.     uinty = repmat(transpose(1:M), 1, N) + t*uymid;
  16.     [dudx dudy] = gradient(reshape([uintx uinty], size(u)));
  17.     Du = abs(dudx(:,:,1).*dudy(:,:,2)-dudx(:,:,2).*dudy(:,:,1));
  18.     interpResult = interp2(X,Y,pdf2, uintx, uinty, 'linear', 0.);  
  19.     imga=interpResult.*(Du);
  20.     figure(2);
  21.     image(imga*0.25);
  22.     colormap('gray');
  23.     k=k+1;
  24.     s = sprintf('out_haker_%2.2u.png', k);
  25.     imwrite(imga*0.25/65., s);
  26. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top