Slices an image into multiple smaller, square-shaped patches.
For overlapping patches, set the stride to a value smaller than the patch size. For non-overlapping patches, set the stride to a value identical to the patch size (or larger). If the stride is set to a value larger than the patch size, parts of the original image will be skipped.
Optionally, patches entirely corresponding to image background are discarded. To decide whether a patch corresponds to image background, the homogeneity of its gray-level co-occurrence matrix is considered.
In addition, the number of the remaining patches can be reduced by specifying a maximum number of patches to retain. Those will be selected randomly.