bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / draw / draw / line
function
skimage.draw.draw:line
source: /dev/scikit-image/src/skimage/draw/draw.py:360
Signature
def line(r0, c0, r1, c1)Summary
Generate line pixel coordinates.
Parameters
r0, c0: intStarting position (row, column).
r1, c1: intEnd position (row, column).
Returns
rr, cc: (N,) ndarray of intIndices of pixels that belong to the line. May be used to directly index into an array, e.g.
img[rr, cc] = 1.
Notes
Anti-aliased line generator is available with line_aa.
Examples
from skimage.draw import line img = np.zeros((10, 10), dtype=np.uint8) rr, cc = line(1, 1, 8, 8) img[rr, cc] = 1 img✓
Aliases
skimage.draw.line