prtools.teng#
- teng(image, normalize=True)[source]#
The Tenengrad function computes image sharpness as the mean squared Sobel gradient magnitude.
The Tenengrad function measures image sharpness by analyzing the magnitude of the gradient at each pixel. Strong gradient magnitudes indicate sharper edges while weaker magnitudes indicate blur, The total sharpness of the image is calculated as the mean squared gradient magnitude of all pixels:
\[\begin{split}T[g(i,j)] = {G_x}^2(i,j) + {G_y}^2(i,j)\\ \\ F_T = \frac{1}{MN} \sum_{m}\sum_{n} T[g(i,j)]\end{split}\]- Parameters:
image (ndarray) – 2d image
normalize (bool, optional) – If True (default), divide the Sobel responses by 8 to convert to units of intensity change per pixel.
- Returns:
Mean of squared gradient magnitudes across all pixels.
- Return type:
float