Repository: incubator-systemml
Updated Branches:
  refs/heads/master c335cd403 -> f9b53b96f


[HOTFIX] Enable center cropping in image_utils

Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/f9b53b96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/f9b53b96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/f9b53b96

Branch: refs/heads/master
Commit: f9b53b96fd7aea5f04de811d8c4a20017a329042
Parents: c335cd4
Author: Niketan Pansare <[email protected]>
Authored: Sat Mar 11 11:36:08 2017 -0800
Committer: Niketan Pansare <[email protected]>
Committed: Sat Mar 11 11:36:08 2017 -0800

----------------------------------------------------------------------
 scripts/utils/image_utils.dml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/f9b53b96/scripts/utils/image_utils.dml
----------------------------------------------------------------------
diff --git a/scripts/utils/image_utils.dml b/scripts/utils/image_utils.dml
index b785841..813bc0e 100644
--- a/scripts/utils/image_utils.dml
+++ b/scripts/utils/image_utils.dml
@@ -24,9 +24,9 @@
  * Assumption: Hout < Hin, Wout < Win and input contains values [0, ..]
  */
 crop_rgb = function(matrix[double] input, int Hin, int Win, int Hout, int 
Wout) return (matrix[double] out) {
-       start_h = Hin - Hout + 1
+       start_h = ceil((Hin - Hout) / 2)
        end_h = start_h + Hout - 1
-       start_w = Win - Wout + 1
+       start_w = ceil((Win - Wout) / 2)
        end_w = start_w + Wout - 1
        mask = matrix(0, rows=Hin, cols=Win)
        temp_mask = matrix(1, rows=Hout, cols=Wout)
@@ -50,9 +50,9 @@ crop_rgb = function(matrix[double] input, int Hin, int Win, 
int Hout, int Wout)
  * 
  * script = """
  * crop_grayscale = function(matrix[double] input, int Hin, int Win, int Hout, 
int Wout) return (matrix[double] out) {
- *     start_h = Hin - Hout + 1
+ *     start_h = ceil((Hin - Hout) / 2)
  *     end_h = start_h + Hout - 1
- *     start_w = Win - Wout + 1
+ *     start_w = ceil((Win - Wout) / 2)
  *     end_w = start_w + Wout - 1
  *     mask = matrix(0, rows=Hin, cols=Win)
  *     temp_mask = matrix(1, rows=Hout, cols=Wout)
@@ -71,9 +71,9 @@ crop_rgb = function(matrix[double] input, int Hin, int Win, 
int Hout, int Wout)
  *
  */
 crop_grayscale = function(matrix[double] input, int Hin, int Win, int Hout, 
int Wout) return (matrix[double] out) {
-       start_h = Hin - Hout + 1
+       start_h = ceil((Hin - Hout) / 2)
        end_h = start_h + Hout - 1
-       start_w = Win - Wout + 1
+       start_w = ceil((Win - Wout) / 2)
        end_w = start_w + Wout - 1
        mask = matrix(0, rows=Hin, cols=Win)
        temp_mask = matrix(1, rows=Hout, cols=Wout)

Reply via email to