91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 11KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2021-06-08
  • 語言: Html/CSS
  • 標簽: opencv????feature??match??

資源簡介

博客 http://www.cnblogs.com/wangguchangqing/p/4333873.html 中的demo代碼,鑒于有很多人想參考下,就上傳到這了。 主要是匹配后,計算兩視圖的基礎矩陣F,然后再除去不適合的匹配點. 代碼中 好像還有一部分三角計算的代碼

資源截圖

代碼片段和文件信息

#include?“FeatureMatchTest.h“
#include?

using?namespace?std;
using?namespace?cv;

FeatureMatchTest::FeatureMatchTest(std::shared_ptr?left?std::shared_ptr?right?std::shared_ptrriptorMatcher>?matcher)?:
leftPattern(left)?rightPattern(right)?matcher(matcher)?{

//step1:Create?detector
int?minHessian?=?400;
SurfFeatureDetector?detector(minHessian);

//step2:Detecte?keypoint
detector.detect(leftPattern->image?leftPattern->keypoints);
detector.detect(rightPattern->image?rightPattern->keypoints);

//step3:Compute?descriptor
detector.compute(leftPattern->image?leftPattern->keypoints?leftPattern->descriptors);
detector.compute(rightPattern->image?rightPattern->keypoints?rightPattern->descriptors);
}

void?FeatureMatchTest::match(vector&?matches)?{

matcher->match(leftPattern->descriptors?rightPattern->descriptors?matches);
}

void?FeatureMatchTest::knnMatch(vector&?matches)?{

const?float?minRatio?=?1.f?/?1.5f;
const?int?k?=?2;

vector>?knnMatches;
matcher->knnMatch(leftPattern->descriptors?rightPattern->descriptors?knnMatches?k);

for?(size_t?i?=?0;?i? const?DMatch&?bestMatch?=?knnMatches[i][0];
const?DMatch&?betterMatch?=?knnMatches[i][1];

float??distanceRatio?=?bestMatch.distance?/?betterMatch.distance;
if?(distanceRatio? matches.push_back(bestMatch);
}
}

void?FeatureMatchTest::refineMatcheswithHomography(vector&?matches?double?reprojectionThreshold?Mat&?homography){
const?int?minNumbermatchesAllowed?=?8;
if?(matches.size()? return;

//Prepare?data?for?findHomography
vector?srcPoints(matches.size());
vector?dstPoints(matches.size());

for?(size_t?i?=?0;?i? srcPoints[i]?=?rightPattern->keypoints[matches[i].trainIdx].pt;
dstPoints[i]?=?leftPattern->keypoints[matches[i].queryIdx].pt;
}

//find?homography?matrix?and?get?inliers?mask
vector?inliersMask(srcPoints.size());
homography?=?findHomography(srcPoints?dstPoints?CV_FM_RANSAC?reprojectionThreshold?inliersMask);

vector?inliers;
for?(size_t?i?=?0;?i? if?(inliersMask[i])
inliers.push_back(matches[i]);
}
matches.swap(inliers);
}

void?FeatureMatchTest::refineMatchesWithFundmentalMatrix(vector&?matches?Mat&?F)?{
//Align?all?points
vector?alignedKps1?alignedKps2;
for?(size_t?i?=?0;?i? alignedKps1.push_back(leftPattern->keypoints[matches[i].queryIdx]);
alignedKps2.push_back(rightPattern->keypoints[matches[i].trainIdx]);
}

//Keypoints?to?points
vector?ps1?ps2;
for?(unsigned?i?=?0;?i? ps1.push_back(alignedKps1[i].pt);

for?(unsigned?i?=?0;?i? ps2.push_back(alignedKps2[i].pt);

//Compute?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????4365??2015-03-26?20:34??FeatureMatchDemo\FeatureMatchDemo\FeatureMatchDemo.vcxproj

?????文件???????1174??2015-03-11?22:16??FeatureMatchDemo\FeatureMatchDemo\FeatureMatchDemo.vcxproj.filters

?????文件???????4035??2015-03-11?22:40??FeatureMatchDemo\FeatureMatchDemo\FeatureMatchTest.cpp

?????文件???????1000??2015-03-11?22:45??FeatureMatchDemo\FeatureMatchDemo\FeatureMatchTest.h

?????文件???????1219??2015-03-26?14:58??FeatureMatchDemo\FeatureMatchDemo\main.cpp

?????文件???????3956??2015-03-26?21:25??FeatureMatchDemo\FeatureMatchDemo\Triangulation.cpp

?????文件????????862??2015-03-26?20:43??FeatureMatchDemo\FeatureMatchDemo\Triangulation.h

?????文件????????994??2015-03-08?22:58??FeatureMatchDemo\FeatureMatchDemo.sln

????..A..H.?????34816??2017-01-04?23:02??FeatureMatchDemo\FeatureMatchDemo.v12.suo

?????目錄??????????0??2017-01-04?23:01??FeatureMatchDemo\FeatureMatchDemo

?????目錄??????????0??2017-01-04?23:02??FeatureMatchDemo

-----------?---------??----------?-----??----

????????????????52421????????????????????11


評論

共有 條評論