簡體   English   中英

使用給定坐標打開cv特征匹配

[英]open cv Feature matching using given coordinates

我正在使用openCv,FAST特征檢測和蠻力匹配在立體圖像之間進行特征匹配。

            FastFeatureDetector detector(threshold);
            detector.detect(img1, keypoints1);
            detector.detect(img2, keypoints2);

            OrbDescriptorExtractor extractor;
            extractor.compute(img1, keypoints1, descriptors1);
            extractor.compute(img2, keypoints2, descriptors2);

            BFMatcher matcher(NORM_L2);
            matcher.match(descriptors1, descriptors2, matches);

但是我想做的是,使用光流在左框架上跟蹤點,然后使用特征匹配來匹配右框架上的那些點。

是否可以向功能匹配函數提供您要匹配的點的像素坐標?

您不能將其指定給匹配器,但是可以限制提取時的點數。 在您的代碼中, keypoints1keypoints2可以是僅希望匹配的點的提取器的輸入。 因此,您應該執行以下操作:

// perform "optical flow tracking" and get some points
// for left and right frame

// convert them to cv::KeyPoint
// cv::KeyPoint keypoints1; // left frames
// cv::KeyPoint keypoints1; // right frames

// extract feature for those points only
OrbDescriptorExtractor extractor;
extractor.compute(img1, keypoints1, descriptors1);
extractor.compute(img2, keypoints2, descriptors2);

// match for the descriptors computed at the pixel coordinates
// given by the "optical flow tracking" only
BFMatcher matcher(NORM_L2);
matcher.match(descriptors1, descriptors2, matches);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM