Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPictureTester.java
More file actions
Latest commit
executable file
·130 lines (120 loc) · 3.95 KB
/
Copy pathPictureTester.java
File metadata and controls
executable file
·130 lines (120 loc) · 3.95 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
importjava.util.ArrayList;
/**
* This class contains class (static) methods
* that will help you test the Picture class
* methods. Uncomment the methods and the code
* in the main to test.
*
* @author Barbara Ericson
*/
publicclassPictureTester
{
/** Method to test zeroBlue */
publicstaticvoidtestZeroBlue()
{
Picturebeach = newPicture("beach.jpg");
beach.explore();
beach.zeroBlue();
beach.explore();
}
/** Method to test mirrorVertical */
publicstaticvoidtestMirrorVertical()
{
Picturecaterpillar = newPicture("caterpillar.jpg");
caterpillar.explore();
caterpillar.mirrorVertical();
caterpillar.explore();
}
/** Method to test mirrorTemple */
publicstaticvoidtestMirrorTemple()
{
Picturetemple = newPicture("temple.jpg");
temple.explore();
temple.mirrorTemple();
temple.explore();
}
/** Method to test edgeDetection */
publicstaticvoidtestEdgeDetection()
{
Pictureswan = newPicture("swan.jpg");
swan.edgeDetection(10);
swan.explore();
}
/** Method to test averagePics */
publicstaticvoidtestAveragePics()
{
ArrayList<Picture> pics = newArrayList<Picture>();
pics.add(newPicture("faces/alex.jpg"));
pics.add(newPicture("faces/alexander.jpg"));
pics.add(newPicture("faces/alfred.jpg"));
pics.add(newPicture("faces/ambroz.jpg"));
// pics.add(new Picture("faces/arnold.jpg"));
// pics.add(new Picture("faces/zelmira.jpg"));
// pics.add(new Picture("faces/zita.jpg"));
// pics.add(new Picture("faces/zlata.jpg"));
// pics.add(new Picture("faces/zlatica.jpg"));
// pics.add(new Picture("faces/zora.jpg"));
PictureaveragePic = newPicture(pics.get(0).getHeight(), pics.get(0).getWidth());
averagePic.averagePics(pics);
averagePic.explore();
}
/** Method to test cropAndCopy */
publicstaticvoidtestCropAndCopy()
{
Picturesource = newPicture("testImageSrc.png");
Picturedestination = newPicture("testImageDest.png");
source.explore();
destination.cropAndCopy(source,
250/* startSourceRow */,
350/* endSourceRow */,
100/* startSourceCol */,
300/* endSourceCol */,
100/* startDestRow */,
50/* startDestCol */ );
/* visually inspect the image to ensure no part of the yellow border
* is copied
*/
destination.explore();
destination.cropAndCopy(source,
250/* startSourceRow */,
350/* endSourceRow */,
100/* startSourceCol */,
300/* endSourceCol */,
150/* startDestRow */,
300/* startDestCol */ );
/* visually inspect the image to ensure that the orange rectangle is
* in the lower-right corner and no exceptions are generated
*/
destination.explore();
}
/** Main method for testing. Every class can have a main
* method in Java */
publicstaticvoidmain(String[] args)
{
// uncomment a call here to run a test
// and comment out the ones you don't want
// to run
testZeroBlue();
//testKeepOnlyBlue();
//testKeepOnlyRed();
//testKeepOnlyGreen();
//testNegate();
//testGrayscale();
//testFixUnderwater();
//testMirrorVertical();
//testMirrorTemple();
//testMirrorArms();
//testMirrorGull();
//testMirrorDiagonal();
//testCollage();
//testCopy();
//testEdgeDetection();
//testEdgeDetection2();
//testChromakey();
//testEncodeAndDecode();
//testGetCountRedOverValue(250);
//testSetRedToHalfValueInTopHalf();
//testClearBlueOverValue(200);
//testGetAverageForColumn(0);
}
}