SURF matlab 检测函数使用 - 悟江居士

SURF matlab 检测函数使用

1.这篇介绍SURF检测blob的函数。

函数/Functions

函数名称:detectSURFFeatures

功能:利用The Speeded-Up Robust Features(SURF)算法检测blob特征

语法:points = detectSURFFeatures(I);

points = detectSURFFeatures(I,Name,Value);

其中,其中,I为2-D灰度图像,points为返回的SURF检测算法检测到的blob,Name必须为用单引号对包含的如下字符串名称,Vaule为对应Name的值

Name&Value参数
NameValue
\'MetricThreshold\'默认值为1000.0,取值较小时,返回更多检测到的blob
\'NumOctaves\'默认值为3,范围为>=1的整数,表示所使用高斯滤波器的序列,越小时,所使用的高斯滤波器的序列的窗口大小越小,能够检测到的Blob的尺度越小,典型值为1-4
\'NumScaleLevels\'默认值为4,范围为>= 3的整数,表示对应NumOctaves取值的高斯滤波器的个数,典型值为3-6
\'ROI\'默认为[1,1,size(I,1),size(1)],表示进行角点检测的图像区域
Octave&FilterSize
OctaveFilterSize
19x9,15x15,21x21,27x27,...(相差为6)
215x15,27x27,39x39,51x51,...(相差为12)
327x27,51x51,75x75,99x99,...(相差为24)
4...(相差为48)

~~ surf的matlab程序如下

clc

%读取图像

I1= imread(\'info_surf01.jpg\');

I1=imresize(I1,0.6); %imresize 将原来的图像缩小原来的一般

I1=rgb2gray(I1); %把RGB图像变成灰度图像

%figure

%imshow(I1)

I2= imread(\'info_surf03.jpg\');

I2=imresize(I2,0.6);

I2=rgb2gray(I2);

%figure

%imshow(I2)

%寻找特征点

points1 = detectSURFFeatures(I1,\'MetricThreshold\',100); %读取特征点

points2 = detectSURFFeatures(I2,\'MetricThreshold\',100);

%Extract the features.计算描述向量

[f1, vpts1] = extractFeatures(I1, points1);

[f2, vpts2] = extractFeatures(I2, points2);

%Retrieve the locations of matched points. The SURF feature vectors are already normalized.

%进行匹配

indexPairs = matchFeatures(f1, f2, \'Prenormalized\', true) ;

matched_pts1 = vpts1(indexPairs(:, 1)); %这个地方应该是对他进行取值吧 这个应该是啊吧他们做成一个数组

matched_pts2 = vpts2(indexPairs(:, 2));

%显示匹配

figure(\'name\',\'匹配后的图像\'); showMatchedFeatures(I1,I2,matched_pts1,matched_pts2,\'montage\'); %总共找了39个特征点

legend(\'matched points 1\',\'matched points 2\');