I am using the classic CamVid dataset (http://mi.eng.cam.ac.uk/research/projects/VideoRec/CamSeq01/) for object segmentation. It is basically a dataset with videoframes (think of it just as images) and their corresponding segmentation mask.
I would like now to try something else: I would like to crop each frame and its segmentation mask in e.g. 100 patches centered at random positions from the image with a given size (e.g. 224*224) and save the results in the corresponding image / label folders. Note that both the image and the label have to be cropped in the same way for it to work. Does anybody know how to achieve this with few lines of code?