python - ndimage.find_object ...颜色特征之后如何?

标签 python image-processing scipy

我有一个大图像,在标记后有大约 500 个特征。我知道如何使用 find_object 将它们放入切片中,但我想给它们上色以便看到结果。对此有什么快速建议吗?

最佳答案

您可以像这样使用 matplotlib:

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])

原图:

enter image description here

标记图像:

enter image description here

包含 Blob 的切片:

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

关于python - ndimage.find_object ...颜色特征之后如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11197993/

相关文章:

python - 如何确定二值图像中的对象方向? ( python ,OpenCV)

python - web2py:一个 View 中的多个表单

opencv - 在Numpy中为3D阵列制作2D蒙版

python - 绘制两个函数相关值的 "relation"

numpy - numpy和scipy中的指数衰减曲线拟合

python - SymPy:如何使 `nsolve` 返回包含找到的解决方案的字典

python - 使用 clean() 对带有下划线的字段进行 ModelForm 验证

android - 如何使用一个像素的 Sobel 矩阵

python - 为什么 plt.imshow 比 plt.pcolor 快得多?

image-processing - 考虑到噪音,在泳池中对游泳者进行对比的最有效方法