Similar to im2col, the video2col2 can extract columns of 3D patches from a 3D matrix, e.g. video. Spatial and temporal step sizes can also be applied.
A: 3D matrix, e.g. a video.
PATCH_SIZE: size of a patch, e.g., [2,2,2].
STEP_SIZE: the stride in each dimension, e.g. [2,3,4].
The video2col2 will extract a floor[(M_r-w_r)/s_r+1] * floor[(M_c-w_c)/s_c+1] * floor[(M_t-w_t)/s_t+1] 3D patches B, where a video is of size M_r*M_c*M_t and each patch is of size w_r*w_c*w_t. The step size is [s_r, s_c, s_t] alone the spatial and temporal axis.
Each column in B is a patch.
In this case, a video A is of size 100*90*80, i.e., the video has 80 frames and the number of rows is 100.
Patch size is 3*4*5 and the step size is 2*3*4. Then B will be a 60*26999 matrix, where 60 is the size of a patch (60=3*4*5) and 26999 is the number of extracted patches.
Tested on Mac and Windows with Matlab R2013b. You need to compile it using
mex -O video2col2.c