如果阴影不是问题
给定此二进制图像,您可以在mahotas中标记图像(http://mahotas.readthedocs.org/en/latest/labeled.html)。您还可以使用skimage.morphology(如注释中所述使用ndlabel)。
http://scikit-
image.org/docs/dev/auto_examples/plot_label.html
这些是连接组件算法的示例,并且在任何常规图像处理包中都是标准的。ImageJ也使这一过程变得非常简单。
如果阴影有问题
Otsu阈值返回一个值:像素亮度,而您要做的就是保持所有比该阈值更暗的像素。这种方法正被您的阴影所绊倒,因此您需要尝试另一种分割算法,最好是进行局部分割的算法(即,它分别分割图像的小区域)。
自适应方法或局部方法不存在此问题,并且非常适合图像的阴影:
http://scikit-
image.org/docs/dev/auto_examples/plot_threshold_adaptive.html#example-plot-
threshold-adaptive-py
在mahotas中应该有其他分割方法,但是我只对scikit-
image有所了解。如果您想对细分进行认真的概述,请查看以下文章:https :
//peerj.com/preprints/671/
完全公开,这是我的论文。



