[arrayfire] 18/408: Updated documentation for unwrap
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:07 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 dafe47aaaaef477f7e007839eb9c9cac5fd4d2f6
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Fri Jun 19 15:25:29 2015 -0400
Updated documentation for unwrap
---
docs/details/image.dox | 114 ++++++++++++++++++++++++++++++++++---------------
1 file changed, 79 insertions(+), 35 deletions(-)
diff --git a/docs/details/image.dox b/docs/details/image.dox
index e39b2d7..205996e 100644
--- a/docs/details/image.dox
+++ b/docs/details/image.dox
@@ -576,47 +576,91 @@ are specializations of the transform function.
Generate image with image windows as columns
\ref unwrap takes in an input image along with the window sizes \p wx and \p
-wy and strides \p sx and \p sy. 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.
+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. When strides are greater than 1, then the output may
-be padded with 0 if required.
+values are also allowed.
\code
A [5 5 1 1]
- 0.0000 0.2190 0.3835 0.5297 0.4175
- 0.1315 0.0470 0.5194 0.6711 0.6868
- 0.7556 0.6789 0.8310 0.0077 0.5890
- 0.4587 0.6793 0.0346 0.3834 0.9304
- 0.5328 0.9347 0.0535 0.0668 0.8462
-
-// Sliding Window
-unwrap(A, 3, 3, 1, 1) [9 9 1 1]
- 0.0000 0.1315 0.7556 0.2190 0.0470 0.6789 0.3835 0.5194 0.8310
- 0.1315 0.7556 0.4587 0.0470 0.6789 0.6793 0.5194 0.8310 0.0346
- 0.7556 0.4587 0.5328 0.6789 0.6793 0.9347 0.8310 0.0346 0.0535
- 0.2190 0.0470 0.6789 0.3835 0.5194 0.8310 0.5297 0.6711 0.0077
- 0.0470 0.6789 0.6793 0.5194 0.8310 0.0346 0.6711 0.0077 0.3834
- 0.6789 0.6793 0.9347 0.8310 0.0346 0.0535 0.0077 0.3834 0.0668
- 0.3835 0.5194 0.8310 0.5297 0.6711 0.0077 0.4175 0.6868 0.5890
- 0.5194 0.8310 0.0346 0.6711 0.0077 0.3834 0.6868 0.5890 0.9304
- 0.8310 0.0346 0.0535 0.0077 0.3834 0.0668 0.5890 0.9304 0.8462
-
-// Distinct Windows (has padding)
-unwrap(A, 3, 3, 3, 3) [9 4 1 1]
- 0.0000 0.4587 0.5297 0.3834
- 0.1315 0.5328 0.6711 0.0668
- 0.7556 0.0000 0.0077 0.0000
- 0.2190 0.6793 0.4175 0.9304
- 0.0470 0.9347 0.6868 0.8462
- 0.6789 0.0000 0.5890 0.0000
- 0.3835 0.0346 0.0000 0.0000
- 0.5194 0.0535 0.0000 0.0000
- 0.8310 0.0000 0.0000 0.0000
+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
@}
--
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