我有一些非常直接的代码来分割出一个blob,然后对它进行总体最小二乘线拟合,但是线的估计(蓝色)显然是不正确的。谁知道我做错了什么?
import skimage as s
import skimage.feature as feat
from skimage import measure
#dash is the original image of the dash as a numpy array
g= dash[2662:2800,3050:3263,0]
edges = feat.canny(g/255., 3.2, .01, .45)
fill = ndimage.binary_fill_holes(edges)
t = s.img_as_ubyte(flt.sobel_h(fill))/2+s.img_as_ubyte(flt.sobel_v(fill))/2
ptpairs = np.int0(np.where(t>160))
l = measure.LineModel()
l.estimate(ptpairs.T)
xdata = np.arange(60,80)
ydata = l.predict_y(xdata)
imshow(g+edges*100)
plot(xdata,ydata)