-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdoor_finder.cpp
More file actions
72 lines (59 loc) · 1.88 KB
/
Copy pathdoor_finder.cpp
File metadata and controls
72 lines (59 loc) · 1.88 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
63
64
65
66
67
68
69
70
#include "edge_detector.h"
void printUsage(){
cout << "Usage: ./edge_detector <mode: [1, 3]> <filename>\n"
<< "This program can run with 0, 1, or 2 arguements\n"
<< "With no arguments, this program will not write any data and"
<< " will read data from a device\n"
<< "If the first argument is a 1, then the program will function "
<< "like it would with no arguments\n"
<< "If the first argument is 2, then the program will write the "
<< "Point Cloud data to a file\n"
<< "If the first argument is 3, then the program will read "
<< "Point Cloud data from a file\n"
<< "The third argument sets the filename to be read or written to\n";
}
int main (int argc, char * argv[])
{
EdgeDetector v( "../config.txt" );
//if there are no arguments, print the usage and run the file;
if ( argc == 1 ){
v.run();
printUsage();
}
//if there are two or three arguments, execute the code normally;
else if (argc <= 4){
//if there are two extra arguments, then set the
if ( argc >= 3 ){
v.filename = argv[2];
}
if ( argc == 4 ){
int value = atoi( argv[1] );
if (value == 1 ){
v.showImage = false;
}
}
int value = atoi( argv[1] );
if (value == 1 ){
cout << "Running edge detection" << "\n";
v.run();
}
else if ( value == 2 ){
cout << "Running edge detection and saving data to the file: "
<< v.filename << "\n";
v.doWrite = true;
v.run();
}
else if( value == 3 ){
cout << "Running edge detection with the data from the file: "
<< v.filename << "\n";
v.runWithInputFile();
}
else {
printUsage();
}
}
else{
printUsage();
}
return 0;
}