Visit the wiki pages to find some additional documentation and instructions on how view an interactive verson of these notebooks using binder.

In [1]:
%matplotlib inline
In [2]:
import math
import numpy as np
import matplotlib.pyplot as plt


from skimage import measure
from skimage.color import rgb2gray
from skimage import io
from skimage import filters
from skimage import feature

Blob detection using Laplacian of Gaussian

For the purpose of illustration we use a cartoon image, i.e. an image that does not have any texture.

In [6]:
image = io.imread("../images/002002-3608-channel-0.tif")
image_gray = rgb2gray(image)
In [7]:
fig, ax = plt.subplots(figsize=(8, 8))
plt.imshow(image_gray, cmap=plt.cm.gray)
Out[7]:
<matplotlib.image.AxesImage at 0x7f97455422d0>
In [10]:
blobs_log = feature.blob_log(image_gray, max_sigma=30, num_sigma=10, threshold=.1)

# Compute radii in the 3rd column.
blobs_log[:, 2] = blobs_log[:, 2] * math.sqrt(2)
In [12]:
fig, ax = plt.subplots(figsize=(8, 8))

ax.set_title('Laplacian of Gaussian')
ax.imshow(image_gray)
for blob in blobs_log:
    y, x, r = blob
    c = plt.Circle((x, y), r, color='yellow', linewidth=2, fill=False)
    ax.add_patch(c)
    ax.set_axis_off()
    
plt.show()
Explore: The scikit-image provides a couple of alternatives to blob detection. Consult the documentation and explore how you could compute these.
In [ ]: