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?
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With