提前道歉,我主要使用Python,所以我會通過引用C++避免讓自己陷入困境。
DenseFeatureDetector用關鍵點填充矢量以傳遞以計算特徵描述符。這些關鍵點有一個點向量和它們的比例集。在文檔中,scale是關鍵點的像素半徑。
關鍵點在傳遞給DenseFeatureVector的圖像矩陣的寬度和高度上均勻分佈。
我們的觀點:
initFeatureScale 坐落在像素(據我所知,這沒有任何影響)
featureScaleLevels 尺度數量的初始關鍵點的特徵半徑overwhich我們希望製作關鍵點
featureScaleMuliplier 比例調節通過featureScaleLevels對initFeatureScale進行調整,此比例調整也可以應用於邊界(initImgBound)和步長(initxystep)。因此,當我們設置featureScaleLevels> 1時,這個乘數將應用於連續的比例尺,以調整特徵比例,步長和圖像周圍的邊界。
initXyStep 移動列和行像素步驟。我希望自我解釋。
initImgBound 行/列邊界區域忽略圍繞圖像(像素),因此,一個100×100的圖像,具有10的initImgBound,將在圖像的中央部分80×80創建關鍵點。
varyXyStepWithScale 布爾,如果我們有多個featureScaleLevels做,我們要調整使用featureScaleMultiplier步長。
varyImgBoundWithScale Boolean,as varyXyStepWithScale,但應用於邊界。
這裏是detectors.cpp的DenseFeatureDetector源代碼OpenCV的2.4.3源,這可能會解釋比我的話好:
DenseFeatureDetector::DenseFeatureDetector(float _initFeatureScale, int _featureScaleLevels,
float _featureScaleMul, int _initXyStep,
int _initImgBound, bool _varyXyStepWithScale,
bool _varyImgBoundWithScale) :
initFeatureScale(_initFeatureScale), featureScaleLevels(_featureScaleLevels),
featureScaleMul(_featureScaleMul), initXyStep(_initXyStep), initImgBound(_initImgBound),
varyXyStepWithScale(_varyXyStepWithScale), varyImgBoundWithScale(_varyImgBoundWithScale)
{}
void DenseFeatureDetector::detectImpl(const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask) const
{
float curScale = static_cast<float>(initFeatureScale);
int curStep = initXyStep;
int curBound = initImgBound;
for(int curLevel = 0; curLevel < featureScaleLevels; curLevel++)
{
for(int x = curBound; x < image.cols - curBound; x += curStep)
{
for(int y = curBound; y < image.rows - curBound; y += curStep)
{
keypoints.push_back(KeyPoint(static_cast<float>(x), static_cast<float>(y), curScale));
}
}
curScale = static_cast<float>(curScale * featureScaleMul);
if(varyXyStepWithScale) curStep = static_cast<int>(curStep * featureScaleMul + 0.5f);
if(varyImgBoundWithScale) curBound = static_cast<int>(curBound * featureScaleMul + 0.5f);
}
KeyPointsFilter::runByPixelsMask(keypoints, mask);
}
你可能會想到一個電話compute會根據DenseFeatureDetector生成的關鍵點,使用相關的關鍵點檢測算法(如角度)來計算其他關鍵點特徵。不幸的是,Python下的SIFT並非如此 - 我沒有看過其他特徵檢測器,也沒有看過C++中的行爲。
另請注意,DenseFeatureDetector不在OpenCV 3.2中(不確定它被刪除的版本)。
看看我在這裏的同一問題的答案:http://stackoverflow.com/questions/29970191/opencv-python-dense-sift-settings/32246964#32246964 –