SIFT相关参数的简要介绍如下:
nfeatures:特征点数目(算法对检测出的特征点排名,返回最好的nfeatures个特征点)。
nOctaveLayers:金字塔中每组的层数(算法中会自己计算这个值,后面会介绍)。
contrastThreshold:过滤掉较差的特征点的对阈值。contrastThreshold越大,返回的特征点越少。
edgeThreshold:过滤掉边缘效应的阈值。edgeThreshold越大,特征点越多(被过滤掉的越少)。
sigma:金字塔第0层图像高斯滤波系数,也就是σ。
1.参数nfeatures指定最终返回的特征点数量,并不影响SIFT特征检测的结果,本文不对该参数进行分析。
2.参数nOctaveLayers和sigma主要影响图像高斯金字塔的构成,
3.contrastThreshold和edgeThreshold则影响在DOG中寻找极值点的过程与结果。
所以,在使用OpenCV SIFT特征检测算子时,如果提取效果不够理想,可根据实际情况调整参数后进行重新提取。用法如下:
`
SiftFeatureDetector siftDetector(0,3,0.08,8,1.0);
siftDetector.detect(Mat,vector< KeyPoint >);
而opencv库中默认的参数是
CV_WARP explicit SIFT(int nfeatures =0 ,int nOctaveLayers =3,douible contrastThreshold = 0.04,double edgeThreshold = 10,double sigma =1.6);
“`
若使用 Ptr< FeatureDetector> sift_detector = FeatureDetector::create("SIFT")
构造特征提取算子,
则需要通过sift_detector.set()函数进行相应的配置。