diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1314855..e422a78 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,7 +2,9 @@
-
+
+
+
@@ -17,11 +19,11 @@
-
+
-
-
+
+
@@ -29,7 +31,7 @@
-
+
@@ -39,8 +41,8 @@
-
-
+
+
@@ -105,6 +107,7 @@
+
@@ -128,9 +131,8 @@
-
-
+
@@ -203,12 +205,13 @@
-
+
+
-
+
@@ -236,9 +239,8 @@
-
+
-
@@ -250,6 +252,7 @@
+
@@ -263,6 +266,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -358,14 +386,7 @@
-
-
-
-
-
-
-
-
+
@@ -378,8 +399,18 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -391,15 +422,5 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/collage.jpeg b/collage.jpeg
deleted file mode 100644
index 4c3a4fc..0000000
Binary files a/collage.jpeg and /dev/null differ
diff --git a/collage.jpg b/collage.jpg
deleted file mode 100644
index a881445..0000000
Binary files a/collage.jpg and /dev/null differ
diff --git a/combined.png b/combined.png
index ea5b68f..9e3976c 100644
Binary files a/combined.png and b/combined.png differ
diff --git a/src/com/company/Main.java b/src/com/company/Main.java
index 57ff7b9..a385322 100644
--- a/src/com/company/Main.java
+++ b/src/com/company/Main.java
@@ -16,8 +16,8 @@ public class Main {
ArrayList repPaths = getAllImages(new File("C:\\Users\\Elliot\\Desktop\\test\\"));
- int rows = 4;
- int cols = 5;
+ int rows = 50;
+ int cols = 50;
int chunkWidth = image.getWidth() / cols; // determines the chunk width and height
int chunkHeight = image.getHeight() / rows;
@@ -44,11 +44,12 @@ public class Main {
chunks[count-1].average();
}
}
+ System.out.println("splitting done");
//load replacement images into array
for (int i = 0; i < cols*rows; i++) {
// read file from path
- // % (cols*rows) to fill array even if not enough images in rep. folder
- File tempfile = new File(repPaths.get(i));
+ // % repPaths.size to fill array even if not enough images in rep. folder
+ File tempfile = new File(repPaths.get(i% repPaths.size()));
FileInputStream tempfis = new FileInputStream(tempfile);
// scale loaded image to fit chunk
@@ -62,8 +63,9 @@ public class Main {
// fill array of chunks with read images
replacements[i] = new chunk(dimg);
+ System.out.println((i*100)/(cols*rows));
}
-
+ System.out.println("images loaded");
//for each chunk, calculate the euclidean distance to every possible replacement
for (int i = 0; i < cols*rows; i++) {
@@ -72,6 +74,9 @@ public class Main {
for (int j = 0; j < cols*rows; j++) {
distances[j] = replacements[j].euclideanDistance(chunks[i].getAverage());
+ //int[] a = replacements[j].getAverage();
+ //int[] b = chunks[i].getAverage();
+ //System.out.println( a[0]+ " " + a[1]+ " " +a[2]+ " " + b[0]+ " " + b[1]+ " " +b[2] + " " + replacements[j].euclideanDistance(chunks[i].getAverage()));
}
minEuclid = getMinValue(distances);
@@ -79,6 +84,7 @@ public class Main {
g.drawImage(replacements[minEuclid].getImg(), ((i%cols)*chunkWidth), ((i/cols)*chunkHeight), null);
}
+ System.out.println("done");
ImageIO.write(combined, "PNG", new File("combined.png"));
}
@@ -117,7 +123,7 @@ public class Main {
index = i;
}
}
- System.out.println(minValue);
+ //System.out.println(minValue);
return index;
}
}
diff --git a/src/com/company/chunk.java b/src/com/company/chunk.java
index b4f46e9..0035305 100644
--- a/src/com/company/chunk.java
+++ b/src/com/company/chunk.java
@@ -63,7 +63,11 @@ public class chunk {
g /= pc;
b /= pc;
a /= pc;
-
+ int [] temprgb = new int[3];
+ temprgb[0] = r;
+ temprgb[1] = g;
+ temprgb[2] = b;
+ this.average= temprgb;
//System.out.println(r + " , " + g + " , " + b + " , " + a);
return new int[]{r,g,b,a};
}