-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_min_cut.cpp
64 lines (53 loc) · 1.66 KB
/
test_min_cut.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
#include "globals.hpp"
#include "min_cut.cpp"
#include "read_bin_file.cpp"
#include "super_pixel.cpp"
#include <iostream>
#include <vector>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>
#include <boost/graph/graphviz.hpp>
#include <boost/graph/push_relabel_max_flow.hpp>
using namespace boost;
int main() {
std::vector<BYTE> *imageFileData = readFile("assets/orange.bin");
width = 320;
height = 249;
superpixel(*imageFileData);
classPoints.push_back(ClassPoint{0, 100, 125});
classPoints.push_back(ClassPoint{0, 160, 125});
classPoints.push_back(ClassPoint{0, 180, 125});
classPoints.push_back(ClassPoint{0, 130, 200});
classPoints.push_back(ClassPoint{0, 67, 190});
classPoints.push_back(ClassPoint{1, 10, 10});
classPoints.push_back(ClassPoint{1, 100, 10});
classPoints.push_back(ClassPoint{1, 150, 10});
classPoints.push_back(ClassPoint{1, 240, 300});
classPoints.push_back(ClassPoint{1, 100, 300});
// classPoints.push_back(ClassPoint{0, 0, 0});
// classPoints.push_back(ClassPoint{1, 0, 1});
// numClusters = 2;
// clusters.resize(1, 2);
// clusters(0, 0) = 0;
// clusters(0, 1) = 1;
// clusters(1, 0) = 2;
// clusters(1, 1) = 3;
// spAdjMap.clear();
// spAdjMap[0][1] = 0.2;
// spAdjMap[1][0] = 0.2;
// spAdjMap[0][2] = 0.3;
// spAdjMap[1][2] = 0.5;
// spAdjMap[1][3] = 0.5;
// spAdjMap[2][3] = 0.7;
prepareForMinCuts();
minCutCls(0);
minCutCls(1);
resolveMasks();
std::ofstream fout;
fout.open("mincut.bin", std::ios::binary | std::ios::out);
for (int i = 0; i < coloredMask.size(); i++) {
fout.write((char *)&coloredMask[i], 4);
}
fout.close();
return 0;
}