From 8edb1a7ee2c0ff20ea957bb0182335ede2f531e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 6 Apr 2014 01:01:48 +0200 Subject: Algorithms-II : 2-SeamCarving: add ok.png, modify ResizeDemo.java Makefile to check result --- Algorithms/Part-II/2-SeamCarving/Makefile | 2 +- Algorithms/Part-II/2-SeamCarving/ResizeDemo.java | 6 ++++-- Algorithms/Part-II/2-SeamCarving/ok.png | Bin 0 -> 301380 bytes 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 Algorithms/Part-II/2-SeamCarving/ok.png diff --git a/Algorithms/Part-II/2-SeamCarving/Makefile b/Algorithms/Part-II/2-SeamCarving/Makefile index 335e05e..75cedde 100644 --- a/Algorithms/Part-II/2-SeamCarving/Makefile +++ b/Algorithms/Part-II/2-SeamCarving/Makefile @@ -32,7 +32,7 @@ check: $(BIN) $(CLASSES) check.sh ./check.sh HJoceanTransposed test: $(BIN) $(CLASSES) - java $(CLASSPATH) ResizeDemo ./data/HJocean.png 200 100 + java $(CLASSPATH) ResizeDemo ./data/HJocean.png 200 100 && cmp -b ok.png out.png && echo "OK" zip: $(BIN) $(ALGS4)/bin/findbugs $(BIN).class diff --git a/Algorithms/Part-II/2-SeamCarving/ResizeDemo.java b/Algorithms/Part-II/2-SeamCarving/ResizeDemo.java index 1b9f01d..d78eb44 100644 --- a/Algorithms/Part-II/2-SeamCarving/ResizeDemo.java +++ b/Algorithms/Part-II/2-SeamCarving/ResizeDemo.java @@ -40,14 +40,16 @@ public class ResizeDemo { int[] verticalSeam = sc.findVerticalSeam(); sc.removeVerticalSeam(verticalSeam); } + Picture outputImg = sc.picture(); System.out.printf("new image size is %d columns by %d rows\n", sc.width(), sc.height()); System.out.println("Resizing time: " + sw.elapsedTime() + " seconds."); - inputImg.show(); - outputImg.show(); + // inputImg.show(); + // outputImg.show(); + outputImg.save("out.png"); } } diff --git a/Algorithms/Part-II/2-SeamCarving/ok.png b/Algorithms/Part-II/2-SeamCarving/ok.png new file mode 100644 index 0000000..0e8b890 Binary files /dev/null and b/Algorithms/Part-II/2-SeamCarving/ok.png differ -- cgit v1.1-2-g2b99