summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-04-06 01:01:48 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-04-08 20:57:27 +0200
commit8edb1a7ee2c0ff20ea957bb0182335ede2f531e8 (patch)
tree9437f4b62833223070b948c75e22a087836bb55b
parented8599871364d293cd18220d255b8c7d09ae7dfc (diff)
downloadcoursera-8edb1a7ee2c0ff20ea957bb0182335ede2f531e8.zip
coursera-8edb1a7ee2c0ff20ea957bb0182335ede2f531e8.tar.gz
Algorithms-II : 2-SeamCarving: add ok.png, modify ResizeDemo.java Makefile to check result
-rw-r--r--Algorithms/Part-II/2-SeamCarving/Makefile2
-rw-r--r--Algorithms/Part-II/2-SeamCarving/ResizeDemo.java6
-rw-r--r--Algorithms/Part-II/2-SeamCarving/ok.pngbin0 -> 301380 bytes
3 files changed, 5 insertions, 3 deletions
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
--- /dev/null
+++ b/Algorithms/Part-II/2-SeamCarving/ok.png
Binary files differ