from math import sqrt
from skimage import data
from skimage.feature import blob_dog, blob_log, blob_doh
from skimage.color import rgb2gray
from skimage import io

import matplotlib.pyplot as plt


image = io.imread("star.jpg")
image_gray = rgb2gray(image)

blobs_log = blob_log(image_gray, max_sigma=30, num_sigma=10, threshold=.1)

# Compute radii in the 3rd column.
blobs_log[:, 2] = blobs_log[:, 2] * sqrt(2)

blobs_dog = blob_dog(image_gray, max_sigma=30, threshold=.1)
blobs_dog[:, 2] = blobs_dog[:, 2] * sqrt(2)

blobs_doh = blob_doh(image_gray, max_sigma=30, threshold=.01)

blobs_list = [blobs_log, blobs_dog, blobs_doh]
colors = ['yellow', 'lime', 'red']
titles = ['Laplacian of Gaussian', 'Difference of Gaussian',
          'Determinant of Hessian']
sequence = zip(blobs_list, colors, titles)

fig, axes = plt.subplots(1, 3, figsize=(9, 3), sharex=True, sharey=True)
ax = axes.ravel()

for idx, (blobs, color, title) in enumerate(sequence):
    ax[idx].set_title(title)
    ax[idx].imshow(image)
    for blob in blobs:
        y, x, r = blob
        c = plt.Circle((x, y), r, color=color, linewidth=2, fill=False)
        ax[idx].add_patch(c)
    ax[idx].set_axis_off()

plt.tight_layout()
plt.show()
[(10, 'skimage.io.imread', 'io.imread', False, 'from skimage import io\n'), (11, 'skimage.color.rgb2gray', 'rgb2gray', False, 'from skimage.color import rgb2gray\n'), (13, 'skimage.feature.blob_log', 'blob_log', False, 'from skimage.feature import blob_dog, blob_log, blob_doh\n'), (18, 'skimage.feature.blob_dog', 'blob_dog', False, 'from skimage.feature import blob_dog, blob_log, blob_doh\n'), (21, 'skimage.feature.blob_doh', 'blob_doh', False, 'from skimage.feature import blob_dog, blob_log, blob_doh\n'), (29, 'matplotlib.pyplot.subplots', 'plt.subplots', True, 'import matplotlib.pyplot as plt\n'), (41, 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', True, 'import matplotlib.pyplot as plt\n'), (42, 'matplotlib.pyplot.show', 'plt.show', True, 'import matplotlib.pyplot as plt\n'), (16, 'math.sqrt', 'sqrt', False, 'from math import sqrt\n'), (19, 'math.sqrt', 'sqrt', False, 'from math import sqrt\n'), (37, 'matplotlib.pyplot.Circle', 'plt.Circle', True, 'import matplotlib.pyplot as plt\n')]