Random patches from 2 D images

How can I extract 64x64 patches at randomly sampled positions from 2D images?