-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathmain.cpp
67 lines (51 loc) · 1.78 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// main.cpp
// DfUSMC: Depth from Uncalibrated Small Motion Clip
//
// Created by Hyowon Ha on 2016. 6. 11..
// Copyright © 2016 Hyowon Ha. All rights reserved.
//
#include <iostream>
#include "DfUSMC.hpp"
int main(int argc, const char * argv[]) {
char data_name[1024], video_format[1024];
if (argc!=3) {
printf("Usage: DfUSMC <data_name> <video_extension>\n");
return -1;
}
else {
sprintf(data_name, "%s", argv[1]);
sprintf(video_format, "%s", argv[2]);
}
DfUSMC dfusmc;
// load small motion clip
char fullpath[1024];
sprintf(fullpath,"Dataset/%s.%s",data_name,video_format);
dfusmc.LoadSmallMotionClip(fullpath);
// (optional) save Reference image
sprintf(fullpath,"Result/%s_ref.bmp",data_name);
dfusmc.SaveReferenceImage(fullpath);
// feature extraction and tracking
dfusmc.FeatureExtractionAndTracking();
// bundle adjustment
dfusmc.BundleAdjustment();
// (optional) save sparse reconstruction result.
sprintf(fullpath,"Result/%s.ply",data_name);
dfusmc.SavePointCloudPLY(fullpath);
// image undistortion
dfusmc.UndistortImages();
// dense matching
dfusmc.DenseMatching(0.5, 64, 3.0, 0.2);
// (optional) save Winner-Takes-All depthmap result.
sprintf(fullpath,"Result/%s_WTA.bmp",data_name);
dfusmc.SaveDepthmapWTA(fullpath, true);
// (optional) save filtered depthmap result.
sprintf(fullpath,"Result/%s_Filtered.bmp",data_name);
dfusmc.SaveDepthmapFiltered(fullpath, true);
// (optional) save refined depthmap result.
sprintf(fullpath,"Result/%s_Refined.bmp",data_name);
dfusmc.SaveDepthmapRefined(fullpath, true);
waitKey(0);
std::cout << "Done.\n";
return 0;
}