[arrayfire] 25/408: Merge branch 'unwrap' of shehzan10/arrayfire into devel

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit ce0d03ff5e0490f98f854ce53bd36e9aeb1a00f0
Merge: b037a8c dc18c34
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Sat Jun 20 20:46:58 2015 -0400

    Merge branch 'unwrap' of shehzan10/arrayfire into devel

 docs/details/image.dox               |  92 +++++++++++++++++++
 include/af/image.h                   |  36 ++++++++
 src/api/c/unwrap.cpp                 |  63 +++++++++++++
 src/api/cpp/unwrap.cpp               |  24 +++++
 src/backend/cpu/unwrap.cpp           | 116 ++++++++++++++++++++++++
 src/backend/cpu/unwrap.hpp           |  18 ++++
 src/backend/cuda/kernel/unwrap.hpp   | 108 ++++++++++++++++++++++
 src/backend/cuda/unwrap.cu           |  63 +++++++++++++
 src/backend/cuda/unwrap.hpp          |  18 ++++
 src/backend/opencl/kernel/unwrap.cl  |  86 ++++++++++++++++++
 src/backend/opencl/kernel/unwrap.hpp |  94 ++++++++++++++++++++
 src/backend/opencl/unwrap.cpp        |  64 ++++++++++++++
 src/backend/opencl/unwrap.hpp        |  18 ++++
 test/data                            |   2 +-
 test/unwrap.cpp                      | 167 +++++++++++++++++++++++++++++++++++
 15 files changed, 968 insertions(+), 1 deletion(-)

diff --cc docs/details/image.dox
index 4707de7,205996e..c83b5e7
--- a/docs/details/image.dox
+++ b/docs/details/image.dox
@@@ -570,18 -570,98 +570,110 @@@ Interpolation types of \ref AF_INTERP_N
  Affine transforms can be used for various purposes. \ref af::translate, \ref af::scale and \ref af::skew
  are specializations of the transform function.
  
 +=======================================================================
 +
 +\defgroup image_func_dog DoG
 +\ingroup imageflt_mat
 +
 +\brief Difference of Gaussians
 +
 +Given an image, this function computes two different versions of smoothed
 +input image using the difference smoothing parameters and subtracts one
 +from the other and returns the result.
 +
 +=======================================================================
 +
+ \defgroup image_func_unwrap unwrap
+ \ingroup image_mod
+ 
+ Generate image with image windows as columns
+ 
+ \ref unwrap takes in an input image along with the window sizes \p wx and \p
+ wy, strides \p sx and \p sy, and padding \px and \p py. This function then
+ generates a matrix where each windows is an independent column.
+ 
+ The number of columns in the output array are govenered by the number of
+ windows that can be fit along x and y directions. Padding is applied along all
+ 4 sides of the matrix with \p px defining the height of the padding along dim
+ 0 and \p py defining the width of the padding along dim 1.
+ 
+ The first column window is always at the top left corner of the input including
+ padding. If a window cannot fit before the end of the matrix + padding, it is
+ skipped from the generated matrix.
+ 
+ Padding can take a maximum value of window - 1 repectively for x and y.
+ 
+ For multiple channels (3rd and 4th dimension), the generated matrix contains
+ the same number of channels as the input matrix. Each channel of the output
+ matrix corresponds to the same channel of the input.
+ 
+ So the dimensions of the output matrix are:
+ \code
+ [(wx * wy),         // Column height
+  (No. of windows along dim 0 of input * No. of windows along dim 1 of input), // No. of columns per channel
+  input.dims()[2],   // Channels
+  input.dims()[3]]   // Volumns
+ \endcode
+ 
+ When strides are 1, the operation is sliding window. When strides are equal to
+ the respective window sizes, the option is distinct window. Other stride
+ values are also allowed.
+ 
+ \code
+ A [5 5 1 1]
+ 10 15 20 25 30
+ 11 16 21 26 31
+ 12 17 22 27 32
+ 13 18 23 28 33
+ 14 19 24 29 34
+ 
+ // Window 3x3, strides 1x1, padding 0x0
+ unwrap(A, 3, 3, 1, 1, 0, 0) [9 9 1 1]
+ 10 11 12 15 16 17 20 21 22
+ 11 12 13 16 17 18 21 22 23
+ 12 13 14 17 18 19 22 23 24
+ 15 16 17 20 21 22 25 26 27
+ 16 17 18 21 22 23 26 27 28
+ 17 18 19 22 23 24 27 28 29
+ 20 21 22 25 26 27 30 31 32
+ 21 22 23 26 27 28 31 32 33
+ 22 23 24 27 28 29 32 33 34
+ 
+ // Window 3x3, strides 1x1, padding 1x1
+ unwrap(A, 3, 3, 1, 1, 1, 1) [9 25 1 1]
+  0  0  0  0  0  0 10 11 12 13  0 15 16 17 18  0 20 21 22 23  0 25 26 27 28
+  0  0  0  0  0 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
+  0  0  0  0  0 11 12 13 14  0 16 17 18 19  0 21 22 23 24  0 26 27 28 29  0
+  0 10 11 12 13  0 15 16 17 18  0 20 21 22 23  0 25 26 27 28  0 30 31 32 33
+ 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
+ 11 12 13 14  0 16 17 18 19  0 21 22 23 24  0 26 27 28 29  0 31 32 33 34  0
+  0 15 16 17 18  0 20 21 22 23  0 25 26 27 28  0 30 31 32 33  0  0  0  0  0
+ 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  0  0  0  0  0
+ 16 17 18 19  0 21 22 23 24  0 26 27 28 29  0 31 32 33 34  0  0  0  0  0  0
+ 
+ // Window 3x3, strides 3x3 ("distinct"), padding 0x0
+ unwrap(A, 3, 3, 3, 3, 0, 0) [9 1 1 1]
+    10
+    11
+    12
+    15
+    16
+    17
+    20
+    21
+    22
+ 
+ // Window 3x3, strides 3x3 ("distinct"), padding 2x2
+ unwrap(A, 3, 3, 3, 3, 2, 2) [9 9 1 1]
+     0     0     0     0    16    19     0    31    34
+     0     0     0     0    17     0     0    32     0
+     0     0     0    15    18     0    30    33     0
+     0     0     0     0    21    24     0     0     0
+     0     0     0     0    22     0     0     0     0
+     0     0     0    20    23     0     0     0     0
+     0    11    14     0    26    29     0     0     0
+     0    12     0     0    27     0     0     0     0
+    10    13     0    25    28     0     0     0     0
+ \endcode
 -
  @}
  */
