Detect which image is sharper
As e.g. shown in this Matlab Central page, the sharpness can be estimated by the average gradient magnitude. I used this in Python as from PIL import Image import numpy as np im = Image.open(filename).convert(‘L’) # to grayscale array = np.asarray(im, dtype=np.int32) gy, gx = np.gradient(array) gnorm = np.sqrt(gx**2 + gy**2) sharpness = np.average(gnorm) A … Read more