通过使用MATLAB中的cpselect函数选择基准点,将两幅图像进行配准/对准。
首先读取两幅图像
clear all;
Inimg = imread(‘g.jpg’);
Baseimg= imread(‘image.jpg’);
figure;
subplot(1,2,1),imshow(Inimg);
subplot(1,2,2),imshow(Baseimg);
显示为:
图像的配准——MATLAB实现
在MATLAB命令行输入:
cpselect(Inimg,Baseimg);
出现交互界面:
图像的配准——MATLAB实现
利用Drag image to pan调整图像位置,利用add points 分别点击两幅图像,成对儿地添加基准点。如图:
图像的配准——MATLAB实现
将标注的基准点对保存到工作空间,如图;
图像的配准——MATLAB实现
input_points =
183.2500 135.2500
236.7500 125.2500
201.7500 196.2500
235.7500 191.2500
base_points =
115.7500 127.2500
176.2500 127.7500
119.2500 202.7500
158.2500 199.7500
然后,利用函数cp2tform选择适当的变换类型,确定变换的参数。在命令行输入

tform=cp2tform(input_points,base_points,’affine’);
Iout=imtransform(Inimg,tform);
figure
subplot(1,2,1),imshow(Iout);
subplot(1,2,2),imshow(Baseimg);
得到结果,如图:
图像的配准——MATLAB实现

相关文章:

  • 2021-10-23
  • 2021-12-13
  • 2021-08-09
  • 2021-11-29
  • 2021-10-16
  • 2021-11-19
  • 2021-11-23
猜你喜欢
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-05-26
  • 2021-06-07
  • 2022-12-23
相关资源
相似解决方案