資源簡介
本資源是Matlab圖像配準程序,直接是.m文件,大家下載后可以直接運行,但材料中沒有圖像,需要自己找到配準圖像。
代碼片段和文件信息
%?load?image?data
I_ref=imread(‘optical2.tif‘);?%?reference?map
I_tar=imread(‘optical1.tif‘);?%?target?image
[rrcr]=size(I_ref);
[rtct]=size(I_tar);
%?select?ground?control?points?manually
figure;
subplot(221);
imshow(I_ref);?
[xy]=getpts(1);?
subplot(222);
imshow(I_tar);?
[uv]=getpts(2);?
x=round(x);
y=round(y);
u=round(u);
v=round(v);
%?sovle?the?coefficients?of?mapping?polynomial
%?Z?=?Y??¤C
Y(:1)=[1;1;1];
Y(:2:3)=[x?y];
Z=[u?v];
C=inv(Y)*Z;
%?resample?by?bilinear?interpolation
Yr(:1)=ones(rr1);
Yr(:2)=1:cr;%?horizontal?coordinate?corresponding?to?column?of?matrix
Yr(:3)=1:rr;%?oriental?coordinate?corresponding?to?row?of?matrix
Zt=Yr*C;
I_res=ones(rrcr);?%?result?matrix?of?registration
for?i=1:rr
????for?j=1:cr
????????if?(?Zt(j1)<0|Zt(j1)
評論
共有 條評論