how after ndimage.find_object ... color features?

image-processing, python, scipy

Solution

You could use matplotlib like this:

import scipy
from scipy import ndimage
import matplotlib.pyplot as plt

im = scipy.misc.imread('all_blobs.png',flatten=1)
im, number_of_objects = ndimage.label(im)
blobs = ndimage.find_objects(im)

plt.imsave('blobs.png', im)
for i,j in enumerate(blobs):
    plt.imsave('blob'+str(i)+'.png',im[j])

original image:

labelled image:

slices containing the blobs:

Problem

I have a large image which after labeling has about 500 features. I know how to get them in the slices using find_object but I want to color them so I can see the result. Any quick suggestion for that?

Original source