问题描述
我正在使用 SIFT 检测关键点以拼接由两个不同相机拍摄的两张图像作为全景图像。这是通用的关键点检测代码。我尝试拼接的图像是:first picture second picture 而匹配项是 matches
我的问题是关键点的数量非常少,而且这些图像在我的训练中是最匹配的。但是,当我从一台相机拍摄图像并将图像裁剪为具有公共场的两部分时,结果很好。 但是从两个不同的相机拍摄的不同图像关键点非常差。有什么问题? 问候
Ptr<SIFT> detector = SIFT::create();
std::vector <KeyPoint> kp1,kp2;
Mat descriptors1,descriptors2;
detector -> detectAndCompute (imageA,noArray(),kp1,descriptors1);
detector -> detectAndCompute (imageB,kp2,descriptors2);
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create(DescriptorMatcher::FLANNBASED);
std::vector <std::vector<DMatch>> knnMatches;
matcher -> knnMatch(descriptors1,descriptors2,knnMatches,2);
const float ratioThresh = 0.6f;
std::vector<DMatch>good_matches;
for(size_t i = 0; i<knnMatches.size(); i++) {
if(knnMatches[i][0].distance < ratioThresh*knnMatches[i][1].distance) {
good_matches.push_back(knnMatches[i][0]);
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)