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

📄 test_gltriwarp.m

📁 matlab aamtool box
💻 M
字号:
clear all;
IS = imread('pout.tif');
img(:,:,1) = IS;
img(:,:,2) = IS;
img(:,:,3) = IS;
img = uint8(img);
N = 20;
ipts = rand(N,2);
ipts(:,1) = ipts(:,1) * size(img,2);
ipts(:,2) = ipts(:,2) * size(img,1);

opts = rand(N,2);
opts(:,1) = opts(:,1) * size(img,2);
opts(:,2) = opts(:,2) * size(img,1);
T = delaunay(ipts(:,1),ipts(:,2),{'Qt','Qbb','Qc','Qz'});
figure(1); clf; hold on;
imagesc(img);
triplot(T, ipts(:,1),ipts(:,2), 'Color', 'r');
triplot(T, opts(:,1),opts(:,2));
axis image ij;
tri = T;
tri = tri';
tri = tri(:);

ipts = ipts(tri,:)';
ipts = single(ipts(:));
opts = opts(tri,:)';
opts = single(opts(:));

r = img(:,:,1)';
g = img(:,:,2)';
b = img(:,:,3)';
k = [r(:) g(:) b(:)]';
k = reshape(k(:),size(img,2),size(img,1),3);

% Warp the image
timg = gltriwarp(k,ipts,opts);
siz = size(timg);
timg = timg(:);
wimg(:,:,1) = reshape(timg(1:3:length(timg)),siz(1),siz(2))';
wimg(:,:,2) = reshape(timg(2:3:length(timg)),siz(1),siz(2))';
wimg(:,:,3) = reshape(timg(3:3:length(timg)),siz(1),siz(2))';
figure;
imagesc(wimg); axis image;

⌨️ 快捷键说明

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