*******Functional With pixel values for distance******