-
Notifications
You must be signed in to change notification settings - Fork 0
/
PictureTester.java
executable file
·130 lines (120 loc) · 3.95 KB
/
PictureTester.java
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
import java.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
*/
public class PictureTester
{
/** Method to test zeroBlue */
public static void testZeroBlue()
{
Picture beach = new Picture("beach.jpg");
beach.explore();
beach.zeroBlue();
beach.explore();
}
/** Method to test mirrorVertical */
public static void testMirrorVertical()
{
Picture caterpillar = new Picture("caterpillar.jpg");
caterpillar.explore();
caterpillar.mirrorVertical();
caterpillar.explore();
}
/** Method to test mirrorTemple */
public static void testMirrorTemple()
{
Picture temple = new Picture("temple.jpg");
temple.explore();
temple.mirrorTemple();
temple.explore();
}
/** Method to test edgeDetection */
public static void testEdgeDetection()
{
Picture swan = new Picture("swan.jpg");
swan.edgeDetection(10);
swan.explore();
}
/** Method to test averagePics */
public static void testAveragePics()
{
ArrayList<Picture> pics = new ArrayList<Picture>();
pics.add(new Picture("faces/alex.jpg"));
pics.add(new Picture("faces/alexander.jpg"));
pics.add(new Picture("faces/alfred.jpg"));
pics.add(new Picture("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"));
Picture averagePic = new Picture(pics.get(0).getHeight(), pics.get(0).getWidth());
averagePic.averagePics(pics);
averagePic.explore();
}
/** Method to test cropAndCopy */
public static void testCropAndCopy()
{
Picture source = new Picture("testImageSrc.png");
Picture destination = new Picture("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 */
public static void main(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);
}
}