-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpcsegment.cpp
More file actions
62 lines (49 loc) · 1.23 KB
/
pcsegment.cpp
File metadata and controls
62 lines (49 loc) · 1.23 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "pcsegment.h"
PCSegment::PCSegment (CameraShot *cs1, CameraShot *cs2)
{
_cs1 = cs1;
_cs2 = cs2;
_vectX.clear ();
_matches.clear ();
_points1.clear ();
_points2.clear ();
}
vector<cv::DMatch> *PCSegment::getMatches (void)
{
return &_matches;
}
vector<cv::Point3d> *PCSegment::getVectorX (void)
{
return &_vectX;
}
vector<cv::Point2f> *PCSegment::getPoints1 (void)
{
return &_points1;
}
vector<cv::Point2f> *PCSegment::getPoints2 (void)
{
return &_points2;
}
CameraShot *PCSegment::getCamShot1 (void)
{
return _cs1;
}
CameraShot *PCSegment::getCamShot2 (void)
{
return _cs2;
}
void PCSegment::squeezePointsVectorsOutOfMatches (void)
{
float x1, y1, x2, y2;
vector<cv::KeyPoint> *keypoints1 = _cs1->getKeyPoints ();
vector<cv::KeyPoint> *keypoints2 = _cs2->getKeyPoints ();
for (vector<cv::DMatch>::const_iterator it=(_matches).begin (); it!=(_matches).end (); ++it)
{
x1 = (*keypoints1) [it->queryIdx].pt.x;
y1 = (*keypoints1) [it->queryIdx].pt.y;
_points1.push_back (cv::Point2f (x1,y1));
x2 = (*keypoints2) [it->trainIdx].pt.x;
y2 = (*keypoints2) [it->trainIdx].pt.y;
_points2.push_back (cv::Point2f (x2,y2));
}
}