示例程式043 特徵點檢測

2021-08-14 21:27:14 字數 2204 閱讀 3461

基於特徵點的影象匹配是影象處理中經常會遇到的問題,手動選取特徵點太麻煩了。比較經典常用的特徵點自動提取的辦法有harris特徵、sift特徵、surf特徵。

先介紹利用surf特徵的特徵點檢測,具體過程是:

1.使用 featuredetector 介面來發現感興趣點。

2.使用 surffeaturedetector 以及它的函式 detect 來實現檢測過程

3.使用函式 drawkeypoints 來繪製檢測到的關鍵點

雖然**和函式都很簡單,但是其實我現在對surf還不了解,也不知道提取出來的特徵點具體是根據什麼特徵。今後用到再詳細研究吧。

**和部分注釋:

// 052 特徵點檢測.cpp : 定義控制台應用程式的入口點。

//#include "stdafx.h"

#include

#include

#include "opencv2/core/core.hpp"

#include "opencv2/features2d/features2d.hpp"

#include "opencv2/highgui/highgui.hpp"

using namespace cv;

int main( int argc, char** argv )

//threshold for hessian keypoint detector used in surf

int minhessian = 400;

//surffeaturedetector:用 surf 函式實現的特徵檢測子封裝類

surffeaturedetector detector( minhessian );

std::vectorkeypoints_1, keypoints_2;

//detect函式可以檢測出surf特徵的關鍵點,儲存在vector容器中

detector.detect( img_1, keypoints_1 );

detector.detect( img_2, keypoints_2 );

//-- draw keypoints

mat img_keypoints_1; mat img_keypoints_2;

//繪製特徵關鍵點.

drawkeypoints( img_1, keypoints_1, img_keypoints_1, scalar::all(-1), drawmatchesflags::default );

drawkeypoints( img_2, keypoints_2, img_keypoints_2, scalar::all(-1), drawmatchesflags::default );

imshow("keypoints 1", img_keypoints_1 );

imshow("keypoints 2", img_keypoints_2 );

waitkey(0);

return 0;

}

執行結果:

人臉特徵點檢測

參考 face alignment by explicit shape regression。演算法的實現原始碼在裡的explicitshaperegression.cpp裡面。下面貼上乙個檢測結果 人臉特徵點有不少應用,比如可以對齊人臉,或者做人臉變形。在人臉資料庫裡挑選了一些人臉,對齊它們,求出...

ORB特徵點檢測

這篇文章我們將介紹一種新的具有區域性不變性的特徵 orb特徵,從它的名字中可以看出它是對fast特徵點與breif特徵描述子的一種結合與改進,這個演算法是由ethan rublee,vincent rabaud,kurt konolige以及gary r.bradski在2011年一篇名為 orb ...

GFTT特徵點檢測

角點檢測,避免出現聚簇現象 shi tomasi的角點檢測演算法,名稱goodfeaturetotrack,opencv的feature2d介面整合了這種演算法,名稱為gfttdetector,介面如下 ptrcreate int maxcorners 1000,double qualityleve...