def _most_common(img): """ Subtract the most common value from the whole image """ common = mode(img, axis=None).mode[0] res = img - common res[res < 0] = 0 return res