Sharpness calculation