[][src]Function arrayfire::unwrap

pub fn unwrap<T: HasAfEnum>(
    input: &Array<T>,
    wx: i64,
    wy: i64,
    sx: i64,
    sy: i64,
    px: i64,
    py: i64,
    is_column: bool
) -> Array<T>

Generate an array with image windows as columns

unwrap takes in an input image along with the window sizes wx and wy, strides sx and sy, and padding px and py. This function then generates a matrix where each windows is an independent column.

The number of columns (rows if is_column is true) 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 px defining the height of the padding along dim 0 and 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.

Parameters

Return Values

An Array with image windows as columns

Examples

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, False) [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, False) [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