-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.cpp
42 lines (36 loc) · 1.05 KB
/
main.cpp
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
//
// main.cpp
// stereo-visualization
//
// Created by Carlos Zoido on 09/01/2019.
//
#include "stereo_pair_processor.hpp"
#include "opengl_viewer.hpp"
int main( int argc, const char** argv )
{
const int deviceid = 1;
cv::VideoCapture capture;
if (!capture.isOpened())
capture.open(deviceid);
if (!capture.isOpened()) {
std::cerr << "Failed to open the video device, video file or image sequence!\n" << std::endl;
return 1;
}
OpenGLViewer viewer;
StereoPairProcessor stereo_processor("intrinsics.yml","extrinsics.yml");
cv::Mat frame;
char key = -1;
while (key != 27 && !viewer.ShouldClose()) {
capture >> frame;
if (frame.empty())
break;
else {
std::tuple<cv::Mat,cv::Mat> point_cloud = stereo_processor.CalcPointCloud(frame);
// returns a points list and an image
viewer.RenderFrame(std::get<1>(point_cloud),std::get<0>(point_cloud));
}
key = (char)cv::waitKey(11);
}
viewer.terminate();
return 0;
}