Blob detection in grayscale images (skimage)

3.1k Views Asked by At

I've used the scikit tutorial (http://scikit-image.org/docs/dev/auto_examples/plot_blob.html) to play with blob detection. I've changed the code to get only the difference of Gaussian

from matplotlib import pyplot as plt
from skimage import data
from skimage.feature import blob_dog
from skimage.color import rgb2gray

image = data.imread('Img.png')

blobs_dog = blob_dog(image, max_sigma=30, threshold=.1)

blobs = [blobs_dog]
colors = ['red']
titles = ['Difference of Gaussian']
sequence = zip(blobs, colors, titles)

for blobs, color, title in sequence:
    fig, ax = plt.subplots(1, 1)
    ax.set_title(title)
    ax.imshow(image, interpolation='nearest')
    for blob in blobs:
        y, x, r = blob
        c = plt.Circle((x, y), r, color=color, linewidth=1, fill=False)
        ax.add_patch(c)

plt.show()

Now my question is: I used a grayscale image (I didn't modified it with the rgb2gray function), but when I run the code, as output I have a "colored" image (almost all cyan with some red and yellow spots). If I use a RGB image and then I transform it to grayscale I don't have problems. Why is it so?

0

There are 0 best solutions below