diff options
-rw-r--r-- | .gitignore | 110 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | output/.gitkeep | 0 | ||||
-rw-r--r-- | resources/americascup.jpg | bin | 0 -> 129001 bytes | |||
-rw-r--r-- | resources/cats.jpg | bin | 0 -> 85835 bytes | |||
-rw-r--r-- | resources/doves.jpg | bin | 0 -> 94442 bytes | |||
-rw-r--r-- | resources/hiroshige.jpg | bin | 0 -> 379809 bytes | |||
-rw-r--r-- | resources/tower.jpg | bin | 0 -> 202153 bytes | |||
-rw-r--r-- | src/main/java/Color.java | 120 | ||||
-rw-r--r-- | src/main/java/Filter.java | 76 | ||||
-rw-r--r-- | src/main/java/Helper.java | 140 | ||||
-rw-r--r-- | src/main/java/Main.java | 51 | ||||
-rw-r--r-- | src/main/java/Seam.java | 75 | ||||
-rw-r--r-- | src/main/java/SignatureChecks.java | 37 | ||||
-rw-r--r-- | src/test/java/Tests.java | 169 |
15 files changed, 780 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..11b5d8a --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,110 @@ | |||
1 | # Created by .ignore support plugin (hsz.mobi) | ||
2 | ### Eclipse template | ||
3 | *.pydevproject | ||
4 | .metadata | ||
5 | .gradle | ||
6 | bin/ | ||
7 | tmp/ | ||
8 | *.tmp | ||
9 | *.bak | ||
10 | *.swp | ||
11 | *~.nib | ||
12 | local.properties | ||
13 | .settings/ | ||
14 | .loadpath | ||
15 | |||
16 | # Eclipse Core | ||
17 | .project | ||
18 | |||
19 | # External tool builders | ||
20 | .externalToolBuilders/ | ||
21 | |||
22 | # Locally stored "Eclipse launch configurations" | ||
23 | *.launch | ||
24 | |||
25 | # CDT-specific | ||
26 | .cproject | ||
27 | |||
28 | # JDT-specific (Eclipse Java Development Tools) | ||
29 | .classpath | ||
30 | |||
31 | # Java annotation processor (APT) | ||
32 | .factorypath | ||
33 | |||
34 | # PDT-specific | ||
35 | .buildpath | ||
36 | |||
37 | # sbteclipse plugin | ||
38 | .target | ||
39 | |||
40 | # TeXlipse plugin | ||
41 | .texlipse | ||
42 | ### Java template | ||
43 | *.class | ||
44 | |||
45 | # Mobile Tools for Java (J2ME) | ||
46 | .mtj.tmp/ | ||
47 | |||
48 | # Package Files # | ||
49 | *.jar | ||
50 | *.war | ||
51 | *.ear | ||
52 | |||
53 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
54 | hs_err_pid* | ||
55 | ### Linux template | ||
56 | *~ | ||
57 | |||
58 | # KDE directory preferences | ||
59 | .directory | ||
60 | |||
61 | # Linux trash folder which might appear on any partition or disk | ||
62 | .Trash-* | ||
63 | ### JetBrains template | ||
64 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio | ||
65 | |||
66 | *.iml | ||
67 | |||
68 | ## Directory-based project format: | ||
69 | .idea/ | ||
70 | # if you remove the above rule, at least ignore the following: | ||
71 | |||
72 | # User-specific stuff: | ||
73 | # .idea/workspace.xml | ||
74 | # .idea/tasks.xml | ||
75 | # .idea/dictionaries | ||
76 | |||
77 | # Sensitive or high-churn files: | ||
78 | # .idea/dataSources.ids | ||
79 | # .idea/dataSources.xml | ||
80 | # .idea/sqlDataSources.xml | ||
81 | # .idea/dynamic.xml | ||
82 | # .idea/uiDesigner.xml | ||
83 | |||
84 | # Gradle: | ||
85 | # .idea/gradle.xml | ||
86 | # .idea/libraries | ||
87 | |||
88 | # Mongo Explorer plugin: | ||
89 | # .idea/mongoSettings.xml | ||
90 | |||
91 | ## File-based project format: | ||
92 | *.ipr | ||
93 | *.iws | ||
94 | |||
95 | ## Plugin-specific files: | ||
96 | |||
97 | # IntelliJ | ||
98 | /out/ | ||
99 | |||
100 | # mpeltonen/sbt-idea plugin | ||
101 | .idea_modules/ | ||
102 | |||
103 | # JIRA plugin | ||
104 | atlassian-ide-plugin.xml | ||
105 | |||
106 | # Crashlytics plugin (for Android Studio and IntelliJ) | ||
107 | com_crashlytics_export_strings.xml | ||
108 | crashlytics.properties | ||
109 | crashlytics-build.properties | ||
110 | |||
diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e0c617 --- /dev/null +++ b/README.md | |||
@@ -0,0 +1,2 @@ | |||
1 | CS-107 - Project 1: Seam carving | ||
2 | ================================ | ||
diff --git a/output/.gitkeep b/output/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/output/.gitkeep | |||
diff --git a/resources/americascup.jpg b/resources/americascup.jpg new file mode 100644 index 0000000..dfdfb2b --- /dev/null +++ b/resources/americascup.jpg | |||
Binary files differ | |||
diff --git a/resources/cats.jpg b/resources/cats.jpg new file mode 100644 index 0000000..37aa7b0 --- /dev/null +++ b/resources/cats.jpg | |||
Binary files differ | |||
diff --git a/resources/doves.jpg b/resources/doves.jpg new file mode 100644 index 0000000..68dbb92 --- /dev/null +++ b/resources/doves.jpg | |||
Binary files differ | |||
diff --git a/resources/hiroshige.jpg b/resources/hiroshige.jpg new file mode 100644 index 0000000..189043a --- /dev/null +++ b/resources/hiroshige.jpg | |||
Binary files differ | |||
diff --git a/resources/tower.jpg b/resources/tower.jpg new file mode 100644 index 0000000..efb2751 --- /dev/null +++ b/resources/tower.jpg | |||
Binary files differ | |||
diff --git a/src/main/java/Color.java b/src/main/java/Color.java new file mode 100644 index 0000000..4597b26 --- /dev/null +++ b/src/main/java/Color.java | |||
@@ -0,0 +1,120 @@ | |||
1 | /** | ||
2 | * @author Pacien TRAN-GIRARD | ||
3 | * @author Timothée FLOURE | ||
4 | */ | ||
5 | public final class Color { | ||
6 | |||
7 | /** | ||
8 | * Returns red component from given packed color. | ||
9 | * | ||
10 | * @param rgb 32-bits RGB color | ||
11 | * @return a float between 0.0 and 1.0 | ||
12 | * @see #getGreen | ||
13 | * @see #getBlue | ||
14 | * @see #getRGB(float, float, float) | ||
15 | */ | ||
16 | public static float getRed(int rgb) { | ||
17 | // TODO getRed | ||
18 | return 0.0f; | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Returns green component from given packed color. | ||
23 | * | ||
24 | * @param rgb 32-bits RGB color | ||
25 | * @return a float between 0.0 and 1.0 | ||
26 | * @see #getRed | ||
27 | * @see #getBlue | ||
28 | * @see #getRGB(float, float, float) | ||
29 | */ | ||
30 | public static float getGreen(int rgb) { | ||
31 | // TODO getGreen | ||
32 | return 0.0f; | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * Returns blue component from given packed color. | ||
37 | * | ||
38 | * @param rgb 32-bits RGB color | ||
39 | * @return a float between 0.0 and 1.0 | ||
40 | * @see #getRed | ||
41 | * @see #getGreen | ||
42 | * @see #getRGB(float, float, float) | ||
43 | */ | ||
44 | public static float getBlue(int rgb) { | ||
45 | // TODO getBlue | ||
46 | return 0.0f; | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * Returns the average of red, green and blue components from given packed color. | ||
51 | * | ||
52 | * @param rgb 32-bits RGB color | ||
53 | * @return a float between 0.0 and 1.0 | ||
54 | * @see #getRed | ||
55 | * @see #getGreen | ||
56 | * @see #getBlue | ||
57 | * @see #getRGB(float) | ||
58 | */ | ||
59 | public static float getGray(int rgb) { | ||
60 | // TODO getGray | ||
61 | return 0.0f; | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Returns packed RGB components from given red, green and blue components. | ||
66 | * | ||
67 | * @param red a float between 0.0 and 1.0 | ||
68 | * @param green a float between 0.0 and 1.0 | ||
69 | * @param blue a float between 0.0 and 1.0 | ||
70 | * @return 32-bits RGB color | ||
71 | * @see #getRed | ||
72 | * @see #getGreen | ||
73 | * @see #getBlue | ||
74 | */ | ||
75 | public static int getRGB(float red, float green, float blue) { | ||
76 | // TODO getRGB | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | /** | ||
81 | * Returns packed RGB components from given grayscale value. | ||
82 | * | ||
83 | * @param red a float between 0.0 and 1.0 | ||
84 | * @param green a float between 0.0 and 1.0 | ||
85 | * @param blue a float between 0.0 and 1.0 | ||
86 | * @return 32-bits RGB color | ||
87 | * @see #getGray | ||
88 | */ | ||
89 | public static int getRGB(float gray) { | ||
90 | // TODO getRGB | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * Converts packed RGB image to grayscale float image. | ||
96 | * | ||
97 | * @param image a HxW int array | ||
98 | * @return a HxW float array | ||
99 | * @see #toRGB | ||
100 | * @see #getGray | ||
101 | */ | ||
102 | public static float[][] toGray(int[][] image) { | ||
103 | // TODO toGray | ||
104 | return null; | ||
105 | } | ||
106 | |||
107 | /** | ||
108 | * Converts grayscale float image to packed RGB image. | ||
109 | * | ||
110 | * @param channels a HxW float array | ||
111 | * @return a HxW int array | ||
112 | * @see #toGray | ||
113 | * @see #getRGB(float) | ||
114 | */ | ||
115 | public static int[][] toRGB(float[][] gray) { | ||
116 | // TODO toRGB | ||
117 | return null; |