Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pdf1=double(imread('image1.tif'));
- pdf2=double(imread('image2.tif'));
- %%% assumes 1 color channel images
- [u dt cur energy] = match_pdfs_2d_haker(pdf1, pdf2);
- %% computes a displacement interpolation
- [M N] = size(pdf1);
- [X,Y] = meshgrid(1:N, 1:M);
- uxmid = u(:,:,1)-repmat(1:N, M, 1);
- uymid = u(:,:,2)-repmat(transpose(1:M), 1, N);
- k = 0;
- for t=0:0.025:1
- uintx = repmat(1:N, M, 1) + t*uxmid;
- uinty = repmat(transpose(1:M), 1, N) + t*uymid;
- [dudx dudy] = gradient(reshape([uintx uinty], size(u)));
- Du = abs(dudx(:,:,1).*dudy(:,:,2)-dudx(:,:,2).*dudy(:,:,1));
- interpResult = interp2(X,Y,pdf2, uintx, uinty, 'linear', 0.);
- imga=interpResult.*(Du);
- figure(2);
- image(imga*0.25);
- colormap('gray');
- k=k+1;
- s = sprintf('out_haker_%2.2u.png', k);
- imwrite(imga*0.25/65., s);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement