1. A method comprising: filtering, by use of a processor, an image with an edge extraction filter to generate filtered pixel values for each pixel of the image; calculating a sharpness threshold as a function of the filtered pixel values; calculating a sharpness weight for each filtered pixel value as a function of the filtered pixel value and the sharpness threshold; calculating a weighted pixel value for each filtered pixel value as a function of the filtered pixel value and the corresponding sharpness weight for the filtered pixel value; and calculating a sharpness value for the image as a mean of the weighted pixel values.