嘿,我有以下问题,
我尝试过基于分水岭区域的算法,如此处的scikit教程: http://scikit-image.org/docs/dev/auto_examples/xx_applications/plot_coins_segmentation.html
from skimage.morphology import watershed
from skimage.filters import sobel
from scipy import ndimage as ndi
import numpy as np
from skimage import io
from scipy.signal import find_peaks_cwt
imageArray = io.imread('pathToImage')
count=0
for i in range(len(imageArray)):
evaluation_map = sobel(imageArray[i])
markers = np.zeros_like(imageArray[i])
histo,_= np.histogram(imageArray[i],bins=256)
lower=find_peaks_cwt(histo,np.arange(1,20))
markers[imageArray[i]<lower[0]] = 1
markers[imageArray[i]>lower[-1]] =2
segmentation = watershed(evaluation_map,markers)
segmentation = ndi.binary_fill_holes(segmentation-1)
imageArray[count],_ = ndi.label(segmentation)
这是一个循环,因为我有一堆这些图像。但是在分割之后,我总是得到一张黑色的图片。现在,我想知道是否存在一种更好/简单的方法来用这样的对象分割图片。