summaryrefslogtreecommitdiffstats
path: root/Algorithms/Part-II/2-SeamCarving/ShowEnergy.java
blob: fa0edfac31d0dd90b462656ce0b075fe36c55957 (plain)
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
/*************************************************************************
 *  Compilation:  javac ShowEnergy.java
 *  Execution:    java ShowEnergy input.png
 *  Dependencies: SeamCarver.java SCUtility.java Picture.java StdDraw.java
 *
 *
 *  Read image from file specified as command line argument. Show original
 *  image (only useful if image is large enough).
 *
 *************************************************************************/

public class ShowEnergy {

    public static void main(String[] args)
    {
        Picture inputImg = new Picture(args[0]);
        System.out.printf("image is %d columns by %d rows\n",
                          inputImg.width(), inputImg.height());
        inputImg.show();
        SeamCarver sc = new SeamCarver(inputImg);

        System.out.printf("Displaying energy calculated for each pixel.\n");
        SCUtility.showEnergy(sc);

    }

}