资源简介
SIFT基于特征点配准算法的matlab实现,可以直接运行,运行方法参见run_demo; SIFT是一种经典算法,原理可查看wiki

代码片段和文件信息
function descriptors = do_descriptor(octave ... % 一组的高斯尺度空间
oframes ... % frames 包含关键点相关的尺度和主方向
sigma0 ... % 基本 sigma 值
S ... % 该组的尺度层数
smin ...
varargin)
for k=1:2:length(varargin)
switch lower(varargin{k})
case ‘magnif‘
magnif = varargin{k+1} ;
case ‘numspatialbins‘
NBP = varargin{k+1} ;
case ‘numorientbins‘
NBO = varargin{k+1} ;
otherwise
error([‘Unknown parameter ‘ varargin{k} ‘.‘]) ;
end
end
num_spacialBins = NBP;
num_orientBins = NBO;
key_num = size(oframes 2);
% 计算该图的向量和方向
[M N s_num] = size(octave); % M 是图像的高度 N 是图像的宽度; num_level is the number of scale level of the octave
descriptors = [];
magnitudes = zeros(M N s_num);
angles = zeros(M N s_num);
% compute image gradients
for si = 1: s_num
img = octave(::si);
dx_filter = [-0.5 0 0.5];
dy_filter = dx_filter‘;
gradient_x = imfilter(img dx_filter);
gradient_y = imfilter(img dy_filter);
magnitudes(::si) =sqrt( gradient_x.^2 + gradient_y.^2);
% if sum( gradient_x == 0) > 0
% fprintf(‘00‘);
% end
angles(::si) = mod(atan(gradient_y ./ (eps + gradient_x)) + 2*pi 2*pi);
end
x = oframes(1:);
y = oframes(2:);
s = oframes(3:);
% round off
x_round = floor(oframes(1:) + 0.5);
y_round = floor(oframes(2:) + 0.5);
scales = floor(oframes(3:) + 0.5) - smin;
for p = 1: key_num %对各个关键点处理
s = scales(p);
xp= x_round(p);
yp= y_round(p);
theta0 = oframes(4p);%关键点的主方向
sinth0 = sin(theta0) ;
costh0 = cos(theta0) ;
sigma = sigma0 * 2^(double (s / S)) ;
SBP = magnif * sigma;
%W = floor( sqrt(2.0) * SBP * (NBP + 1) / 2.0 + 0.5);
W = floor( 0.8 * SBP * (NBP + 1) / 2.0 + 0.5);
descriptor = zeros(NBP NBP NBO);
% within the big square select the pixels with the circle and put into
% the histogram. no need to do rotation which is very expensive
%在大正方形中用高斯加权圆选择像素点放入方向直方图中,不需要做昂贵的图像旋转
for dxi = max(-W 1-xp): min(W N -2 - xp)
for dyi = max(-W 1-yp) : min(+W M-2-yp)
mag = magnitudes(yp + dyi xp + dxi s); % 当前点(yp + dyi xp + dxi)的梯度幅值
angle = angles(yp + dyi xp + dxi s) ; % 当前点(yp + dyi xp + dxi)的梯度幅角
% angle = mod(-angle + theta0 2*pi); % 用关键点的主方向调整角度 并且 mod it with 2*pi
angle = mod(angle - theta0 2*pi);
dx = double(xp + dxi - x(p)); % x(p) 是关键点的精确位置 (浮点数). dx 相对于该关键点当前像素的位置
dy = double(yp + dyi - y(p)); % dy 相对于该关键点当前像素的位置
nx = ( costh0 * dx + sinth0 * dy) / SBP ; % nx 是旋转(dx dy)后的规格化位置 with the major orientation angle. this tells which x-axis spatial bin the pixel falls in
ny = (-sint
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-02-17 18:18 dosift\
文件 5412 2013-03-14 16:27 dosift\do_desc
文件 464 2013-03-14 16:27 dosift\do_diffofg.m
文件 4322 2013-03-14 16:27 dosift\do_extrefine.m
文件 2964 2013-03-14 16:27 dosift\do_gaussian.m
文件 2133 2013-03-14 16:27 dosift\do_localmax.m
文件 2505 2013-03-14 16:27 dosift\do_orientation.m
文件 3838 2013-03-14 16:27 dosift\do_sift.m
文件 378 2019-02-17 18:24 dosift\run_demo.m
文件 215 2013-03-14 16:27 dosift\smooth.m
- 上一篇:数字图像处理图像压缩MATLAB程序及仿真
- 下一篇:matlab解N维方程组的代码
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论