diff options
author | Pacien TRAN-GIRARD | 2015-10-10 17:26:48 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-10-10 17:26:48 +0200 |
commit | affd57392742e4d04139c1757bb79398a443eacf (patch) | |
tree | dd8687b444dd833f68e5fca98c414eb2ab9eb193 /src/main/java | |
parent | 3f081efd76b492f3ccd1d53022103f1b8cdfe6ba (diff) | |
download | seam-stitcher-affd57392742e4d04139c1757bb79398a443eacf.tar.gz |
Implement array boundaries access
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/Filter.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/Filter.java b/src/main/java/Filter.java index ddc3e92..73b435b 100644 --- a/src/main/java/Filter.java +++ b/src/main/java/Filter.java | |||
@@ -13,8 +13,16 @@ public final class Filter { | |||
13 | * @return nearest valid pixel color | 13 | * @return nearest valid pixel color |
14 | */ | 14 | */ |
15 | public static float at(float[][] gray, int row, int col) { | 15 | public static float at(float[][] gray, int row, int col) { |
16 | // TODO at | 16 | int maxRow = gray.length - 1; |
17 | return 0.0f; | 17 | int maxCol = gray[0].length - 1; |
18 | |||
19 | if (row < 0) row = 0; | ||
20 | if (col < 0) col = 0; | ||
21 | |||
22 | if (row > maxRow) row = maxRow; | ||
23 | if (col > maxCol) col = maxCol; | ||
24 | |||
25 | return gray[row][col]; | ||
18 | } | 26 | } |
19 | 27 | ||
20 | /** | 28 | /** |