【图像配准】基于surf算法实现图像配准附Matlab代码

1 内容介绍

图像配准(imageregistration)是将不同时相(获取时间)、不同传感器(成像设备)或不同条件(天候照度摄像位置和角度)下获取的2景或多景图像进行几何匹配的过程随着信息技术的迅猛发展传统的基于灰度值和变换域的图像配准技术已难以满足需要基于影像特征的高精度图像配准方法已经成为当前图像配准技术的研究趋势近年来国内外涌现出了大量基于影像特征的图像配准方法研究包括特征点边缘区域和轮廓等。特征点的提取相对容易且不易受空间分辨率光照条件等图像变化的影响而被广泛应用SURF算法是在SIFT算法的基础上提出的一种快速鲁棒特征提取的配准算法。基于SURF算法的图像配准主要包括图像特征点提取特征点匹配、去除误匹配点确定匹配模型和图像重采样4个方面。而在利用传统SURF算法进行图像配准时提取的特征点分布不均会导致匹配的特征点出现局部集中现象使图像配准误差较大而影响整体配准的精度

2 部分代码

function ipts=OpenSurf(img,Options)

% This function OPENSURF, is an implementation of SURF (Speeded Up Robust 

% Features). SURF will detect landmark points in an image, and describe

% the points by a vector which is robust against (a little bit) rotation 

% ,scaling and noise. It can be used in the same way as SIFT (Scale-invariant 

% feature transform) which is patented. Thus to align (register) two 

% or more images based on corresponding points, or make 3D reconstructions.

%

% This Matlab implementation of Surf is a direct translation of the 

% OpenSurf C# code of Chris Evans, and gives exactly the same answer. 

% Chris Evans wrote one of the best, well structured all inclusive SURF 

% implementations. On his site you can find Evaluations of OpenSURF 

% and the C# and C++ code. http://www.chrisevansdev.com/opensurf/

% Chris Evans gave me permisson to publish this code under the (Mathworks)

% BSD license.

%

% Ipts = OpenSurf(I, Options)

%

% inputs,

%   I : The 2D input image color or greyscale

%   (optional)

%   Options : A struct with options (see below)

%

% outputs,

%   Ipts : A structure with the information about all detected Landmark points

%     Ipts.x , ipts.y : The landmark position

%     Ipts.scale : The scale of the detected landmark

%     Ipts.laplacian : The laplacian of the landmark neighborhood

%     Ipts.orientation : Orientation in radians

%     Ipts.descriptor : The descriptor for corresponding point matching

%

% options,

%   Options.verbose : If set to true then useful information is 

%                     displayed (default false)

%   Options.upright : Boolean which determines if we want a non-rotation

%                       invariant result (default false)

%   Options.extended : Add extra landmark point information to the

%                   descriptor (default false)

%   Options.tresh : Hessian response treshold (default 0.0002)

%   Options.octaves : Number of octaves to analyse(default 5)

%   Options.init_sample : Initial sampling step in the image (default 2)

%   

% Example 1, Basic Surf Point Detection

% % Load image

%   I=imread('TestImages/test.png');

% % Set this option to true if you want to see more information

%   Options.verbose=false; 

% % Get the Key Points

%   Ipts=OpenSurf(I,Options);

% % Draw points on the image

%   PaintSURF(I, Ipts);

%

% Add subfunctions to Matlab Search path

functionname='OpenSurf.m';  %函数名字

functiondir=which(functionname);%which()找出函数与文件所在的目录名

functiondir=functiondir(1:end-length(functionname));

addpath([functiondir '/SubFunctions'])

       

% Process inputs

defaultoptions=struct('tresh',0.0002,'octaves',5,'init_sample',2,'upright',false,'extended',false,'verbose',false);

if(~exist('Options','var')),   

    Options=defaultoptions; 

else

    tags = fieldnames(defaultoptions);

    for i=1:length(tags)

         if(~isfield(Options,tags{i})),  Options.(tags{i})=defaultoptions.(tags{i}); end

    end

    if(length(tags)~=length(fieldnames(Options))), 

        warning('register_volumes:unknownoption','unknown options found');

    end

end

% Create Integral Image创建积分图像

img=IntegralImage_IntegralImage(img);

% Extract the interest points提取兴趣点

FastHessianData.thresh = Options.tresh;

FastHessianData.octaves = Options.octaves;

FastHessianData.init_sample = Options.init_sample;

FastHessianData.img = img;

ipts = FastHessian_getIpoints(FastHessianData,Options.verbose);

% Describe the interest points描述兴趣点

if(~isempty(ipts))

    ipts = SurfDescriptor_DecribeInterestPoints(ipts,Options.upright, Options.extended, img, Options.verbose);%调用描述特征点子程序SurfDescriptor_DecribeInterestPoints

end

3 运行结果

【图像配准】基于surf算法实现图像配准附Matlab代码_第1张图片

4 参考文献

[1]杨海燕, 罗文超, and 刘国栋. "基于SURF算法和SC-RANSAC算法的图像配准." 计算机应用研究 30.5(2013):3.

[2]高素青, 谭勋军, 黄承夏. 一种基于SURF的图像配准改进算法[J]. 解放军理工大学学报:自然科学版, 2013, 14(4):5.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机、雷达通信、无线传感器等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

你可能感兴趣的:(图像处理,matlab,算法,开发语言)