-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·67 lines (55 loc) · 1.6 KB
/
main.cpp
File metadata and controls
executable file
·67 lines (55 loc) · 1.6 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
// File: main.cpp
// Author: cheeren
// Date: 2018-02-25
// Description: Partial test of PA3 functionality
// Reads Point data from external files
// Produces PNG images of the point sets
#include "twoDtree.h"
#include "cs221util/RGBAPixel.h"
#include "cs221util/PNG.h"
using namespace cs221util;
using namespace std;
int main()
{
// read in image
PNG origIm1;
origIm1.readFromFile("images/stanley-totem-poles.png");
PNG origIm2;
origIm2.readFromFile("images/ubc-totem-poles.png");
PNG origIm3;
origIm3.readFromFile("images/remb.png");
PNG origIm4;
origIm4.readFromFile("images/rosa.png");
// PNG origIm5;
// origIm5.readFromFile("images/library.png");
// use it to build a twoDtree
twoDtree t1(origIm1);
twoDtree tCopy1(t1);
twoDtree t2(origIm2);
twoDtree tCopy2(t2);
twoDtree t3(origIm3);
twoDtree tCopy3(t3);
twoDtree t4(origIm4);
twoDtree tCopy4(t4);
// twoDtree t5(origIm5);
// twoDtree tCopy5(t5);
// prune the twoDtree
//where at least 100*X% of pixels are within Y of mean
tCopy1.prune(0.95, 10000);
tCopy2.prune(0.95, 10000);
tCopy3.prune(0.95, 3000);
tCopy4.prune(0.95, 3000);
// tCopy5.prune(0.95, 3000);
// render the twoDtree
PNG ppic1 = tCopy1.render();
PNG ppic2 = tCopy2.render();
PNG ppic3 = tCopy3.render();
PNG ppic4 = tCopy4.render();
// PNG ppic5 = tCopy5.render();
ppic1.writeToFile("images/prunedstanleytotem.png");
ppic2.writeToFile("images/prunedubctotem.png");
ppic3.writeToFile("images/prunedremb.png");
ppic4.writeToFile("images/prunedrosa.png");
// ppic5.writeToFile("images/prunelibrary.png");
return 0;
}