SlidingWindow
Description
We want to keep our algorithms clear, so to prepare a data for another algorithm we need a kind of getting data in different view. SlidingWindow is a helper in searching objects in an image, putting each window snapshot as a column, this makes easier to apply another algorithms that should works with that data.
Params
tSrc | Tensor | The source data to be processed. |
windowSize | number | Array.<number> | |
stride? | number | Array.<number> | window stride. |
strategy? | number | output shape strategy. ENUM: 0(default): [WH * WW, N, 4]; 1: [N, WH * WW, 4]; 2: [1, WH * WW * N, 4]; 2: [WH * WW * N, 1, 4]; LEGEND: WH - window height, WW - window width, N - number of possible windows. |
Example
// this operation will output data in next strategy:
// |xyzw| |xyzqwe|
// |qwer| -> |yzwwer|
// |asdf| |qweasd|
// |wersdf|
// where each column is a one state of sliding window,
// and each pixel in a row is a one pixel in a sliding window.
gm.slidingWindowOp(inputImage, 2, 1, 0);