img2measure function

Extract a discrete measure from a gray-scale image matrix