-
Notifications
You must be signed in to change notification settings - Fork 0
/
terminal_helper.cpp
69 lines (61 loc) · 1.7 KB
/
terminal_helper.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
69
#include "terminal_helper.h"
#include <iostream>
using namespace std;
/**
* Prints the help section
*/
void tout_help(){
cout << "usage: scanEnhancer <path input file> <path output file> [filters]" << endl;
cout << " filter (needs at least one filter):" << endl;
cout << " -g <radius> apply gauss filter with radius" << endl;
cout << " -t <radius> <C> <text mode> apply mean threshold filter with radius and offset C" << endl;
cout << " > text mode = [0 = off | 1 = on] - colors all pixels that are not removed black" << endl;
}
/**
* Prints the start of mean threshold filter
*
* @param r radius
* @param C constant C
*/
void tout_startMT(int r, int C, int txt_mode){
cout << "Start mean threshold filter ( radius = " << r << " | C = " << C << "| text mode = " << txt_mode << ")..." << endl;
}
/**
* Prints the start of gauss filter
*
* @param r radius
*/
void tout_startGF(int r){
cout << "Start gauss filter ( radius = " << r << " )..." << endl;
}
/**
* Prints the time needed for processing the filters
*
* @param t_start start time
* @param t_end end time
*/
void tout_time(double t_start, double t_end){
cout << "Time required for processing " << (t_end-t_start) << " s" << endl;
}
/**
* Prints the start of gauss filter
*
* @param r radius
*/
void tout_err_txtmode(int txt_mode){
cerr << "Error: Wrong number for textmode specified (Your input: " << txt_mode << "). [0 = off | 1 = on]" << endl;
exit(1);
}
// Checker
/**
* Prints the start of gauss filter
*
* @param r radius
*/
bool check_txtmode(int mode) {
if(mode == 0 || mode == 1) return true;
else{
tout_err_txtmode(mode);
return false;
}
}