Python 基于ORB描述符的零关键点检测

Python 基于ORB描述符的零关键点检测,python,descriptor,orb,Python,Descriptor,Orb,我正试图为一个图像数据库计算ORB(面向快速和旋转简短)特征。下一个任务是使用一个单词包的方法来计算图像的最终特征。我的问题是,在某些情况下,我从数据库的图像中获得0个关键点(在ORB或BRISK实现中)。我的代码来自 这里能做什么,至少找到一个关键点?如何对这些情况使用密集采样?您可以使用密集特征检测器,如在C++中实现的检测器: 问题是,我不确定是否已经将其移植到python中。但是,由于算法不是那么难,您可以自己实现它。以下是C++中的实现: void DenseFeatureDetect

我正试图为一个图像数据库计算ORB(面向快速和旋转简短)特征。下一个任务是使用一个单词包的方法来计算图像的最终特征。我的问题是,在某些情况下,我从数据库的图像中获得0个关键点(在ORB或BRISK实现中)。我的代码来自


这里能做什么,至少找到一个关键点?如何对这些情况使用密集采样?

您可以使用密集特征检测器,如在C++中实现的检测器:

问题是,我不确定是否已经将其移植到python中。但是,由于算法不是那么难,您可以自己实现它。以下是C++中的实现:

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 );
}
void DenseFeatureDetector::detectImpl(常数矩阵和图像、向量和关键点、常数矩阵和掩码)常数
{
浮动光标=静态投影(初始特征比例);
int curStep=initXyStep;
int-curBound=initImgBound;
对于(int-curLevel=0;curLevel
但是,正如您将注意到的,此实现不处理关键点的角度。如果图像有旋转,这可能是一个问题

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