用法:
skimage.draw.line_nd(start, stop, *, endpoint=False, integer=True)
在 n 維中繪製 single-pixel 粗線。
生成的行將是ndim-connected。也就是說,該行中的兩個後續像素將是 n 維中的直接或對角相鄰像素。
- start:array-like,形狀(N,)
線的起始坐標。
- stop:array-like,形狀(N,)
線的結束坐標。
- endpoint:布爾型,可選
是否在返回的行中包含端點。默認為 False,這樣可以輕鬆繪製 multi-point 路徑。
- integer:布爾型,可選
是否將坐標四舍五入為整數。如果為 True(默認),則返回的坐標可用於直接索引到數組中。 False 可用於例如矢量繪圖。
- coords:數組元組
線上點的坐標。
參數:
返回:
例子:
>>> lin = line_nd((1, 1), (5, 2.5), endpoint=False) >>> lin (array([1, 2, 3, 4]), array([1, 1, 2, 2])) >>> im = np.zeros((6, 5), dtype=int) >>> im[lin] = 1 >>> im array([[0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]]) >>> line_nd([2, 1, 1], [5, 5, 2.5], endpoint=True) (array([2, 3, 4, 4, 5]), array([1, 2, 3, 4, 5]), array([1, 1, 2, 2, 2]))
相關用法
- Python skimage.draw.line_aa用法及代碼示例
- Python skimage.draw.line用法及代碼示例
- Python skimage.draw.random_shapes用法及代碼示例
- Python skimage.draw.polygon2mask用法及代碼示例
- Python skimage.draw.ellipse_perimeter用法及代碼示例
- Python skimage.draw.bezier_curve用法及代碼示例
- Python skimage.draw.set_color用法及代碼示例
- Python skimage.draw.circle_perimeter用法及代碼示例
- Python skimage.draw.polygon用法及代碼示例
- Python skimage.draw.rectangle_perimeter用法及代碼示例
- Python skimage.draw.ellipse用法及代碼示例
- Python skimage.draw.polygon_perimeter用法及代碼示例
- Python skimage.draw.circle_perimeter_aa用法及代碼示例
- Python skimage.draw.disk用法及代碼示例
- Python skimage.draw.rectangle用法及代碼示例
- Python skimage.data.binary_blobs用法及代碼示例
- Python skimage.data.file_hash用法及代碼示例
- Python skimage.feature.graycomatrix用法及代碼示例
- Python skimage.color.lab2lch用法及代碼示例
- Python skimage.feature.blob_doh用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.draw.line_nd。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。