import scipy
from scipy import ndimage
dna = scipy.misc.imread('dna.jpeg')
dnaf = ndimage.gaussian_filter(dna, 16)
T = 25
labeled, nr_objects = ndimage.label(dnaf > T)
print('Number of objects is %d ' % nr_objects)
import matplotlib.pyplot as plt
plt.imsave('labeled_dna.png', labeled)
plt.imshow(labeled)
plt.show()
Finding number of colored shapes from picture using Python