k-Wave Toolbox


Calculate image sharpness metric.


s = sharpness(im)
s = sharpness(im, metric)


sharpness returns a scalar metric related to the sharpness of the 2D or 3D image matrix defined by im. By default, the metric is based on the Brenner gradient which returns the sum of the centered finite-difference at each matrix element in each Cartesian direction. Metrics calculated using the Sobel operator or the normalised variance can also be returned by setting the input paramater metric.

For further details, see B. E. Treeby, T. K. Varslot, E. Z. Zhang, J. G. Laufer, and P. C. Beard, "Automatic sound speed selection in photoacoustic image reconstruction using an autofocus approach," J. Biomed. Opt., vol. 16, no. 9, p. 090501, 2011.


im 2D or 3D image data to evaluate

Optional Inputs


sharpness metric. Supported values are

'Brenner' (default)


s computed sharpness metric