我使用openCV FastFeatureDetector從圖像中提取快速關鍵點。
但FastFeatureDetector檢測的數量不是常數。
我想設置最大關鍵點數FastFeatureDetector獲得。
我可以指定使用openCV時獲得的FAST關鍵點編號FastFeatureDetector
如何?我可以指定我使用opencv時獲得的FAST關鍵點數FastFeatureDetector
1
A
回答
0
我最近遇到了這個問題,經過簡短的搜索,我發現DynamicAdaptedFeatureDetector迭代檢測關鍵點,直到找到所需的數字。
代碼:
int maxKeypoints, minKeypoints;
Ptr<FastAdjuster> adjust = new FastAdjuster();
Ptr<FeatureDetector> detector = new DynamicAdaptedFeatureDetector(adjust,minKeypoints,maxKeypoints,100);
vector<KeyPoint> keypoints;
detector->detect(image, keypoints);
0
我提供的代碼的主要部分,在這種情況下,你可以設置關鍵點的數量,你所期望的。祝你好運。
# 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);
0
相關問題
- 1. 從我的數據庫中指定關係可以獲得什麼?
- 2. 我可以指定關鍵幀的百分比?
- 3. FastFeatureDetector opencv C++篩選結果
- 4. 我可以使用dateadd函數指定前一天的時間
- 5. 我可以使用SChannel獲得SOCKET嗎?
- 6. 我在哪裏可以獲得JQuery ui指定的選項?
- 7. OpenCV的 - 只畫出對象是關鍵點是指使用python
- 8. OpenCV中不能得出關鍵點
- 9. 我可以從SQL上的數組獲得多個外鍵嗎?
- 10. 什麼是「關鍵點」[opencv上下文],FAST,GetStarKeypoints等有什麼作用?
- 11. 我可以指定我的視頻何時以html開始?
- 12. 我可以在特定時區獲得時間戳嗎?
- 13. 從關聯數組僅獲得該元素的鍵指定
- 14. FAST函數OpenCV Debug Assertion Faild
- 15. casperjs:我可以使用'require'關鍵字在casperjs中使用節點包嗎?
- 16. 當我使用dot.js寺廟時,可以獲得html dom val嗎?
- 17. 使用OpenCV複製時指定指針
- 18. 使用jQuery.get時,我可以指定相對URL嗎?
- 19. 而不是使用同步關鍵字我正在使用鎖定概念,但我沒有得到輸出,因爲我在同步關鍵詞中獲得?
- 20. 我可以指向OpenCV的在線許可聲明嗎?
- 21. 我可以在代碼隱藏中獲得風格的關鍵嗎? (WPF)
- 22. 我在哪裏可以獲得有關iTunes的指導或模板?
- 23. 使用Reddit API PRAW,我可以在指定的時間範圍內獲得最受歡迎的sub-reddits嗎?
- 24. 我可以得到可使用robotium
- 25. OpenCV SURF關鍵點比較
- 26. 使用OpenCV獲取指定點的SIFT描述符
- 27. 我可以使用模數來指定postgres中的時間間隔嗎?
- 28. 我可以從OpenDJ獲得JMX的這些指標嗎?
- 29. 我可以在創建Elastic Beanstalk時指定可用區
- 30. 我可以使用sass爲關鍵幀中的元素指定ID以減少CSS嗎?
關鍵點的數量取決於圖像。你不能強迫探測器找到沒有的關鍵點。因此,獲得一個固定數字的唯一方法是指定最大輸出點數量,然後保證每個圖像的數量都不止於此。 – System123