-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnoise_remover.cpp
59 lines (47 loc) · 1.58 KB
/
noise_remover.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
#include "commandline.hpp"
#include <sstream>
int main(int ac, char *av[]) {
cout << ac << "Arguments received" << endl;
int meank;
float stddev;
if (ac != 3)
cout << "Invalid arguments" << endl;
else {
stringstream meank_str;
stringstream stddev_str;
meank_str << av[1];
stddev_str << av[2];
meank_str >> meank;
stddev_str >> stddev;
}
model cloud_model;
std::vector <string> file_path;
for (int i = 0; i < ac; i++) {
string temp = "./temp/MK" + boost::lexical_cast<std::string>(i) + ".pcd";
boost::filesystem::path p(temp);
if (boost::filesystem::exists(p)) {
file_path.push_back(temp);
cout << file_path.back() << endl; // find until last MK_i file then break.
} else
break;
}
cout << "Opening..." << endl;
cout << cloud_model.open_files(file_path) << "Files" << endl;
cout << "In noise canceling..." << endl;
if (ac == 3) {
cout << cloud_model.noise_cancel(meank, stddev);
} else
cout << cloud_model.noise_cancel();
for (int i = 0;; i++) {
string temp = "./temp/" + boost::lexical_cast<std::string>(i) + ".pcd";
boost::filesystem::path p(temp);
if (boost::filesystem::exists(p)) {
boost::filesystem::remove_all(p); // delete until last MK_i file then break.
cout << "Deleting... " << temp << endl;
} else
break;
}
cout << "Saving..." << cloud_model.save_files("./temp/");
cloud_model.visualize_cloud();
return 0;
}