aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-10-10 10:39:03 +0200
committerPacien TRAN-GIRARD2015-10-10 10:39:03 +0200
commit4453b77e0f24afa2aa8ce4eab9aca8c7e158fc49 (patch)
tree96275e2e7b5dda02a939b5485092670f369a33d3 /src
downloadseam-stitcher-4453b77e0f24afa2aa8ce4eab9aca8c7e158fc49.tar.gz
Bootstrap project
Diffstat (limited to 'src')
-rw-r--r--src/main/java/Color.java120
-rw-r--r--src/main/java/Filter.java76
-rw-r--r--src/main/java/Helper.java140
-rw-r--r--src/main/java/Main.java51
-rw-r--r--src/main/java/Seam.java75
-rw-r--r--src/main/java/SignatureChecks.java37
-rw-r--r--src/test/java/Tests.java169
7 files changed, 668 insertions, 0 deletions
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 */
5public 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;
118 }
119
120}
diff --git a/src/main/java/Filter.java b/src/main/java/Filter.java
new file mode 100644
index 0000000..ddc3e92
--- /dev/null
+++ b/src/main/java/Filter.java
@@ -0,0 +1,76 @@
1/**
2 * @author Pacien TRAN-GIRARD
3 * @author Timothée FLOURE
4 */
5public final class Filter {
6
7 /**
8 * Get a pixel without accessing out of bounds
9 *
10 * @param gray a HxW float array
11 * @param row Y coordinate
12 * @param col X coordinate
13 * @return nearest valid pixel color
14 */
15 public static float at(float[][] gray, int row, int col) {
16 // TODO at
17 return 0.0f;
18 }
19
20 /**
21 * Convolve a single-channel image with specified kernel.
22 *
23 * @param gray a HxW float array
24 * @param kernel a MxN float array, with M and N odd
25 * @return a HxW float array
26 */
27 public static float[][] filter(float[][] gray, float[][] kernel) {
28 // TODO filter
29 return null;
30 }
31
32 /**
33 * Smooth a single-channel image
34 *
35 * @param gray a HxW float array
36 * @return a HxW float array
37 */
38 public static float[][] smooth(float[][] gray) {
39 // TODO smooth
40 return null;
41 }
42
43 /**
44 * Compute horizontal Sobel filter
45 *
46 * @param gray a HxW float array
47 * @return a HxW float array
48 */
49 public static float[][] sobelX(float[][] gray) {
50 // TODO sobelX
51 return null;
52 }
53
54 /**
55 * Compute vertical Sobel filter
56 *
57 * @param gray a HxW float array
58 * @return a HxW float array
59 */
60 public static float[][] sobelY(float[][] gray) {
61 // TODO sobelY
62 return null;
63 }
64
65 /**
66 * Compute the magnitude of combined Sobel filters
67 *
68 * @param gray a HxW float array
69 * @return a HxW float array
70 */
71 public static float[][] sobel(float[][] gray) {
72 // TODO sobel
73 return null;
74 }
75
76}
diff --git a/src/main/java/Helper.java b/src/main/java/Helper.java
new file mode 100644
index 0000000..b7a139a
--- /dev/null
+++ b/src/main/java/Helper.java
@@ -0,0 +1,140 @@
1import javax.imageio.ImageIO;
2import javax.swing.*;
3import java.awt.*;
4import java.awt.event.WindowAdapter;
5import java.awt.event.WindowEvent;
6import java.awt.image.BufferedImage;
7import java.io.File;
8import java.io.IOException;
9
10/**
11 * Provide simple tools to read, write and show pictures.
12 */
13public final class Helper {
14
15 // Convert specified BufferedImage into an array
16 private static int[][] fromBufferedImage(BufferedImage image) {
17 int width = image.getWidth();
18 int height = image.getHeight();
19 int[][] array = new int[height][width];
20 for (int row = 0; row < height; ++row) {
21 for (int col = 0; col < width; ++col) {
22 array[row][col] = image.getRGB(col, row);
23 }
24 }
25 return array;
26 }
27
28 // Convert specified array int a BufferedImage
29 private static BufferedImage toBufferedImage(int[][] array) {
30 int width = array[0].length;
31 int height = array.length;
32 BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
33 for (int row = 0; row < height; ++row) {
34 for (int col = 0; col < width; ++col) {
35 image.setRGB(col, row, array[row][col]);