Matlab实多种图像配准.docVIP

  • 27
  • 0
  • 约1.08万字
  • 约 7页
  • 2017-03-09 发布于贵州
  • 举报
Matlab实多种图像配准

Matlab实现多种图像配准 本文讲述如何利用Matlab Image Processing Toolbox中的图像配准工具实现线性正投影、仿射、投影、多项式、分段线性、局部加权平均配准的过程。 实验平台 X86 PC,Windows XP sp2, Matlab 7.1 资源的获取 图片资源来自/registration/satellite/testimag.html,其中每个压缩包里存有两副图片,每副图片以矩阵形式保存。 matlab工具的使用方法:查看帮助mage Processing Toolbox Users Guide——Image registration。 涉及配准方法简介 该工具箱提供的配准方法均需手工选择图像间的匹配点对(control points pair),均属于交互配准方法。其基本过程为:读入图像数据- 在两副图像上选择足够匹配点- 选择配准算法,计算变换参数- 变换图像。 假设input image(输入图像)为欲进行配准的图像,base image为配准是的参考图像。以下是我参考matlab帮助给出了简介。 1.线性正投影(linear conformal):最简单。平面映射成平面。 当输入输入图像与参考图像对比,只是存在全局的平移、旋转、缩放或其三者组合的差别时(正方形仍对应正方形),选择此配准方法。此方法至少需要2对匹配点。 2.仿射(affine):将平行线转换成平行线。 当输入图像形状存在切变现象(正方形对应平行四边形),选此法。至少需3对匹配点。 3.投影(projective):将直线映射成直线。 如果输入图像呈现倾斜,翘起现象,选此法。至少需4对匹配点。 4.多项式(polynomial):将直线映射成曲线。 如果输入图像出现不规则曲变,采用此法。Matlab中提供有2、3、4次幂的实现,分别至少需要6,10,10对匹配点。 5.分段线性(piecewise linear) 如果输入图像的各个局部之间的退化模式明显不一样,选此法。至少需要4对匹配点。 6.局部加权平均(local weighted mean) 与分段线性一致,但效果较之好。至少需要6对(推荐12对)匹配点。 实验步骤 1.读取图像数据。 因为源图像以矩阵形式存在一个二进制的文件里,用fread可将其读取到变量矩阵中。将读取文件编制成一个子函数 RTIread.m ,源代码如下: function imMatrix RTIread FILENAME,SIZE %RTIread Read the image matrix from binary Registration Test Image file. % imMatrix RTIread FILENAME,SIZE opens the file FILENAME, and reads the % number of elements specified by SIZE. % % FILENAME is a string containing the name of the file to be opened. % Valid entries for SIZE are: % N read N elements into a column vector. % inf read to the end of the file. % [M,N] read elements to fill an M-by-N matrix, in column order. % N can be inf, but M cant. % % It returns the image matrix. fid fopen FILENAME,r ; imMatrix fread fid,SIZE,uint8 uint8 ; fclose fid ; %image imMatrix ; 这里我们选取了两张600×600的图片,文件名为“casitas84”和“casitas86”。运行以下代码读取图像矩阵: % 1. Read the images into the MATLAB workspace. base RTIread casitas84,[600,600] ; input RTIread casitas86,[600,600] ; 2.选取匹配点(control points)。 根据预定的配准方法,选定足够的匹配点对。运行下列代码: % 2.Specify control point pairs n the images and save. cpselect input,base ; %please select 15 points for test

文档评论(0)

1亿VIP精品文档

相关文档