⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tps_im_warp.asv

📁 一个薄板样条模型(thin plate spline)matlab源代码
💻 ASV
字号:
function [wimg, w, a] = TPS_im_warp(img, ipts, opts)
% function [wimg, w, a] = TPS_im_warp(img, ipts, opts)
%
% This function implements the THIN PLATE SPLINE method of image warping.
% 
% Input Params:
%  img - the image to be warped
%  ipts - the set of input pts that the image is to be warped to
%  opts - the set of input pts that the image is already registered to
%
% Dr. A. I. Hanna (2006).
[w, a, K] = pts2TPS_param(opts, ipts);
wimg = zeros(ceil(max(ipts(:,2))), ceil(max(ipts(:,1))), size(img,3));
size(img,1)
for i=1:size(wimg,2)
    tps = psi_tps([i*ones(size(wimg,1),1),(1:size(wimg,1))'], a, w, ipts);
    tps_x = round(tps(:,1)); tps_y = round(tps(:,2));
    for ii=1:length(tps_x)
        if (tps_x(ii))>0 & (tps_x(ii) < size(img,2)) & (tps_y(ii)>0) & (tps_y(ii)<size(img,1))
            wimg(ii, i, :) = img(tps_y(ii), tps_x(ii), :);
        end
    end
    fprintf('.'); if mod(i, 50)==0; fprintf('\n'); end;
end
fprintf('\n');
wimg = uint8(wimg);
return;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -