gpt4 book ai didi

c++ - 如何获取关键点 "within the homography"?

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:13:10 27 4
gpt4 key购买 nike

引用this回答this question :

What is happening is that you're considering all the keypoints detected in the second image for the calculation of repeatability and actually only the keypoints within the homography should be used.

我不知道怎么得到

keypoints withing the homography

有人可以解释一下怎么做吗?

编辑:

实际看evaluation.cpp的代码,我认为这个操作已经执行了。事实上,看看:

float overlapThreshold;
bool ifEvaluateDetectors = thresholdedOverlapMask == 0;
if( ifEvaluateDetectors )
{
overlapThreshold = 1.f - 0.4f;

// remove key points from outside of the common image part
Size sz1 = img1.size(), sz2 = img2.size();
filterEllipticKeyPointsByImageSize( keypoints1, sz1 );
filterEllipticKeyPointsByImageSize( keypoints1t, sz2 );
filterEllipticKeyPointsByImageSize( keypoints2, sz2 );
filterEllipticKeyPointsByImageSize( keypoints2t, sz1 );
}
else
{
overlapThreshold = 1.f - 0.5f;

thresholdedOverlapMask->create( (int)keypoints1.size(), (int)keypoints2t.size(), CV_8UC1 );
thresholdedOverlapMask->setTo( Scalar::all(0) );
}

默认情况下考虑 thresholdedOverlapMask=0。所以 if 里面的部分舍弃了单应性之外的点。对吗?

最佳答案

keypoints withing the homographyThose are points that considered as inliers for the result Homograph Matrix. In other words:

假设您正在使用像 RANSAC 这样的估计技术来获取同形异义词矩阵,您的一些点将用于构建这个同形异义异义词。其他的只是噪音(异常值)。您需要知道您的哪些点不是噪声并且用于构建此同形异义词。


如何在 OpenCV 中做到这一点?

cv::findHomography 函数具有以下签名:

Mat findHomography(InputArray srcPoints, InputArray dstPoints, int method=0, double ransacReprojThreshold=3, OutputArray mask=noArray() );

参数 OutputArray mask 就是您要查找的内容。你可以像这样使用它:

std::vector<uchar> homograph_mask;
auto H= cv::findHomography(set_of_points, other_set_of_points, cv::RANSAC, RANSAC_THRESHOLSD, homograph_mask);
std::vector<std::pair<cv::Point,cv::Point>> points_within_the_homograph;
points_within_the_homograph.reserve(homograph_mask.size());
for(size_t i=0; i < homograph_mask.size();++i){
if(homograph_mask[i]==static_cast<uchar>(1)){
points_within_the_homograph.emplace_back(set_of_points[i],other_set_of_points[i]);
}
}
points_within_the_homograph.shrink_to_fit();

points_within_the_homograph 将包含一组在 Homograph(内点)内的匹配点对。

关于c++ - 如何获取关键点 "within the homography"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37586838/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com