1. 程式人生 > >Matlab影象處理學習筆記(七):surf特徵點

Matlab影象處理學習筆記(七):surf特徵點

本文主要演示如何使用matlab自帶的Computer Vision System Toolbox這個工具箱進行suft特徵點的檢測、匹配及顯示。這個工具箱是matlab2012b及之後才有的一個工具箱,如果你的版本較低,建議你更新較新版本。

轉載請註明出處:http://blog.csdn.net/u010278305點選開啟連結

suft特徵點是Speeded-Up Robust Features的簡稱,相比於sift特徵點,速度更快。

本文涉及到的知識點如下:

1、suft特徵點。

2、matlab的Computer Vision System Toolbox工具箱。

程式流程如下:

1、讀取影象,轉為灰度圖。

2、尋找surf特徵點。

3、根據特徵點計算描述向量。

4、進行匹配。

5、繪製匹配結果。

matlab原始碼如下:

%function:
%       surf特徵點檢測與匹配
%注意:
%       本例程主要演示如何用matlab自帶的Computer Vision System Toolbox進行surf特徵點的提取與匹配
%date:2015-1-13
%author:chenyanan
%轉載請註明出處:http://blog.csdn.net/u010278305

%清空變數,讀取影象
clear;close all

%Read the two images.
I1= imread('images/girl.jpg');
I1=imresize(I1,0.5);
I1=rgb2gray(I1);
I2= imread('images/head.jpg');
I2=imresize(I2,0.5);
I2=rgb2gray(I2);

%Find the SURF features.尋找特徵點
points1 = detectSURFFeatures(I1);
points2 = detectSURFFeatures(I2); 

%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));

%Display the matching points. The data still includes several outliers, 
%but you can see the effects of rotation and scaling on the display of matched features.
%對匹配結果進行顯示,可以看到,還有一些異常值
figure('name','result'); showMatchedFeatures(I1,I2,matched_pts1,matched_pts2);
legend('matched points 1','matched points 2');

程式執行效果如下:


測試原檔案可在之前的筆記中找到。

轉載請註明出處:http://blog.csdn.net/u010278305點選開啟連結