前言
方法应用对象:
1)具有一定重叠度但其大小不一的两幅图
2)具有不同角度的两幅图
3)两幅不同类型的图进行配准叠加
4)其他具有共同先验位置点的两幅图
主要流程
本流程采用,以主图像为基准,对B图像进行转换。
master_image=imread("主图像.png");
secondary_image=imread("辅图像.png");
A=master_image;
B=secondary_image;
figure;
subplot(1,2,1);
imshow(A);
title('master image')
subplot(1,2,2);
imshow(B);
title('secondary image');
suptitle('主影像与待配准的辅影像')
figure
subplot(1,2,1)
imshowpair(A,B,'blend');
subplot(1,2,2)
imshowpair(A,B);
suptitle('the different of master image and secondary image')
%cpselect函数利用人机交互式寻找控制点,返回的是控制点在B图与A图的坐标,注意是先B后A,
%交互窗口也将是BA排列
[mp,fp] = cpselect(B,A,'Wait',true);
%t返回的是根据公共点坐标计算的转换矩阵
t = fitgeotrans(mp,fp,"projective");
Rfixed = imref2d(size(B));
%利用转换矩阵,对辅影像进行转换。
registered = imwarp(B,t,'OutputView',Rfixed);
figure;
imshow(registered);
title('Interactive registration converted secondary image');
转换后以原始B的大小作为转换大小
转换后以原始A的大小作为转换大小
subplot(1,2,1)
imshowpair(registered,A,'blend');
subplot(1,2,2)
imshowpair(registered,A);
suptitle('主影像与配准后的辅影像差异图');
以B为转换后大小
以A为转换后大小