If you are putting together a training dataset for classification or object detection, you may need to create a uniformly distributed random selection of image crops from your image data.
The following pipeline helps you to do it. It picks random images, cuts 4 random patches of size 300x200 from each of them, and saves them as png files in the current directory.
(Note: index parameter in file=png,,index is required, because otherwise the filenames for the patches cut out of the same image would have different filenames.)
See cv-calc --help for more configuration options.