skimage2.feature.blob_dog#

skimage2.feature.blob_dog(image, min_sigma=1, max_sigma=50, sigma_ratio=1.6, threshold=0.5, overlap=0.5, *, threshold_rel=<DEPRECATED>, exclude_border=False, prescale='legacy')[source]#

Finds blobs in the given grayscale image.

Blobs are found using the Difference of Gaussian (DoG) method [1], [2]. For each blob found, the method returns its coordinates and the standard deviation of the Gaussian kernel that detected the blob.

Parameters:
imagendarray

Input grayscale image, blobs are assumed to be light on dark background (white on black).

min_sigmascalar or sequence of scalars, optional

Minimum standard deviation for Gaussian kernel. Keep this value low to detect smaller blobs. The standard deviation of the Gaussian kernel is given either as a sequence for each axis, or as a single number, in which case it is equal for all axes.

max_sigmascalar or sequence of scalars, optional

The maximum standard deviation for Gaussian kernel. Keep this high to detect larger blobs. The standard deviation of the Gaussian kernel is given either as a sequence for each axis, or as a single number, in which case it is equal for all axes.

sigma_ratiofloat, optional

The ratio between the standard deviation of Gaussian Kernels used for computing the Difference of Gaussians

thresholdfloat or None, optional

An absolute threshold applied to the internally computed stack of Difference-of-Gaussian (DoG) images. Local maxima in DoG smaller than threshold are ignored. Reduce this to detect blobs with lower intensities.

overlapfloat, optional

A value between 0 and 1. If the area of two blobs overlaps by a fraction greater than threshold, the smaller blob is eliminated.

threshold_relDEPRECATED

Deprecated since version 0.27: Starting with version 0.27, threshold_rel is deprecated. Since max(dog_space) * threshold_rel was used to calculate the minimum peak intensity, this parameters effect was difficult to reason about. Use threshold in conjunction with prescale instead.

exclude_bordertuple of ints, int, or False, optional

If tuple of ints, the length of the tuple must match the input array’s dimensionality. Each element of the tuple will exclude peaks from within exclude_border-pixels of the border of the image along that dimension. If nonzero int, exclude_border excludes peaks from within exclude_border-pixels of the border of the image. If zero or False, peaks are identified regardless of their distance from the border.

prescale{‘minmax’, ‘none’, ‘legacy’}, optional

Method for rescaling (normalizing) image before processing. Note that rescaling impacts the ranges of the internally computed Difference-of-Gaussian (DoG) images, and therefore also the choice of threshold.

'minmax'

Normalize image between 0 and 1 regardless of dtype. After normalization, the resulting array will have a floating dtype.

'none'

Don’t prescale the value range of image at all and return a copy of image. Useful when image has already been rescaled.

'legacy'

Normalize only if image has an integer dtype. If image is of floating dtype, it is left alone. See skimage2.util.img_as_float() for more details.

Warning

The rescaling and the effect of threshold will depend on the dtype of image. For consistent behavior we recommend 'minmax'.

Returns:
A(n, image.ndim + sigma) ndarray

A 2d array with each row representing 2 coordinate values for a 2D image, or 3 coordinate values for a 3D image, plus the sigma(s) used. When a single sigma is passed, outputs are: (r, c, sigma) or (p, r, c, sigma) where (r, c) or (p, r, c) are coordinates of the blob and sigma is the standard deviation of the Gaussian kernel which detected the blob. When an anisotropic gaussian is used (sigmas per dimension), the detected sigma is returned for each dimension.

Notes

The radius of each blob is approximately \(\sqrt{2}\sigma\) for a 2-D image and \(\sqrt{3}\sigma\) for a 3-D image.

References

[2]

Lowe, D. G. “Distinctive Image Features from Scale-Invariant Keypoints.” International Journal of Computer Vision 60, 91–110 (2004). https://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf DOI:10.1023/B:VISI.0000029664.99615.94

Examples

>>> from _skimage2 import data, feature
>>> coins = data.coins()
>>> feature.blob_dog(coins, threshold=.05, min_sigma=10, max_sigma=40)
array([[128., 155.,  10.],
       [198., 155.,  10.],
       [124., 338.,  10.],
       [127., 102.,  10.],
       [193., 281.,  10.],
       [126., 208.,  10.],
       [267., 115.,  10.],
       [197., 102.,  10.],
       [198., 215.,  10.],
       [123., 279.,  10.],
       [126.,  46.,  10.],
       [259., 247.,  10.],
       [196.,  43.,  10.],
       [ 54., 276.,  10.],
       [267., 358.,  10.],
       [ 58., 100.,  10.],
       [259., 305.,  10.],
       [185., 347.,  16.],
       [261., 174.,  16.],
       [ 46., 336.,  16.],
       [ 54., 217.,  10.],
       [ 55., 157.,  10.],
       [ 57.,  41.,  10.],
       [260.,  47.,  16.]])