added code to get a random patch from an image