|
Generate an array with image windows as columns. More...
Functions | |
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=0, const dim_t py=0, const bool is_column=true) |
C++ Interface wrapper for unwrap. More... | |
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 bool is_column) |
C Interface wrapper for unwrap. More... | |
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.
So the dimensions of the output matrix are:
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.
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 bool | is_column | ||
) |
C Interface wrapper for unwrap.
[out] | out | is an array with image blocks as rows or columns. |
[in] | in | is the input image (or set of images) |
[in] | wx | is the block window size along 0th-dimension between [1, input.dims[0] + px] |
[in] | wy | is the block window size along 1st-dimension between [1, input.dims[1] + py] |
[in] | sx | is the stride along 0th-dimension |
[in] | sy | is the stride along 1st-dimension |
[in] | px | is the padding along 0th-dimension between [0, wx). Padding is applied both before and after. |
[in] | py | is the padding along 1st-dimension between [0, wy). Padding is applied both before and after. |
[in] | is_column | specifies the layout for the unwrapped patch. If is_column is false, the unrapped patch is laid out as a row. |
AFAPI array af::unwrap | ( | const array & | in, |
const dim_t | wx, | ||
const dim_t | wy, | ||
const dim_t | sx, | ||
const dim_t | sy, | ||
const dim_t | px = 0 , |
||
const dim_t | py = 0 , |
||
const bool | is_column = true |
||
) |
C++ Interface wrapper for unwrap.
[in] | in | is the input image (or set of images) |
[in] | wx | is the block window size along 0th-dimension between [1, input.dims[0] + px] |
[in] | wy | is the block window size along 1st-dimension between [1, input.dims[1] + py] |
[in] | sx | is the stride along 0th-dimension |
[in] | sy | is the stride along 1st-dimension |
[in] | px | is the padding along 0th-dimension between [0, wx). Padding is applied both before and after. |
[in] | py | is the padding along 1st-dimension between [0, wy). Padding is applied both before and after. |
[in] | is_column | specifies the layout for the unwrapped patch. If is_column is false, the unrapped patch is laid out as a row. |