finish compute the entropy of an image