我可以指定使用opencv FastFeatureDetector时获得的快速关键点编号吗
我正在使用openCV FastFeatureDetector从图像中提取快速关键点。我可以指定使用opencv FastFeatureDetector时获得的快速关键点编号吗,opencv,keypoint,Opencv,Keypoint,我正在使用openCV FastFeatureDetector从图像中提取快速关键点。 但是FastFeatureDetector检测的编号不是常量编号。 我想设置FastFeatureDetector获取的最大关键点数。 我可以指定使用openCV FastFeatureDetector时获得的快速关键点编号吗 怎么做?我最近遇到了这个问题,经过短暂的搜索,我找到了DynamicAdaptedFeatureDetector,它迭代检测关键点,直到找到所需的数字 检查: 代码: int maxK
但是FastFeatureDetector检测的编号不是常量编号。
我想设置FastFeatureDetector获取的最大关键点数。
我可以指定使用openCV FastFeatureDetector时获得的快速关键点编号吗
怎么做?我最近遇到了这个问题,经过短暂的搜索,我找到了DynamicAdaptedFeatureDetector,它迭代检测关键点,直到找到所需的数字 检查: 代码:
int maxKeypoints,minKeypoints;
Ptr调整=新的快速调整器();
Ptr检测器=新的DynamicAdaptedFeatureDetector(调整,最小关键点,最大关键点,100);
矢量关键点;
检测器->检测(图像、关键点);
我提供了代码的主要部分,在这种情况下,您可以根据需要设置关键点的数量。祝你好运
# define MAX_FEATURE 500 // specify maximum expected feature size
string detectorType = "FAST";
string descriptorType = "SIFT";
detector = FeatureDetector::create(detectorType);
extractor = DescriptorExtractor::create(descriptorType);
Mat descriptors;
vector<KeyPoint> keypoints;
detector->detect(img, keypoints);
if( keypoints.size() > MAX_FEATURE )
{
cout << " [INFO] key-point 1 size: " << keypoints.size() << endl;
KeyPointsFilter::retainBest(keypoints, MAX_FEATURE);
}
cout << " [INFO] key-point 2 size: " << keypoints.size() << endl;
extractor->compute(img, keypoints, descriptors);
#定义最大功能500//指定最大预期功能大小
字符串检测类型=“快速”;
字符串描述符type=“SIFT”;
检测器=功能检测器::创建(检测器类型);
提取器=描述符牵引器::创建(描述符类型);
Mat描述符;
矢量关键点;
检测器->检测(img,关键点);
if(keypoints.size()>最大功能)
{
cout另一种解决方案是用低阈值检测尽可能多的关键点,并应用自适应非最大抑制(ANMS)如中所述。您可以指定所需的点数。此外,您可以免费获得图像上均匀分布的点数。可以找到代码。关键点的数目取决于图像。您不能强制检测器在没有任何关键点的地方找到关键点。因此,获得常量的唯一方法是指定t他设定了输出点数的最大值,然后保证每个图像的输出点数都超过这个值。
# define MAX_FEATURE 500 // specify maximum expected feature size
string detectorType = "FAST";
string descriptorType = "SIFT";
detector = FeatureDetector::create(detectorType);
extractor = DescriptorExtractor::create(descriptorType);
Mat descriptors;
vector<KeyPoint> keypoints;
detector->detect(img, keypoints);
if( keypoints.size() > MAX_FEATURE )
{
cout << " [INFO] key-point 1 size: " << keypoints.size() << endl;
KeyPointsFilter::retainBest(keypoints, MAX_FEATURE);
}
cout << " [INFO] key-point 2 size: " << keypoints.size() << endl;
extractor->compute(img, keypoints, descriptors);