-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathstress.cpp
More file actions
executable file
·62 lines (49 loc) · 1.52 KB
/
stress.cpp
File metadata and controls
executable file
·62 lines (49 loc) · 1.52 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
#include <boost/program_options.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/progress.hpp>
#include "picpac.h"
#include "picpac-cv.h"
#include "picpac-util.h"
using namespace std;
using namespace boost;
using namespace picpac;
int main(int argc, char **argv) {
namespace po = boost::program_options;
fs::path db_path;
unsigned N;
BatchImageStream::Config config;
po::options_description desc("Allowed options");
desc.add_options()
("help,h", "produce help message.")
("db", po::value(&db_path), "")
(",N", po::value(&N)->default_value(16000), "")
;
#define PICPAC_CONFIG_UPDATE(C,p) desc.add_options()(#p, po::value(&C.p)->default_value(C.p), "")
PICPAC_CONFIG_UPDATE_ALL(config);
#undef PICPAC_CONFIG_UPDATE
po::positional_options_description p;
p.add("db", 1);
po::variables_map vm;
po::store(po::command_line_parser(argc, argv).
options(desc).positional(p).run(), vm);
po::notify(vm);
if (vm.count("help") || db_path.empty()) {
cerr << desc;
return 1;
}
google::InitGoogleLogging(argv[0]);
cv::setNumThreads(1);
ImageStream stream(db_path, config);
progress_display progress(N, cerr);
for (unsigned i = 0; i < N; ++i) {
auto v(stream.next());
CHECK(v.image.data);
if (config.annotate.size()) {
CHECK(v.annotation.data);
}
++progress;
}
return 0;
}