Get sample from grayscale image the right way