What you have implemented is not what the formula denotes, but what you have implemented will return an indication of Sharpness, possibly with some minor modifications.
The formula produces a single $\mathbb{R}$eal number as the ratio of the local sum of laplacians divided by the local mean. "Local" here refers to a square image patch (of some dimensions) centred around pixel $(x,y)$.
If you forget about the division by $\mu$ for a minute, the $LP(x,y)$ is the sum of the "local" second derivatives. This is a $\mathbb{R}$eal number.
The way you have implemented it, the sum operates over the Laplacian of the whole image.
Furthermore, as the Laplacian is a $\mathbb{R}$eal number and the image is a $\mathbb{N}$atural (bounded) number (a.k.a a non-negative integer), you may experience rounding errors. I say "may" because the matrix used by opencv is also based on integers, so the rounding comes into play at a different region.
Evaluating the Laplacian over the whole image is not so much of a "problem" if that sum
you used operates across both dimensions. Usually, in platforms such as GNU Octave, MATLAB and others, a single sum
over some matrix, operates across one dimension (usually it sums the columns). Therefore, your s
would become a vector...not a $\mathbb{R}$eal number.
Hope this helps.
gray_lap
should probably beLP
(?) $\endgroup$