-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexamples.cpp
More file actions
60 lines (50 loc) · 1.72 KB
/
examples.cpp
File metadata and controls
60 lines (50 loc) · 1.72 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 "stdafx.h"
#include "opencv_pipeline.h"
namespace examples {
#define TESTDATA_DIR "D:/QMUL/test data/"
std::filesystem::path test_file = TESTDATA_DIR "images/monalisa.jpg";
void extract_descriptors_from_keypoints()
{
using namespace opencv_pipeline;
TESTDATA_DIR "images/monalisa.jpg" | load
| gray
| keypoints("HARRIS") | descriptors("SIFT")
| save("harris_sift.png") | load_ignore_failure;
}
void extract_descriptors_from_regions()
{
using namespace opencv_pipeline;
TESTDATA_DIR "images/monalisa.jpg" | load
| regions("MSCR") | descriptors("SIFT")
| save("mscr_sift.png") | load_ignore_failure;
}
void reuse_pipeline()
{
using namespace opencv_pipeline;
auto show_grey_mirrored = pipeline | gray | mirror | show("Image") | waitkey(0);
TESTDATA_DIR "images/monalisa.jpg" | load | show_grey_mirrored;
TESTDATA_DIR "images/african-art-1732250_960_720.jpg" | load | show_grey_mirrored;
}
void parameterised_pipeline()
{
using namespace opencv_pipeline;
auto pipeline = [](char const * const filename)->cv::Mat {
return
filename| load
| gray
| keypoints("HARRIS")
| descriptors("SIFT");
};
pipeline(TESTDATA_DIR "images/monalisa.jpg")
| save("monalisa-harris-sift.jpg") | load_ignore_failure;
pipeline(TESTDATA_DIR "images/da_vinci_human11.jpg")
| save("da_vinci_human11-harris-sift.png") | load_ignore_failure;
}
void run()
{
extract_descriptors_from_keypoints();
extract_descriptors_from_regions();
reuse_pipeline();
parameterised_pipeline();
}
} // namespace examples