summaryrefslogtreecommitdiffstats
path: root/Algorithms/Part-II/2-SeamCarving/ShowEnergy.java
diff options
context:
space:
mode:
Diffstat (limited to 'Algorithms/Part-II/2-SeamCarving/ShowEnergy.java')
-rw-r--r--Algorithms/Part-II/2-SeamCarving/ShowEnergy.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/Algorithms/Part-II/2-SeamCarving/ShowEnergy.java b/Algorithms/Part-II/2-SeamCarving/ShowEnergy.java
new file mode 100644
index 0000000..fa0edfa
--- /dev/null
+++ b/Algorithms/Part-II/2-SeamCarving/ShowEnergy.java
@@ -0,0 +1,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);
+
+ }
+
+}