-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cpp
68 lines (61 loc) · 2.18 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
68
#include <iostream>
#include "samples/samples.hpp"
int main(int argc, char *argv[])
{
using namespace std;
cout << "*****************************************\n";
cout << "1. RANSAC fit planes\n";
cout << "2. Total least squares\n";
cout << "3. Voxel grid filter sampling\n";
cout << "4. Random sampling\n";
cout << "5. Farthest point sampling\n";
cout << "Please select the sample to run:(1~5):";
int num, max_iters, desired_num_planes;
float grid_size, thr, sampled_scale;
cin >> num;
string test_file_path;
if (argc > 1)
{
test_file_path = argv[1];
}
else if (num != 2)
{
cout << "Please enter the path of the point cloud file (.ply): ";
cin >> test_file_path;
}
switch (num)
{
case 1:
cout << "Please enter inlier point threshold(e.g. 0.5): ";
cin >> thr;
cout << "Please enter desired number of planes(e.g. 2): ";
cin >> desired_num_planes;
cout << "Please enter RANSAC max iterations(e.g. 500): ";
cin >> max_iters;
cout << "Please enter the grid size length(e.g. 0.2), Less than or equal to 0 means no down-sampling is used: ";
cin >> grid_size;
cv::_3d::ransacFitPlanesSample(test_file_path, thr, desired_num_planes, max_iters, grid_size);
break;
case 2:
cv::_3d::totalLeastSquaresSample();
break;
case 3:
cout << "Please enter the grid size length(e.g. 0.2): ";
cin >> grid_size;
cv::_3d::voxelGridSamplingSample(test_file_path, grid_size);
break;
case 4:
cout << "Please enter the Please input sampling scale(e.g. 0.2): ";
cin >> sampled_scale;
cv::_3d::randomSamplingSample(test_file_path, sampled_scale);
break;
case 5:
cout << "Please enter the Please input sampling scale(e.g. 0.2): ";
cin >> sampled_scale;
cv::_3d::farthestPointSamplingSample(test_file_path, sampled_scale);
break;
default:
cout << "This sample does not exist.\n";
}
return 0;
}