forked from royshil/SfM-Toy-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommon.cpp
More file actions
36 lines (31 loc) · 1.04 KB
/
Copy pathCommon.cpp
File metadata and controls
36 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* Common.cpp
* SfMToyExample
*
* Created by Roy Shilkrot on 4/27/12.
* Copyright 2012 MIT. All rights reserved.
*
*/
#include "Common.h"
#include <iostream>
using namespace std;
using namespace cv;
std::vector<cv::Point3d> CloudPointsToPoints(const std::vector<CloudPoint> cpts) {
std::vector<cv::Point3d> out;
for (unsigned int i=0; i<cpts.size(); i++) {
out.push_back(cpts[i].pt);
}
return out;
}
void GetAlignedPointsFromMatch(const std::vector<cv::KeyPoint>& imgpts1,
const std::vector<cv::KeyPoint>& imgpts2,
const std::vector<cv::DMatch>& matches,
std::vector<cv::KeyPoint>& pt_set1,
std::vector<cv::KeyPoint>& pt_set2) {
// cout << "imgpts1.size() " << imgpts1.size() << " imgpts2.size() " << imgpts2.size() <<endl;
for (unsigned int i=0; i<matches.size(); i++) {
// cout << "matches[i].queryIdx " << matches[i].queryIdx << " matches[i].trainIdx " << matches[i].trainIdx << endl;
pt_set1.push_back(imgpts1[matches[i].queryIdx]);
pt_set2.push_back(imgpts2[matches[i].trainIdx]);
}
}