diff --cc include/af/image.h
index 165def3,22b9fd5..67fd24b
--- a/include/af/image.h
+++ b/include/af/image.h
@@@ -462,17 -462,22 +462,34 @@@ AFAPI array rgb2hsv(const array& in)
  AFAPI array colorSpace(const array& image, const CSpace to, const CSpace from);
  
  /**
 +   C++ Interface wrapper for Difference of Gaussians
 +
 +   \param[in] in is input image
 +   \param[in] radius1 is the radius of first gaussian kernel
 +   \param[in] radius2 is the radius of second gaussian kernel
 +   \return    Difference of smoothed inputs
 +
 +   \ingroup image_func_dog
 + */
 +AFAPI array dog(const array& in, const int radius1, const int radius2);
 +
++/**
+    C++ Interface wrapper for unwrap
+ 
+    \param[in]  in is the input array
+    \param[in]  wx is the block window size along 0th-dimension between [1, input.dims[0] + px]
+    \param[in]  wy is the block window size along 1st-dimension between [1, input.dims[1] + py]
+    \param[in]  sx is the stride along 0th-dimension
+    \param[in]  sy is the stride along 1st-dimension
+    \param[in]  px is the padding along 0th-dimension between [0, wx). Padding is applied both before and after.
+    \param[in]  py is the padding along 1st-dimension between [0, wy). Padding is applied both before and after.
+    \returns    an array with the image blocks as columns
+ 
+    \ingroup image_func_unwrap
+ */
+ AFAPI array unwrap(const array& in, const dim_t wx, const dim_t wy,
 -                   const dim_t sx, const dim_t sy, const dim_t px, const dim_t py);
++                   const dim_t sx, const dim_t sy, const dim_t px=0, const dim_t py=0);
+ 
  }
  #endif
  
@@@ -916,19 -921,24 +933,38 @@@ extern "C" 
      AFAPI af_err af_color_space(af_array *out, const af_array image, const af_cspace_t to, const af_cspace_t from);
  
      /**
 +       C Interface wrapper for Difference of Gaussians
 +
 +       \param[out] out is difference of smoothed inputs
 +       \param[in] in is input image
 +       \param[in] radius1 is the radius of first gaussian kernel
 +       \param[in] radius2 is the radius of second gaussian kernel
 +       \return    \ref AF_SUCCESS if the computation is is successful,
 +                  otherwise an appropriate error code is returned.
 +
 +       \ingroup image_func_dog
 +     */
 +    AFAPI af_err af_dog(af_array *out, const af_array in, const int radius1, const int radius2);
 +
++    /**
+        C Interface wrapper for unwrap
+ 
+        \param[out] out is an array with image blocks as columns.
+        \param[in]  in is the input array
+        \param[in]  wx is the block window size along 0th-dimension between [1, input.dims[0] + px]
+        \param[in]  wy is the block window size along 1st-dimension between [1, input.dims[1] + py]
+        \param[in]  sx is the stride along 0th-dimension
+        \param[in]  sy is the stride along 1st-dimension
+        \param[in]  px is the padding along 0th-dimension between [0, wx). Padding is applied both before and after.
+        \param[in]  py is the padding along 1st-dimension between [0, wy). Padding is applied both before and after.
+        \return     \ref AF_SUCCESS if the color transformation is successful,
+        otherwise an appropriate error code is returned.
+ 
+        \ingroup image_func_unwrap
+     */
+     AFAPI af_err af_unwrap(af_array *out, const af_array in, const dim_t wx, const dim_t wy,
 -        const dim_t sx, const dim_t sy, const dim_t px, const dim_t py);
++                           const dim_t sx, const dim_t sy, const dim_t px, const dim_t py);
+ 
  #ifdef __cplusplus
  }
  #endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list