-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowEnergy.java
31 lines (24 loc) · 917 Bytes
/
ShowEnergy.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
/*
*****************************************************************************
* Compilation: javac ShowEnergy.java
* Execution: java ShowEnergy input.png
* Dependencies: SeamCarver.java SCUtility.java
*
*
* Read image from file specified as command line argument. Show original
* image (only useful if image is large enough).
*
*****************************************************************************
*/
import edu.princeton.cs.algs4.Picture;
import edu.princeton.cs.algs4.StdOut;
public class ShowEnergy {
public static void main(String[] args) {
Picture picture = new Picture(args[0]);
StdOut.printf("image is %d columns by %d rows\n", picture.width(), picture.height());
picture.show();
SeamCarver sc = new SeamCarver(picture);
StdOut.printf("Displaying energy calculated for each pixel.\n");
SCUtility.showEnergy(sc);
}
}